Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5cb7e60c73 | |||
| f9194042f4 |
+9
-8
@@ -7,7 +7,6 @@ stages:
|
||||
- analysis
|
||||
- docs
|
||||
- flatpak
|
||||
- publish
|
||||
- deploy
|
||||
|
||||
.cache-paths: &cache-paths
|
||||
@@ -25,7 +24,7 @@ variables:
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v33"
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v32"
|
||||
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
|
||||
|
||||
.only-default:
|
||||
@@ -58,7 +57,6 @@ style-check-diff:
|
||||
- "${CI_PROJECT_DIR}/_build/report*.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report*.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
|
||||
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
|
||||
@@ -338,11 +336,14 @@ reference:
|
||||
paths:
|
||||
- _reference
|
||||
|
||||
publish-docs:
|
||||
stage: publish
|
||||
pages:
|
||||
stage: deploy
|
||||
needs: ['reference']
|
||||
script:
|
||||
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
|
||||
- mv _reference/ public/
|
||||
- cp .gitlab-ci/pages/* public/
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
- master
|
||||
|
||||
@@ -48,9 +48,7 @@ RUN dnf -y install \
|
||||
libcloudproviders-devel \
|
||||
libepoxy-devel \
|
||||
libffi-devel \
|
||||
libjpeg-turbo-devel \
|
||||
libmount-devel \
|
||||
libpng-devel \
|
||||
librsvg2 \
|
||||
libselinux-devel \
|
||||
libubsan \
|
||||
|
||||
@@ -1,64 +1,3 @@
|
||||
Overview of Changes in 4.4.0
|
||||
============================
|
||||
|
||||
* Input:
|
||||
- Match IBus for display of Compose sequences
|
||||
- Match IBus for handling of mismatches
|
||||
- Handle Escape in Compose sequences
|
||||
- Allow multiple dead keys
|
||||
- Support 32bit keysyms
|
||||
|
||||
* GtkCheckButton:
|
||||
- Activate when moving focus
|
||||
|
||||
* GtkLabel:
|
||||
- Propertly ignore double underscores for mnemonics
|
||||
|
||||
* GtkPopoverMenu:
|
||||
- Fix focus cycling
|
||||
|
||||
* GtkTextView:
|
||||
- Improve word selection
|
||||
|
||||
* GdkToplevel:
|
||||
- Support the gnome-shell titlebar gesture protocol
|
||||
|
||||
* GdkDropTarget:
|
||||
- Allow creating drop targets in ui files
|
||||
|
||||
* gsk:
|
||||
- Handle partial color fonts correctly
|
||||
- Use harfbuzz for color font information
|
||||
- Avoid pango for glyph cache rendering
|
||||
- Shrink shadow extents
|
||||
|
||||
* Settings:
|
||||
- Change the default for gtk-split-cursor to FALSE
|
||||
|
||||
* Demos:
|
||||
- Small improvements to widget-factory
|
||||
- gtk-demo: Improve the hypertext demo
|
||||
- gtk-dem: Improve the clipboard demo
|
||||
|
||||
* X11:
|
||||
- Set WM_CLASS on toplevels
|
||||
|
||||
* Wayland:
|
||||
- Support wl_seat v7
|
||||
|
||||
* Windows:
|
||||
- Drop the local DND protocol
|
||||
- Avoid WGL if shaders don't work
|
||||
|
||||
* Translation updates:
|
||||
Belarusian
|
||||
Friulian
|
||||
Hebrew
|
||||
Khmer
|
||||
Persian
|
||||
Polish
|
||||
|
||||
|
||||
Overview of Changes in 4.3.2
|
||||
============================
|
||||
|
||||
|
||||
+12
-42
@@ -100,11 +100,7 @@ prepare_drag (GtkDragSource *source,
|
||||
DemoImage *demo = DEMO_IMAGE (widget);
|
||||
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (demo->image));
|
||||
|
||||
/* Textures can be serialized, paintables can't, so special case the textures */
|
||||
if (GDK_IS_TEXTURE (paintable))
|
||||
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, paintable);
|
||||
else
|
||||
return gdk_content_provider_new_typed (GDK_TYPE_PAINTABLE, paintable);
|
||||
return gdk_content_provider_new_typed (GDK_TYPE_PAINTABLE, paintable);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -133,11 +129,7 @@ copy_image (GtkWidget *widget,
|
||||
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (demo->image));
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
/* Textures can be serialized, paintables can't, so special case the textures */
|
||||
if (GDK_IS_TEXTURE (paintable))
|
||||
g_value_init (&value, GDK_TYPE_TEXTURE);
|
||||
else
|
||||
g_value_init (&value, GDK_TYPE_PAINTABLE);
|
||||
g_value_init (&value, GDK_TYPE_PAINTABLE);
|
||||
g_value_set_object (&value, paintable);
|
||||
gdk_clipboard_set_value (clipboard, &value);
|
||||
g_value_unset (&value);
|
||||
@@ -146,46 +138,24 @@ copy_image (GtkWidget *widget,
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
paste_image_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
|
||||
DemoImage *demo = DEMO_IMAGE (data);
|
||||
const GValue *value;
|
||||
|
||||
value = gdk_clipboard_read_value_finish (clipboard, result, NULL);
|
||||
if (value == NULL)
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (demo));
|
||||
g_object_unref (demo);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_image_set_from_paintable (GTK_IMAGE (demo->image), g_value_get_object (value));
|
||||
g_object_unref (demo);
|
||||
}
|
||||
|
||||
static void
|
||||
paste_image (GtkWidget *widget,
|
||||
const char *action_name,
|
||||
GVariant *parameter)
|
||||
{
|
||||
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
|
||||
GType type;
|
||||
DemoImage *demo = DEMO_IMAGE (widget);
|
||||
GdkContentProvider *content = gdk_clipboard_get_content (clipboard);
|
||||
GValue value = G_VALUE_INIT;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
if (gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GDK_TYPE_TEXTURE))
|
||||
type = GDK_TYPE_TEXTURE;
|
||||
else
|
||||
type = GDK_TYPE_PAINTABLE;
|
||||
g_value_init (&value, GDK_TYPE_PAINTABLE);
|
||||
if (!gdk_content_provider_get_value (content, &value, NULL))
|
||||
return;
|
||||
|
||||
gdk_clipboard_read_value_async (clipboard,
|
||||
type,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
paste_image_cb,
|
||||
g_object_ref (widget));
|
||||
paintable = GDK_PAINTABLE (g_value_get_object (&value));
|
||||
gtk_image_set_from_paintable (GTK_IMAGE (demo->image), paintable);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -255,12 +255,6 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
|
||||
INT_ATTR (insert_hyphens);
|
||||
break;
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,49,0)
|
||||
case PANGO_ATTR_LINE_HEIGHT:
|
||||
case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PANGO_ATTR_SHAPE:
|
||||
case PANGO_ATTR_ABSOLUTE_SIZE:
|
||||
case PANGO_ATTR_GRAVITY:
|
||||
|
||||
+22
-49
@@ -61,26 +61,12 @@ show_page (GtkTextView *text_view,
|
||||
int page)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter, start;
|
||||
GtkTextMark *mark;
|
||||
GtkTextIter iter;
|
||||
GtkWidget *child;
|
||||
GtkTextChildAnchor *anchor;
|
||||
GtkEventController *controller;
|
||||
GtkTextTag *bold, *mono, *nobreaks;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (text_view);
|
||||
|
||||
bold = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
"scale", PANGO_SCALE_X_LARGE,
|
||||
NULL);
|
||||
mono = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"family", "monospace",
|
||||
NULL);
|
||||
nobreaks = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"allow-breaks", FALSE,
|
||||
NULL);
|
||||
|
||||
gtk_text_buffer_set_text (buffer, "", 0);
|
||||
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
||||
gtk_text_buffer_begin_irreversible_action (buffer);
|
||||
@@ -118,22 +104,17 @@ show_page (GtkTextView *text_view,
|
||||
}
|
||||
else if (page == 2)
|
||||
{
|
||||
mark = gtk_text_buffer_create_mark (buffer, "mark", &iter, TRUE);
|
||||
GtkTextTag *tag;
|
||||
|
||||
gtk_text_buffer_insert_with_tags (buffer, &iter, "tag", -1, bold, NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, " /", -1);
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
|
||||
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
|
||||
gtk_text_buffer_insert (buffer, &iter, " ", -1);
|
||||
|
||||
gtk_text_buffer_move_mark (buffer, mark, &iter);
|
||||
gtk_text_buffer_insert_with_tags (buffer, &iter, "tag", -1, mono, NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, " /", -1);
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
|
||||
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
|
||||
gtk_text_buffer_insert (buffer, &iter, " ", -1);
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
"scale", PANGO_SCALE_X_LARGE,
|
||||
NULL);
|
||||
gtk_text_buffer_insert_with_tags (buffer, &iter, "tag", -1, tag, NULL);
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"family", "monospace",
|
||||
NULL);
|
||||
gtk_text_buffer_insert_with_tags (buffer, &iter, " / tag / ", -1, tag, NULL);
|
||||
|
||||
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
|
||||
child = gtk_image_new_from_icon_name ("audio-volume-high-symbolic");
|
||||
@@ -151,26 +132,20 @@ show_page (GtkTextView *text_view,
|
||||
"behavior of mouse and key presses, “lock” a range of text so the "
|
||||
"user can't edit it, or countless other things.\n", -1);
|
||||
insert_link (buffer, &iter, "Go back", 1);
|
||||
|
||||
gtk_text_buffer_delete_mark (buffer, mark);
|
||||
}
|
||||
else if (page == 3)
|
||||
{
|
||||
mark = gtk_text_buffer_create_mark (buffer, "mark", &iter, TRUE);
|
||||
GtkTextTag *tag;
|
||||
|
||||
gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext", -1, bold, NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, " /", -1);
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
|
||||
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
|
||||
gtk_text_buffer_insert (buffer, &iter, " ", -1);
|
||||
|
||||
gtk_text_buffer_move_mark (buffer, mark, &iter);
|
||||
gtk_text_buffer_insert_with_tags (buffer, &iter, "ˈhaɪ pərˌtɛkst", -1, mono, NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, " /", -1);
|
||||
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
|
||||
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
|
||||
gtk_text_buffer_insert (buffer, &iter, " ", -1);
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
"scale", PANGO_SCALE_X_LARGE,
|
||||
NULL);
|
||||
gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext", -1, tag, NULL);
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"family", "monospace",
|
||||
NULL);
|
||||
gtk_text_buffer_insert_with_tags (buffer, &iter, " / ˈhaɪ pərˌtɛkst / ", -1, tag, NULL);
|
||||
|
||||
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
|
||||
child = gtk_image_new_from_icon_name ("audio-volume-high-symbolic");
|
||||
@@ -184,8 +159,6 @@ show_page (GtkTextView *text_view,
|
||||
"Machine-readable text that is not sequential but is organized "
|
||||
"so that related items of information are connected.\n", -1);
|
||||
insert_link (buffer, &iter, "Go back", 1);
|
||||
|
||||
gtk_text_buffer_delete_mark (buffer, mark);
|
||||
}
|
||||
gtk_text_buffer_end_irreversible_action (buffer);
|
||||
}
|
||||
@@ -385,7 +358,7 @@ do_hypertext (GtkWidget *do_widget)
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.9 MiB |
@@ -696,37 +696,6 @@ on_range_to_changed (GtkSpinButton *to)
|
||||
gtk_spin_button_set_value (from, v2);
|
||||
}
|
||||
|
||||
static GdkContentProvider *
|
||||
on_picture_drag_prepare (GtkDragSource *source,
|
||||
double x,
|
||||
double y,
|
||||
gpointer unused)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
|
||||
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
|
||||
|
||||
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, gtk_picture_get_paintable (GTK_PICTURE (picture)));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_picture_drop (GtkDropTarget *dest,
|
||||
const GValue *value,
|
||||
double x,
|
||||
double y,
|
||||
gpointer unused)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
|
||||
paintable = g_value_get_object (value);
|
||||
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
info_bar_response (GtkWidget *infobar, int response_id)
|
||||
{
|
||||
@@ -1213,7 +1182,7 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
GtkWidget *child;
|
||||
int i;
|
||||
const char *resources[] = {
|
||||
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
|
||||
"sunset.jpg", "snowy.jpg", "portland-rose.jpg"
|
||||
};
|
||||
|
||||
if (GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (flowbox), "populated")))
|
||||
@@ -2071,8 +2040,6 @@ activate (GApplication *app)
|
||||
"on_page_combo_changed", (GCallback)on_page_combo_changed,
|
||||
"on_range_from_changed", (GCallback)on_range_from_changed,
|
||||
"on_range_to_changed", (GCallback)on_range_to_changed,
|
||||
"on_picture_drag_prepare", (GCallback)on_picture_drag_prepare,
|
||||
"on_picture_drop", (GCallback)on_picture_drop,
|
||||
"tab_close_cb", (GCallback)tab_close_cb,
|
||||
"increase_icon_size", (GCallback)increase_icon_size,
|
||||
"decrease_icon_size", (GCallback)decrease_icon_size,
|
||||
|
||||
@@ -115,8 +115,7 @@
|
||||
<gresource prefix="/org/gtk/WidgetFactory4">
|
||||
<file>gtk-logo.webm</file>
|
||||
<file>sunset.jpg</file>
|
||||
<file>snowy.jpg</file>
|
||||
<file>portland-rose.jpg</file>
|
||||
<file>nyc.jpg</file>
|
||||
<file>beach.jpg</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
||||
@@ -1051,9 +1051,22 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="spacing">10</property>
|
||||
<property name="hexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<property name="valign">start</property>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="label" translatable="yes"><b>Video</b></property>
|
||||
<property name="use-markup">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVideo">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="margin-bottom">6</property>
|
||||
<property name="autoplay">1</property>
|
||||
<property name="loop">1</property>
|
||||
<property name="file">resource:///org/gtk/WidgetFactory4/gtk-logo.webm</property>
|
||||
@@ -1062,78 +1075,66 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="label" translatable="yes"><b>Text Styles</b></property>
|
||||
<property name="use-markup">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<property name="propagate-natural-height">1</property>
|
||||
<property name="propagate-natural-width">1</property>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Large Title</property>
|
||||
<style><class name="large-title"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Title 1</property>
|
||||
<style><class name="title-1"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Title 2</property>
|
||||
<style><class name="title-2"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Title 3</property>
|
||||
<style><class name="title-3"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Title 4</property>
|
||||
<style><class name="title-4"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Heading</property>
|
||||
<style><class name="heading"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Body</property>
|
||||
<style><class name="body"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Caption Heading</property>
|
||||
<style><class name="caption-heading"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Caption</property>
|
||||
<style><class name="caption"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Large Title</property>
|
||||
<style><class name="large-title"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Title 1</property>
|
||||
<style><class name="title-1"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Title 2</property>
|
||||
<style><class name="title-2"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Title 3</property>
|
||||
<style><class name="title-3"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Title 4</property>
|
||||
<style><class name="title-4"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Heading</property>
|
||||
<style><class name="heading"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Body</property>
|
||||
<style><class name="body"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Caption Heading</property>
|
||||
<style><class name="caption-heading"/></style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Caption</property>
|
||||
<style><class name="caption"/></style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -1250,21 +1251,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
<property name="child">
|
||||
<object class="GtkPicture">
|
||||
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<property name="actions">copy</property>
|
||||
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDropTarget">
|
||||
<property name="actions">copy</property>
|
||||
<property name="formats">GdkTexture</property>
|
||||
<signal name="drop" handler="on_picture_drop" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkBox" id="box6">
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="tab">
|
||||
@@ -1277,21 +1265,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
<property name="child">
|
||||
<object class="GtkPicture">
|
||||
<property name="file">resource:///org/gtk/WidgetFactory4/nyc.jpg</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<property name="actions">copy</property>
|
||||
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDropTarget">
|
||||
<property name="actions">copy</property>
|
||||
<property name="formats">GdkTexture</property>
|
||||
<signal name="drop" handler="on_picture_drop" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkBox" id="box7">
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="tab">
|
||||
@@ -1303,22 +1278,10 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
<property name="position">2</property>
|
||||
<property name="child">
|
||||
<object class="GtkPicture">
|
||||
<property name="file">resource:///org/gtk/WidgetFactory4/beach.jpg</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<property name="actions">copy</property>
|
||||
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDropTarget">
|
||||
<property name="actions">copy</property>
|
||||
<property name="formats">GdkTexture</property>
|
||||
<signal name="drop" handler="on_picture_drop" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<object class="GtkBox" id="box8">
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="tab">
|
||||
@@ -1336,7 +1299,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="box8">
|
||||
<object class="GtkBox" id="box9">
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
@@ -13,7 +13,7 @@ devhelp = true
|
||||
[dependencies."GObject-2.0"]
|
||||
name = "GObject"
|
||||
description = "The base type system library"
|
||||
docs_url = "https://docs.gtk.org/gobject/"
|
||||
docs_url = "https://developer.gnome.org/gobject/stable"
|
||||
|
||||
[theme]
|
||||
name = "basic"
|
||||
|
||||
@@ -13,7 +13,7 @@ devhelp = true
|
||||
[dependencies."GObject-2.0"]
|
||||
name = "GObject"
|
||||
description = "The base type system library"
|
||||
docs_url = "https://docs.gtk.org/gobject/"
|
||||
docs_url = "https://developer.gnome.org/gobject/stable"
|
||||
|
||||
[theme]
|
||||
name = "basic"
|
||||
|
||||
@@ -14,7 +14,7 @@ search_index = true
|
||||
[dependencies."GObject-2.0"]
|
||||
name = "GObject"
|
||||
description = "The base type system library"
|
||||
docs_url = "https://docs.gtk.org/gobject/"
|
||||
docs_url = "https://developer.gnome.org/gobject/stable"
|
||||
|
||||
[dependencies."cairo-1.0"]
|
||||
name = "Cairo"
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
expand_content_md_files = [
|
||||
]
|
||||
|
||||
if get_option('gtk_doc')
|
||||
gdk4_toml = configure_file(
|
||||
input: 'gdk4.toml.in',
|
||||
output: 'gdk4.toml',
|
||||
configuration: toml_conf,
|
||||
install: true,
|
||||
install_dir: docs_dir / 'gdk4',
|
||||
)
|
||||
gdk4_toml = configure_file(input: 'gdk4.toml.in', output: 'gdk4.toml', configuration: toml_conf)
|
||||
gdk4x11_toml = configure_file(input: 'gdk4-x11.toml.in', output: 'gdk4-x11.toml', configuration: toml_conf)
|
||||
gdk4wayland_toml = configure_file(input: 'gdk4-wayland.toml.in', output: 'gdk4-wayland.toml', configuration: toml_conf)
|
||||
|
||||
if get_option('gtk_doc')
|
||||
custom_target('gdk4-doc',
|
||||
input: [ gdk4_toml, gdk_gir[0] ],
|
||||
output: 'gdk4',
|
||||
@@ -32,14 +28,6 @@ if get_option('gtk_doc')
|
||||
)
|
||||
|
||||
if x11_enabled
|
||||
gdk4x11_toml = configure_file(
|
||||
input: 'gdk4-x11.toml.in',
|
||||
output: 'gdk4-x11.toml',
|
||||
configuration: toml_conf,
|
||||
install: true,
|
||||
install_dir: docs_dir / 'gdk4-x11',
|
||||
)
|
||||
|
||||
custom_target('gdk4-x11-doc',
|
||||
input: [ gdk4x11_toml, gdk_x11_gir[0] ],
|
||||
output: 'gdk4-x11',
|
||||
@@ -64,14 +52,6 @@ if get_option('gtk_doc')
|
||||
endif
|
||||
|
||||
if wayland_enabled
|
||||
gdk4wayland_toml = configure_file(
|
||||
input: 'gdk4-wayland.toml.in',
|
||||
output: 'gdk4-wayland.toml',
|
||||
configuration: toml_conf,
|
||||
install: true,
|
||||
install_dir: docs_dir / 'gdk4-wayland',
|
||||
)
|
||||
|
||||
custom_target('gdk4-wayland-doc',
|
||||
input: [ gdk4wayland_toml, gdk_wayland_gir[0] ],
|
||||
output: 'gdk4-wayland',
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
|
||||
// A map between namespaces and base URLs for their online documentation
|
||||
baseURLs = [
|
||||
[ 'GLib', 'https://docs.gtk.org/glib/' ],
|
||||
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
|
||||
[ 'Gio', 'https://docs.gtk.org/gio/' ],
|
||||
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
|
||||
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
|
||||
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
|
||||
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
|
||||
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
|
||||
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
|
||||
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
|
||||
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
|
||||
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
|
||||
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
|
||||
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
|
||||
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
|
||||
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
|
||||
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
|
||||
]
|
||||
|
||||
@@ -14,7 +14,7 @@ search_index = true
|
||||
[dependencies."GObject-2.0"]
|
||||
name = "GObject"
|
||||
description = "The base type system library"
|
||||
docs_url = "https://docs.gtk.org/gobject/"
|
||||
docs_url = "https://developer.gnome.org/gobject/stable/"
|
||||
|
||||
[dependencies."Graphene-1.0"]
|
||||
name = "Graphene"
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
if get_option('gtk_doc')
|
||||
gsk4_toml = configure_file(
|
||||
input: 'gsk4.toml.in',
|
||||
output: 'gsk4.toml',
|
||||
configuration: toml_conf,
|
||||
install: true,
|
||||
install_dir: docs_dir / 'gsk4',
|
||||
)
|
||||
gsk4_toml = configure_file(input: 'gsk4.toml.in', output: 'gsk4.toml', configuration: toml_conf)
|
||||
|
||||
if get_option('gtk_doc')
|
||||
custom_target('gsk4-doc',
|
||||
input: [ gsk4_toml, gsk_gir[0] ],
|
||||
output: 'gsk4',
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
|
||||
// A map between namespaces and base URLs for their online documentation
|
||||
baseURLs = [
|
||||
[ 'GLib', 'https://docs.gtk.org/glib/' ],
|
||||
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
|
||||
[ 'Gio', 'https://docs.gtk.org/gio/' ],
|
||||
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
|
||||
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
|
||||
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
|
||||
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
|
||||
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
|
||||
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
|
||||
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
|
||||
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
|
||||
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
|
||||
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
|
||||
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
|
||||
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
|
||||
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
|
||||
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
|
||||
]
|
||||
|
||||
@@ -14,7 +14,7 @@ search_index = true
|
||||
[dependencies."GObject-2.0"]
|
||||
name = "GObject"
|
||||
description = "The base type system library"
|
||||
docs_url = "https://docs.gtk.org/gobject/"
|
||||
docs_url = "https://developer.gnome.org/gobject/stable"
|
||||
|
||||
[dependencies."Graphene-1.0"]
|
||||
name = "Graphene"
|
||||
|
||||
@@ -137,14 +137,6 @@ capture phase, and key bindings locally, during the target phase.
|
||||
Under the hood, all shortcuts are represented as instances of `GtkShortcut`,
|
||||
and they are managed by `GtkShortcutController`.
|
||||
|
||||
## Text input
|
||||
|
||||
When actual text input is needed (i.e. not just keyboard shortcuts),
|
||||
input method support can be added to a widget by connecting an input
|
||||
method context and listening to its `::commit` signal. To create a new
|
||||
input method context, use gtk_im_multicontext_new(), to provide it with
|
||||
input, use gtk_event_controller_key_set_im_context().
|
||||
|
||||
## Event controllers and gestures
|
||||
|
||||
Event controllers are standalone objects that can perform
|
||||
|
||||
@@ -27,15 +27,9 @@ expand_content_md_files = [
|
||||
'visual_index.md'
|
||||
]
|
||||
|
||||
if get_option('gtk_doc')
|
||||
gtk4_toml = configure_file(
|
||||
input: 'gtk4.toml.in',
|
||||
output: 'gtk4.toml',
|
||||
configuration: toml_conf,
|
||||
install: true,
|
||||
install_dir: docs_dir / 'gtk4',
|
||||
)
|
||||
gtk4_toml = configure_file(input: 'gtk4.toml.in', output: 'gtk4.toml', configuration: toml_conf)
|
||||
|
||||
if get_option('gtk_doc')
|
||||
custom_target('gtk4-doc',
|
||||
input: [ gtk4_toml, gtk_gir[0] ],
|
||||
output: 'gtk4',
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
|
||||
// A map between namespaces and base URLs for their online documentation
|
||||
baseURLs = [
|
||||
[ 'GLib', 'https://docs.gtk.org/glib/' ],
|
||||
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
|
||||
[ 'Gio', 'https://docs.gtk.org/gio/' ],
|
||||
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
|
||||
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
|
||||
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
|
||||
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
|
||||
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
|
||||
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
|
||||
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
|
||||
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
|
||||
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
|
||||
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
|
||||
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
|
||||
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
|
||||
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
|
||||
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
|
||||
]
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
@@ -464,7 +463,7 @@ gdk_broadway_display_flush_in_idle (GdkDisplay *display)
|
||||
if (broadway_display->idle_flush_id == 0)
|
||||
{
|
||||
broadway_display->idle_flush_id = g_idle_add (flush_idle, g_object_ref (display));
|
||||
gdk_source_set_static_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
|
||||
g_source_set_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,11 +57,4 @@ guint gdk_parse_debug_var (const char *variable,
|
||||
# define g_memdup2(mem,size) g_memdup((mem),(size))
|
||||
#endif
|
||||
|
||||
void gdk_source_set_static_name_by_id (guint tag,
|
||||
const char *name);
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2, 69, 1)
|
||||
#define g_source_set_static_name(source, name) g_source_set_name ((source), (name))
|
||||
#endif
|
||||
|
||||
#endif /* __GDK__PRIVATE_H__ */
|
||||
|
||||
@@ -414,17 +414,3 @@ gdk_find_base_dir (const char *text,
|
||||
return dir;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_source_set_static_name_by_id (guint tag,
|
||||
const char *name)
|
||||
{
|
||||
GSource *source;
|
||||
|
||||
g_return_if_fail (tag > 0);
|
||||
|
||||
source = g_main_context_find_source_by_id (NULL, tag);
|
||||
if (source == NULL)
|
||||
return;
|
||||
|
||||
g_source_set_static_name (source, name);
|
||||
}
|
||||
|
||||
+8
-76
@@ -179,76 +179,6 @@ gdk_content_formats_new_for_gtype (GType type)
|
||||
return gdk_content_formats_new_take (data, 1, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_content_formats_parse:
|
||||
* @string: the string to parse
|
||||
*
|
||||
* Parses the given @string into `GdkContentFormats` and
|
||||
* returns the formats.
|
||||
*
|
||||
* Strings printed via [method@Gdk.ContentFormats.to_string]
|
||||
* can be read in again successfully using this function.
|
||||
*
|
||||
* If @string does not describe valid content formats, %NULL
|
||||
* is returned.
|
||||
*
|
||||
* Returns: (nullable): the content formats if @string is valid
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
GdkContentFormats *
|
||||
gdk_content_formats_parse (const char *string)
|
||||
{
|
||||
GdkContentFormatsBuilder *builder;
|
||||
char **split;
|
||||
gsize i;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
|
||||
split = g_strsplit_set (string, "\t\n\f\r ", -1); /* same as g_ascii_isspace() */
|
||||
builder = gdk_content_formats_builder_new ();
|
||||
|
||||
/* first the GTypes */
|
||||
for (i = 0; split[i] != NULL; i++)
|
||||
{
|
||||
GType type;
|
||||
|
||||
if (split[i][0] == 0)
|
||||
continue;
|
||||
|
||||
type = g_type_from_name (split[i]);
|
||||
if (type != 0)
|
||||
gdk_content_formats_builder_add_gtype (builder, type);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/* then the mime types */
|
||||
for (; split[i] != NULL; i++)
|
||||
{
|
||||
const char *mime_type;
|
||||
|
||||
if (split[i][0] == 0)
|
||||
continue;
|
||||
|
||||
mime_type = gdk_intern_mime_type (split[i]);
|
||||
if (mime_type)
|
||||
gdk_content_formats_builder_add_mime_type (builder, mime_type);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (split[i] != NULL)
|
||||
{
|
||||
g_strfreev (split);
|
||||
gdk_content_formats_builder_unref (builder);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_strfreev (split);
|
||||
return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_content_formats_ref:
|
||||
* @formats: a `GdkContentFormats`
|
||||
@@ -297,8 +227,10 @@ gdk_content_formats_unref (GdkContentFormats *formats)
|
||||
*
|
||||
* Prints the given @formats into a string for human consumption.
|
||||
*
|
||||
* The result of this function can later be parsed with
|
||||
* [func@Gdk.ContentFormats.parse].
|
||||
* This is meant for debugging and logging.
|
||||
*
|
||||
* The form of the representation may change at any time and is
|
||||
* not guaranteed to stay identical.
|
||||
*/
|
||||
void
|
||||
gdk_content_formats_print (GdkContentFormats *formats,
|
||||
@@ -309,18 +241,20 @@ gdk_content_formats_print (GdkContentFormats *formats,
|
||||
g_return_if_fail (formats != NULL);
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
g_string_append (string, "{ ");
|
||||
for (i = 0; i < formats->n_gtypes; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
g_string_append (string, " ");
|
||||
g_string_append (string, ", ");
|
||||
g_string_append (string, g_type_name (formats->gtypes[i]));
|
||||
}
|
||||
for (i = 0; i < formats->n_mime_types; i++)
|
||||
{
|
||||
if (i > 0 || formats->n_gtypes > 0)
|
||||
g_string_append (string, " ");
|
||||
g_string_append (string, ", ");
|
||||
g_string_append (string, formats->mime_types[i]);
|
||||
}
|
||||
g_string_append (string, " }");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -329,8 +263,6 @@ gdk_content_formats_print (GdkContentFormats *formats,
|
||||
*
|
||||
* Prints the given @formats into a human-readable string.
|
||||
*
|
||||
* The resulting string can be parsed with [func@Gdk.ContentFormats.parse].
|
||||
*
|
||||
* This is a small wrapper around [method@Gdk.ContentFormats.print]
|
||||
* to help when debugging.
|
||||
*
|
||||
|
||||
@@ -40,8 +40,6 @@ GdkContentFormats * gdk_content_formats_new (const char
|
||||
guint n_mime_types);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentFormats * gdk_content_formats_new_for_gtype (GType type);
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
GdkContentFormats * gdk_content_formats_parse (const char *string);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentFormats * gdk_content_formats_ref (GdkContentFormats *formats);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -80,7 +80,7 @@ gdk_content_provider_value_get_value (GdkContentProvider *provider,
|
||||
{
|
||||
GdkContentProviderValue *content = GDK_CONTENT_PROVIDER_VALUE (provider);
|
||||
|
||||
if (G_VALUE_HOLDS (&content->value, G_VALUE_TYPE (value)))
|
||||
if (G_VALUE_HOLDS (value, G_VALUE_TYPE (&content->value)))
|
||||
{
|
||||
g_value_copy (&content->value, value);
|
||||
return TRUE;
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
#include "gdk.h"
|
||||
#include "gdk-private.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
@@ -308,15 +307,12 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
|
||||
|
||||
if (priv->flush_idle_id == 0 && RUN_FLUSH_IDLE (priv))
|
||||
{
|
||||
GSource *source;
|
||||
|
||||
priv->flush_idle_id = g_timeout_add_full (GDK_PRIORITY_EVENTS + 1,
|
||||
min_interval,
|
||||
gdk_frame_clock_flush_idle,
|
||||
g_object_ref (clock_idle),
|
||||
(GDestroyNotify) g_object_unref);
|
||||
source = g_main_context_find_source_by_id (NULL, priv->flush_idle_id);
|
||||
g_source_set_static_name (source, "[gtk] gdk_frame_clock_flush_idle");
|
||||
g_source_set_name_by_id (priv->flush_idle_id, "[gtk] gdk_frame_clock_flush_idle");
|
||||
}
|
||||
|
||||
if (!priv->in_paint_idle &&
|
||||
@@ -328,7 +324,7 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
|
||||
gdk_frame_clock_paint_idle,
|
||||
g_object_ref (clock_idle),
|
||||
(GDestroyNotify) g_object_unref);
|
||||
gdk_source_set_static_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
|
||||
g_source_set_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -856,8 +856,6 @@ gdk_gl_context_set_is_legacy (GdkGLContext *context,
|
||||
* is not, this function will return %FALSE.
|
||||
*
|
||||
* Returns: %TRUE if the two GL contexts are compatible.
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
gboolean
|
||||
gdk_gl_context_is_shared (GdkGLContext *self,
|
||||
|
||||
@@ -78,13 +78,6 @@ gdk_toplevel_default_show_window_menu (GdkToplevel *toplevel,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_toplevel_default_titlebar_gesture (GdkToplevel *toplevel,
|
||||
GdkTitlebarGesture gesture)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_toplevel_default_supports_edge_constraints (GdkToplevel *toplevel)
|
||||
{
|
||||
@@ -121,7 +114,6 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
|
||||
iface->supports_edge_constraints = gdk_toplevel_default_supports_edge_constraints;
|
||||
iface->inhibit_system_shortcuts = gdk_toplevel_default_inhibit_system_shortcuts;
|
||||
iface->restore_system_shortcuts = gdk_toplevel_default_restore_system_shortcuts;
|
||||
iface->titlebar_gesture = gdk_toplevel_default_titlebar_gesture;
|
||||
|
||||
/**
|
||||
* GdkToplevel:state: (attributes org.gtk.Property.get=gdk_toplevel_get_state)
|
||||
@@ -724,13 +716,3 @@ gdk_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
x, y,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
GdkTitlebarGesture gesture)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_TOPLEVEL (toplevel), FALSE);
|
||||
|
||||
return GDK_TOPLEVEL_GET_IFACE (toplevel)->titlebar_gesture (toplevel,
|
||||
gesture);
|
||||
}
|
||||
|
||||
@@ -115,13 +115,6 @@ typedef enum
|
||||
GDK_TOPLEVEL_STATE_LEFT_RESIZABLE = 1 << 15
|
||||
} GdkToplevelState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_TITLEBAR_GESTURE_DOUBLE_CLICK = 1,
|
||||
GDK_TITLEBAR_GESTURE_RIGHT_CLICK = 2,
|
||||
GDK_TITLEBAR_GESTURE_MIDDLE_CLICK = 3
|
||||
} GdkTitlebarGesture;
|
||||
|
||||
|
||||
#define GDK_TYPE_TOPLEVEL (gdk_toplevel_get_type ())
|
||||
|
||||
@@ -203,10 +196,6 @@ void gdk_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
gboolean gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
GdkTitlebarGesture gesture);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_TOPLEVEL_H__ */
|
||||
|
||||
@@ -38,8 +38,6 @@ struct _GdkToplevelInterface
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
gboolean (* titlebar_gesture) (GdkToplevel *toplevel,
|
||||
GdkTitlebarGesture gesture);
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
||||
+39
-39
@@ -117,104 +117,104 @@ gdk_vulkan_strerror (VkResult result)
|
||||
switch (result)
|
||||
{
|
||||
case VK_SUCCESS:
|
||||
return "Command successfully completed. (VK_SUCCESS)";
|
||||
return "Command successfully completed.";
|
||||
case VK_NOT_READY:
|
||||
return "A fence or query has not yet completed. (VK_NOT_READY)";
|
||||
return "A fence or query has not yet completed.";
|
||||
case VK_TIMEOUT:
|
||||
return "A wait operation has not completed in the specified time. (VK_TIMEOUT)";
|
||||
return "A wait operation has not completed in the specified time.";
|
||||
case VK_EVENT_SET:
|
||||
return "An event is signaled. (VK_EVENT_SET)";
|
||||
return "An event is signaled.";
|
||||
case VK_EVENT_RESET:
|
||||
return "An event is unsignaled. (VK_EVENT_RESET)";
|
||||
return "An event is unsignaled.";
|
||||
case VK_INCOMPLETE:
|
||||
return "A return array was too small for the result. (VK_INCOMPLETE)";
|
||||
return "A return array was too small for the result.";
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
return "A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully. (VK_SUBOPTIMAL_KHR)";
|
||||
return "A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully.";
|
||||
case VK_ERROR_OUT_OF_HOST_MEMORY:
|
||||
return "A host memory allocation has failed. (VK_ERROR_OUT_OF_HOST_MEMORY)";
|
||||
return "A host memory allocation has failed.";
|
||||
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
|
||||
return "A device memory allocation has failed. (VK_ERROR_OUT_OF_DEVICE_MEMORY)";
|
||||
return "A device memory allocation has failed.";
|
||||
case VK_ERROR_INITIALIZATION_FAILED:
|
||||
return "Initialization of an object could not be completed for implementation-specific reasons. (VK_ERROR_INITIALIZATION_FAILED)";
|
||||
return "Initialization of an object could not be completed for implementation-specific reasons.";
|
||||
case VK_ERROR_DEVICE_LOST:
|
||||
return "The logical or physical device has been lost. (VK_ERROR_DEVICE_LOST)";
|
||||
return "The logical or physical device has been lost.";
|
||||
case VK_ERROR_MEMORY_MAP_FAILED:
|
||||
return "Mapping of a memory object has failed. (VK_ERROR_MEMORY_MAP_FAILED)";
|
||||
return "Mapping of a memory object has failed.";
|
||||
case VK_ERROR_LAYER_NOT_PRESENT:
|
||||
return "A requested layer is not present or could not be loaded. (VK_ERROR_LAYER_NOT_PRESENT)";
|
||||
return "A requested layer is not present or could not be loaded.";
|
||||
case VK_ERROR_EXTENSION_NOT_PRESENT:
|
||||
return "A requested extension is not supported. (VK_ERROR_EXTENSION_NOT_PRESENT)";
|
||||
return "A requested extension is not supported.";
|
||||
case VK_ERROR_FEATURE_NOT_PRESENT:
|
||||
return "A requested feature is not supported. (VK_ERROR_FEATURE_NOT_PRESENT)";
|
||||
return "A requested feature is not supported.";
|
||||
case VK_ERROR_INCOMPATIBLE_DRIVER:
|
||||
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons. (VK_ERROR_INCOMPATIBLE_DRIVER)";
|
||||
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons.";
|
||||
case VK_ERROR_TOO_MANY_OBJECTS:
|
||||
return "Too many objects of the type have already been created. (VK_ERROR_TOO_MANY_OBJECTS)";
|
||||
return "Too many objects of the type have already been created.";
|
||||
case VK_ERROR_FORMAT_NOT_SUPPORTED:
|
||||
return "A requested format is not supported on this device. (VK_ERROR_FORMAT_NOT_SUPPORTED)";
|
||||
return "A requested format is not supported on this device.";
|
||||
#if VK_HEADER_VERSION >= 24
|
||||
case VK_ERROR_FRAGMENTED_POOL:
|
||||
return "A requested pool allocation has failed due to fragmentation of the pool’s memory. (VK_ERROR_FRAGMENTED_POOL)";
|
||||
return "A requested pool allocation has failed due to fragmentation of the pool’s memory.";
|
||||
#endif
|
||||
case VK_ERROR_SURFACE_LOST_KHR:
|
||||
return "A surface is no longer available. (VK_ERROR_SURFACE_LOST_KHR)";
|
||||
return "A surface is no longer available.";
|
||||
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
|
||||
return "The requested window is already in use by Vulkan or another API in a manner which prevents it from being used again. (VK_ERROR_NATIVE_WINDOW_IN_USE_KHR)";
|
||||
return "The requested window is already in use by Vulkan or another API in a manner which prevents it from being used again.";
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
return "A surface has changed in such a way that it is no longer compatible with the swapchain. (VK_ERROR_OUT_OF_DATE_KHR)";
|
||||
return "A surface has changed in such a way that it is no longer compatible with the swapchain.";
|
||||
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
|
||||
return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image. (VK_ERROR_INCOMPATIBLE_DISPLAY_KHR)";
|
||||
return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image.";
|
||||
case VK_ERROR_VALIDATION_FAILED_EXT:
|
||||
return "The application caused the validation layer to fail. (VK_ERROR_VALIDATION_FAILED_EXT)";
|
||||
return "The application caused the validation layer to fail.";
|
||||
case VK_ERROR_INVALID_SHADER_NV:
|
||||
return "One or more shaders failed to compile or link. (VK_ERROR_INVALID_SHADER_NV)";
|
||||
return "One or more shaders failed to compile or link.";
|
||||
#if VK_HEADER_VERSION >= 39
|
||||
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
|
||||
return "A pool memory allocation has failed. (VK_ERROR_OUT_OF_POOL_MEMORY_KHR)";
|
||||
return "A pool memory allocation has failed.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 54
|
||||
case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR:
|
||||
return "An external handle is not a valid handle of the specified type. (VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR)";
|
||||
return "An external handle is not a valid handle of the specified type.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 64
|
||||
case VK_ERROR_NOT_PERMITTED_EXT:
|
||||
return "The caller does not have sufficient privileges. (VK_ERROR_NOT_PERMITTED_EXT)";
|
||||
return "The caller does not have sufficient privileges.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 72
|
||||
case VK_ERROR_FRAGMENTATION_EXT:
|
||||
return "A descriptor pool creation has failed due to fragmentation. (VK_ERROR_FRAGMENTATION_EXT)";
|
||||
return "A descriptor pool creation has failed due to fragmentation";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 89
|
||||
case VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT:
|
||||
return "Invalid DRM format modifier plane layout (VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT)";
|
||||
return "Invalid DRM format modifier plane layout";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 97
|
||||
case VK_ERROR_INVALID_DEVICE_ADDRESS_EXT:
|
||||
return "Invalid device address (VK_ERROR_INVALID_DEVICE_ADDRESS_EXT)";
|
||||
return "Invalid device address";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 105
|
||||
case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
|
||||
return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exclusive full-screen access. (VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT)";
|
||||
return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exclusive full-screen access.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 131
|
||||
case VK_ERROR_UNKNOWN:
|
||||
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred. (VK_ERROR_UNKNOWN)";
|
||||
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 135
|
||||
#if VK_HEADER_VERSION < 162
|
||||
case VK_ERROR_INCOMPATIBLE_VERSION_KHR:
|
||||
return "This error was removed by the Vulkan gods. (VK_ERROR_INCOMPATIBLE_VERSION_KHR)";
|
||||
return "This error was removed by the Vulkan gods.";
|
||||
#endif
|
||||
case VK_THREAD_IDLE_KHR:
|
||||
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call. (VK_THREAD_IDLE_KHR)";
|
||||
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call.";
|
||||
case VK_THREAD_DONE_KHR:
|
||||
return "A deferred operation is not complete but there is no work remaining to assign to additional threads. (VK_THREAD_DONE_KHR)";
|
||||
return "A deferred operation is not complete but there is no work remaining to assign to additional threads.";
|
||||
case VK_OPERATION_DEFERRED_KHR:
|
||||
return "A deferred operation was requested and at least some of the work was deferred. (VK_OPERATION_DEFERRED_KHR)";
|
||||
return "A deferred operation was requested and at least some of the work was deferred.";
|
||||
case VK_OPERATION_NOT_DEFERRED_KHR:
|
||||
return "A deferred operation was requested and no operations were deferred. (VK_OPERATION_NOT_DEFERRED_KHR)";
|
||||
return "A deferred operation was requested and no operations were deferred.";
|
||||
case VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT:
|
||||
return "A requested pipeline creation would have required compilation, but the application requested compilation to not be performed. (VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT)";
|
||||
return "A requested pipeline creation would have required compilation, but the application requested compilation to not be performed.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION < 140
|
||||
case VK_RESULT_RANGE_SIZE:
|
||||
|
||||
@@ -197,7 +197,7 @@ gdk_display_link_source_new (void)
|
||||
gdk_display_link_source_frame_cb,
|
||||
source);
|
||||
|
||||
g_source_set_static_name (source, "[gdk] quartz frame clock");
|
||||
g_source_set_name (source, "[gdk] quartz frame clock");
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include "gdkmacosdevice-private.h"
|
||||
#include "gdkmacoscursor-private.h"
|
||||
@@ -162,7 +161,7 @@ gdk_macos_drag_drop_done (GdkDrag *drag,
|
||||
gdk_macos_zoomback_timeout,
|
||||
zb,
|
||||
(GDestroyNotify) gdk_macos_zoomback_destroy);
|
||||
gdk_source_set_static_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
|
||||
g_source_set_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
|
||||
g_object_unref (drag);
|
||||
}
|
||||
|
||||
@@ -243,11 +242,9 @@ gdk_macos_drag_drop_performed (GdkDrag *drag,
|
||||
|
||||
g_assert (GDK_IS_MACOS_DRAG (self));
|
||||
|
||||
g_object_ref (self);
|
||||
drag_ungrab (self);
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
gdk_drag_drop_done (drag, TRUE);
|
||||
g_object_unref (self);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1063,7 +1063,7 @@ _gdk_macos_event_source_new (GdkMacosDisplay *display)
|
||||
event_poll_fd.fd = -1;
|
||||
|
||||
source = g_source_new (&event_funcs, sizeof (GdkMacosEventSource));
|
||||
g_source_set_static_name (source, "GDK Quartz event source");
|
||||
g_source_set_name (source, "GDK Quartz event source");
|
||||
g_source_add_poll (source, &event_poll_fd);
|
||||
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
|
||||
g_source_set_can_recurse (source, TRUE);
|
||||
|
||||
@@ -460,7 +460,6 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
|
||||
pointer->cursor_timeout_id == 0)
|
||||
{
|
||||
guint id;
|
||||
GSource *source;
|
||||
|
||||
gdk_wayland_pointer_stop_cursor_animation (pointer);
|
||||
|
||||
@@ -468,8 +467,7 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
|
||||
id = g_timeout_add (next_image_delay,
|
||||
(GSourceFunc) gdk_wayland_device_update_surface_cursor,
|
||||
device);
|
||||
source = g_main_context_find_source_by_id (NULL, id);
|
||||
g_source_set_static_name (source, "[gtk] gdk_wayland_device_update_surface_cursor");
|
||||
g_source_set_name_by_id (id, "[gtk] gdk_wayland_device_update_surface_cursor");
|
||||
pointer->cursor_timeout_id = id;
|
||||
}
|
||||
else
|
||||
@@ -2220,7 +2218,7 @@ deliver_key_event (GdkWaylandSeat *seat,
|
||||
timeout = (seat->repeat_deadline - now) / 1000L;
|
||||
|
||||
seat->repeat_timer = g_timeout_add (timeout, keyboard_repeat, seat);
|
||||
gdk_source_set_static_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
|
||||
g_source_set_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2634,23 +2632,6 @@ touch_handle_cancel (void *data,
|
||||
GDK_SEAT_NOTE (seat, EVENTS, g_message ("touch cancel"));
|
||||
}
|
||||
|
||||
static void
|
||||
touch_handle_shape (void *data,
|
||||
struct wl_touch *touch,
|
||||
int32_t id,
|
||||
wl_fixed_t major,
|
||||
wl_fixed_t minor)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
touch_handle_orientation (void *data,
|
||||
struct wl_touch *touch,
|
||||
int32_t id,
|
||||
wl_fixed_t orientation)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
emit_gesture_swipe_event (GdkWaylandSeat *seat,
|
||||
GdkTouchpadGesturePhase phase,
|
||||
@@ -3038,9 +3019,7 @@ static const struct wl_touch_listener touch_listener = {
|
||||
touch_handle_up,
|
||||
touch_handle_motion,
|
||||
touch_handle_frame,
|
||||
touch_handle_cancel,
|
||||
touch_handle_shape,
|
||||
touch_handle_orientation,
|
||||
touch_handle_cancel
|
||||
};
|
||||
|
||||
static const struct zwp_pointer_gesture_swipe_v1_listener gesture_swipe_listener = {
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
#define MIN_SYSTEM_BELL_DELAY_MS 20
|
||||
|
||||
#define GTK_SHELL1_VERSION 5
|
||||
#define GTK_SHELL1_VERSION 4
|
||||
#define OUTPUT_VERSION_WITH_DONE 2
|
||||
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
||||
#define XDG_ACTIVATION_VERSION 1
|
||||
@@ -240,7 +240,7 @@ _gdk_wayland_display_add_seat (GdkWaylandDisplay *display_wayland,
|
||||
{
|
||||
struct wl_seat *seat;
|
||||
|
||||
display_wayland->seat_version = MIN (version, 7);
|
||||
display_wayland->seat_version = MIN (version, 5);
|
||||
seat = wl_registry_bind (display_wayland->wl_registry,
|
||||
id, &wl_seat_interface,
|
||||
display_wayland->seat_version);
|
||||
|
||||
@@ -290,10 +290,8 @@ data_source_dnd_finished (void *data,
|
||||
{
|
||||
GdkDrag *drag = data;
|
||||
|
||||
g_object_ref (drag);
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
gdk_drag_drop_done (drag, TRUE);
|
||||
g_object_unref (drag);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -542,7 +542,7 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
|
||||
|
||||
context = xkb_context_new (0);
|
||||
|
||||
map_str = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
map_str = mmap (NULL, size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (map_str == MAP_FAILED)
|
||||
{
|
||||
close(fd);
|
||||
|
||||
@@ -4190,65 +4190,6 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
translate_gesture (GdkTitlebarGesture gesture,
|
||||
enum gtk_surface1_gesture *out_gesture)
|
||||
{
|
||||
switch (gesture)
|
||||
{
|
||||
case GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
|
||||
*out_gesture = GTK_SURFACE1_GESTURE_DOUBLE_CLICK;
|
||||
break;
|
||||
|
||||
case GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
|
||||
*out_gesture = GTK_SURFACE1_GESTURE_RIGHT_CLICK;
|
||||
break;
|
||||
|
||||
case GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
|
||||
*out_gesture = GTK_SURFACE1_GESTURE_MIDDLE_CLICK;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("Not handling unknown titlebar gesture %u", gesture);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_surface_titlebar_gesture (GdkSurface *surface,
|
||||
GdkTitlebarGesture gesture)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
struct gtk_surface1 *gtk_surface = impl->display_server.gtk_surface;
|
||||
enum gtk_surface1_gesture gtk_gesture;
|
||||
GdkSeat *seat;
|
||||
struct wl_seat *wl_seat;
|
||||
uint32_t serial;
|
||||
|
||||
if (!gtk_surface)
|
||||
return FALSE;
|
||||
|
||||
if (gtk_surface1_get_version (gtk_surface) < GTK_SURFACE1_TITLEBAR_GESTURE_SINCE_VERSION)
|
||||
return FALSE;
|
||||
|
||||
if (!translate_gesture (gesture, >k_gesture))
|
||||
return FALSE;
|
||||
|
||||
seat = gdk_display_get_default_seat (surface->display);
|
||||
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
|
||||
|
||||
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (seat), NULL);
|
||||
|
||||
gtk_surface1_titlebar_gesture (impl->display_server.gtk_surface,
|
||||
serial,
|
||||
wl_seat,
|
||||
gtk_gesture);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_surface_supports_edge_constraints (GdkSurface *surface)
|
||||
{
|
||||
@@ -5046,13 +4987,6 @@ gdk_wayland_toplevel_show_window_menu (GdkToplevel *toplevel,
|
||||
return gdk_wayland_surface_show_window_menu (GDK_SURFACE (toplevel), event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
GdkTitlebarGesture gesture)
|
||||
{
|
||||
return gdk_wayland_surface_titlebar_gesture (GDK_SURFACE (toplevel), gesture);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_toplevel_supports_edge_constraints (GdkToplevel *toplevel)
|
||||
{
|
||||
@@ -5131,7 +5065,6 @@ gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->lower = gdk_wayland_toplevel_lower;
|
||||
iface->focus = gdk_wayland_toplevel_focus;
|
||||
iface->show_window_menu = gdk_wayland_toplevel_show_window_menu;
|
||||
iface->titlebar_gesture = gdk_wayland_toplevel_titlebar_gesture;
|
||||
iface->supports_edge_constraints = gdk_wayland_toplevel_supports_edge_constraints;
|
||||
iface->inhibit_system_shortcuts = gdk_wayland_toplevel_inhibit_system_shortcuts;
|
||||
iface->restore_system_shortcuts = gdk_wayland_toplevel_restore_system_shortcuts;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<protocol name="gtk">
|
||||
|
||||
<interface name="gtk_shell1" version="5">
|
||||
<interface name="gtk_shell1" version="4">
|
||||
<description summary="gtk specific extensions">
|
||||
gtk_shell is a protocol extension providing additional features for
|
||||
clients implementing it.
|
||||
@@ -35,7 +35,7 @@
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="gtk_surface1" version="5">
|
||||
<interface name="gtk_surface1" version="4">
|
||||
<request name="set_dbus_properties">
|
||||
<arg name="application_id" type="string" allow-null="true"/>
|
||||
<arg name="app_menu_path" type="string" allow-null="true"/>
|
||||
@@ -85,23 +85,6 @@
|
||||
|
||||
<!-- Version 4 additions -->
|
||||
<request name="release" type="destructor" since="4"/>
|
||||
|
||||
<!-- Version 5 additions -->
|
||||
<enum name="gesture" since="5">
|
||||
<entry name="double_click" value="1"/>
|
||||
<entry name="right_click" value="2"/>
|
||||
<entry name="middle_click" value="3"/>
|
||||
</enum>
|
||||
|
||||
<enum name="error" since="5">
|
||||
<entry name="invalid_gesture" value="0"/>
|
||||
</enum>
|
||||
|
||||
<request name="titlebar_gesture" since="5">
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="seat" type="object" interface="wl_seat"/>
|
||||
<arg name="gesture" type="uint" enum="gesture"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
</protocol>
|
||||
|
||||
@@ -535,6 +535,7 @@ _gdk_win32_display_open (const char *display_name)
|
||||
|
||||
_gdk_win32_lang_notification_init ();
|
||||
_gdk_drag_init ();
|
||||
_gdk_drop_init ();
|
||||
|
||||
_gdk_display->clipboard = gdk_win32_clipboard_new (_gdk_display);
|
||||
_gdk_display->primary_clipboard = gdk_clipboard_new (_gdk_display);
|
||||
|
||||
+354
-59
@@ -27,8 +27,6 @@
|
||||
#include "config.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
@@ -158,6 +156,9 @@
|
||||
* drag window) in response to this, as all the functions
|
||||
* that GDK could perform here are already handled by the
|
||||
* OS driving the DnD process via DoDragDrop() call.
|
||||
* The LOCAL protocol, on the other hand, does a lot,
|
||||
* similar to what X11 backend does with XDND - it sends
|
||||
* GDK_DRAG_LEAVE and GDK_DRAG_ENTER, emits GDK_DRAG_MOTION.
|
||||
*
|
||||
* GDK_BUTTON_RELEASE checks the
|
||||
* released button - if it's the button that was used to
|
||||
@@ -178,7 +179,11 @@
|
||||
* the OS notifies the process about these things happening.
|
||||
* For X11 backend that is done in Xdnd event filters,
|
||||
* for W32 backend this is done in IDropSource/IDropTarget
|
||||
* object methods for the OLE2 protocol.
|
||||
* object methods for the OLE2 protocol, whereas for the
|
||||
* LOCAL protocol these events are emitted only by GDK itself
|
||||
* (with the exception of WM_DROPFILES message, which causes
|
||||
* GDK to create a drop context and then immediately finish
|
||||
* the drag, providing the list of files it got from the message).
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -480,6 +485,17 @@ process_dnd_queue (gboolean timed,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drag_drop_response (GdkDrag *drag,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_drop_response: 0x%p\n",
|
||||
drag));
|
||||
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
gdk_drag_drop_done (drag, action != 0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
do_drag_drop_response (gpointer user_data)
|
||||
{
|
||||
@@ -696,6 +712,16 @@ _gdk_win32_dnd_thread_main (gpointer data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* For the LOCAL protocol */
|
||||
typedef enum {
|
||||
GDK_DRAG_STATUS_DRAG,
|
||||
GDK_DRAG_STATUS_MOTION_WAIT,
|
||||
GDK_DRAG_STATUS_ACTION_WAIT,
|
||||
GDK_DRAG_STATUS_DROP
|
||||
} GdkDragStatus;
|
||||
|
||||
static gboolean use_ole2_dnd = TRUE;
|
||||
|
||||
static gboolean drag_context_grab (GdkDrag *drag);
|
||||
|
||||
G_DEFINE_TYPE (GdkWin32Drag, gdk_win32_drag, GDK_TYPE_DRAG)
|
||||
@@ -763,7 +789,8 @@ gdk_drag_new (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
GdkDevice *device)
|
||||
GdkDevice *device,
|
||||
GdkDragProtocol protocol)
|
||||
{
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
|
||||
@@ -783,6 +810,8 @@ gdk_drag_new (GdkDisplay *display,
|
||||
else
|
||||
drag_win32->scale = gdk_win32_display_get_monitor_scale_factor (display_win32, NULL, NULL);
|
||||
|
||||
drag_win32->protocol = protocol;
|
||||
|
||||
return drag;
|
||||
}
|
||||
|
||||
@@ -1050,6 +1079,21 @@ maybe_emit_action_changed (GdkWin32Drag *drag_win32,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drag_give_feedback (GdkDrag *drag,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
if (drag_win32->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
|
||||
drag_win32->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_give_feedback: 0x%p\n",
|
||||
drag));
|
||||
|
||||
maybe_emit_action_changed (drag_win32, actions);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
give_feedback (gpointer user_data)
|
||||
{
|
||||
@@ -1624,20 +1668,30 @@ enum_formats_new (GArray *formats)
|
||||
void
|
||||
_gdk_drag_init (void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
CoInitializeEx (NULL, COINIT_APARTMENTTHREADED);
|
||||
|
||||
hr = OleInitialize (NULL);
|
||||
if (g_strcmp0 (getenv ("GDK_WIN32_OLE2_DND"), "0") == 0)
|
||||
use_ole2_dnd = FALSE;
|
||||
|
||||
if (! SUCCEEDED (hr))
|
||||
g_error ("OleInitialize failed");
|
||||
if (use_ole2_dnd)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = OleInitialize (NULL);
|
||||
|
||||
if (! SUCCEEDED (hr))
|
||||
g_error ("OleInitialize failed");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_dnd_exit (void)
|
||||
{
|
||||
OleUninitialize ();
|
||||
if (use_ole2_dnd)
|
||||
{
|
||||
OleUninitialize ();
|
||||
}
|
||||
|
||||
CoUninitialize ();
|
||||
}
|
||||
|
||||
@@ -1667,9 +1721,6 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
double px, py;
|
||||
int x_root, y_root;
|
||||
GdkWin32DnDThreadDoDragDrop *ddd;
|
||||
source_drag_context *source_ctx;
|
||||
data_object *data_obj;
|
||||
|
||||
g_return_val_if_fail (surface != NULL, NULL);
|
||||
|
||||
@@ -1677,7 +1728,8 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
surface,
|
||||
content,
|
||||
actions,
|
||||
device);
|
||||
device,
|
||||
use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL);
|
||||
drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
|
||||
@@ -1701,35 +1753,121 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ddd = g_new0 (GdkWin32DnDThreadDoDragDrop, 1);
|
||||
if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
|
||||
{
|
||||
GdkWin32DnDThreadDoDragDrop *ddd = g_new0 (GdkWin32DnDThreadDoDragDrop, 1);
|
||||
source_drag_context *source_ctx;
|
||||
data_object *data_obj;
|
||||
|
||||
source_ctx = source_context_new (drag, gdk_drag_get_formats (drag));
|
||||
data_obj = data_object_new (drag);
|
||||
source_ctx = source_context_new (drag, gdk_drag_get_formats (drag));
|
||||
data_obj = data_object_new (drag);
|
||||
|
||||
ddd->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_DO_DRAG_DROP;
|
||||
ddd->base.opaque_context = drag_win32;
|
||||
ddd->src_context = source_ctx;
|
||||
ddd->src_object = data_obj;
|
||||
ddd->allowed_drop_effects = 0;
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
ddd->allowed_drop_effects |= DROPEFFECT_COPY;
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
ddd->allowed_drop_effects |= DROPEFFECT_MOVE;
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
ddd->allowed_drop_effects |= DROPEFFECT_LINK;
|
||||
ddd->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_DO_DRAG_DROP;
|
||||
ddd->base.opaque_context = drag_win32;
|
||||
ddd->src_context = source_ctx;
|
||||
ddd->src_object = data_obj;
|
||||
ddd->allowed_drop_effects = 0;
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
ddd->allowed_drop_effects |= DROPEFFECT_COPY;
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
ddd->allowed_drop_effects |= DROPEFFECT_MOVE;
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
ddd->allowed_drop_effects |= DROPEFFECT_LINK;
|
||||
|
||||
g_hash_table_replace (clipdrop->active_source_drags, g_object_ref (drag), ddd);
|
||||
increment_dnd_queue_counter ();
|
||||
g_async_queue_push (clipdrop->dnd_queue, ddd);
|
||||
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id, thread_wakeup_message, 0, 0));
|
||||
g_hash_table_replace (clipdrop->active_source_drags, g_object_ref (drag), ddd);
|
||||
increment_dnd_queue_counter ();
|
||||
g_async_queue_push (clipdrop->dnd_queue, ddd);
|
||||
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id, thread_wakeup_message, 0, 0));
|
||||
|
||||
drag_win32->util_data.state = GDK_WIN32_DND_PENDING;
|
||||
drag_win32->util_data.state = GDK_WIN32_DND_PENDING;
|
||||
}
|
||||
|
||||
move_drag_surface (drag, x_root, y_root);
|
||||
|
||||
return drag;
|
||||
}
|
||||
|
||||
/* TODO: remove this?
|
||||
* window finder is only used by our gdk_drag_update() to
|
||||
* find the window at drag coordinates - which is
|
||||
* something IDropSourceNotify already gives us.
|
||||
* Unless, of course, we keep the LOCAL protocol around.
|
||||
*/
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
HWND ignore;
|
||||
HWND result;
|
||||
} find_window_enum_arg;
|
||||
|
||||
static BOOL CALLBACK
|
||||
find_window_enum_proc (HWND hwnd,
|
||||
LPARAM lparam)
|
||||
{
|
||||
RECT rect;
|
||||
POINT tl, br;
|
||||
find_window_enum_arg *a = (find_window_enum_arg *) lparam;
|
||||
|
||||
if (hwnd == a->ignore)
|
||||
return TRUE;
|
||||
|
||||
if (!IsWindowVisible (hwnd))
|
||||
return TRUE;
|
||||
|
||||
tl.x = tl.y = 0;
|
||||
ClientToScreen (hwnd, &tl);
|
||||
GetClientRect (hwnd, &rect);
|
||||
br.x = rect.right;
|
||||
br.y = rect.bottom;
|
||||
ClientToScreen (hwnd, &br);
|
||||
|
||||
if (a->x >= tl.x && a->y >= tl.y && a->x < br.x && a->y < br.y)
|
||||
{
|
||||
a->result = hwnd;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Finds the HWND under cursor. Local DnD protocol
|
||||
* uses this function, since local protocol is implemented
|
||||
* entirely in GDK and cannot rely on the OS to notify
|
||||
* drop targets about drags that move over them.
|
||||
*/
|
||||
static HWND
|
||||
gdk_win32_drag_find_window (GdkDrag *drag,
|
||||
GdkSurface *drag_surface,
|
||||
int x_root,
|
||||
int y_root)
|
||||
{
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
find_window_enum_arg a;
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
|
||||
a.x = x_root * drag_win32->scale - _gdk_offset_x;
|
||||
a.y = y_root * drag_win32->scale - _gdk_offset_y;
|
||||
a.ignore = drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL;
|
||||
a.result = INVALID_HANDLE_VALUE;
|
||||
|
||||
GDK_NOTE (DND,
|
||||
g_print ("gdk_win32_drag_find_window: %p %+d%+d\n",
|
||||
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
|
||||
a.x, a.y));
|
||||
|
||||
EnumWindows (find_window_enum_proc, (LPARAM) &a);
|
||||
|
||||
GDK_NOTE (DND,
|
||||
g_print ("gdk_win32_drag_find_window: %p %+d%+d: %p\n",
|
||||
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
|
||||
x_root, y_root,
|
||||
a.result));
|
||||
|
||||
return a.result;
|
||||
}
|
||||
|
||||
static DWORD
|
||||
manufacture_keystate_from_GMT (GdkModifierType state)
|
||||
{
|
||||
@@ -1751,6 +1889,100 @@ manufacture_keystate_from_GMT (GdkModifierType state)
|
||||
return key_state;
|
||||
}
|
||||
|
||||
/* This only works if dest_window our window and the DnD operation
|
||||
* is currently local to the application.
|
||||
*/
|
||||
static GdkDrop *
|
||||
_gdk_win32_get_drop_for_dest_window (HWND dest_window)
|
||||
{
|
||||
GdkSurface *drop_surface = gdk_win32_handle_table_lookup (dest_window);
|
||||
GdkDrop *result = NULL;
|
||||
|
||||
if (drop_surface)
|
||||
result = _gdk_win32_get_drop_for_dest_surface (drop_surface);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_local_drag_motion (GdkDrag *drag,
|
||||
HWND dest_window,
|
||||
int x_root,
|
||||
int y_root,
|
||||
GdkDragAction possible_actions,
|
||||
DWORD key_state,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkDrop *drop;
|
||||
GdkDragAction actions;
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
|
||||
g_return_val_if_fail (drag != NULL, FALSE);
|
||||
|
||||
drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
|
||||
|
||||
actions = gdk_drag_get_actions (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_local_drag_motion: @ %+d:%+d possible=%s\n"
|
||||
" dest=%p (current %p) drop=%p drag=%p:{actions=%s,action=%s}\n",
|
||||
x_root, y_root,
|
||||
_gdk_win32_drag_action_to_string (possible_actions),
|
||||
dest_window, drag_win32->dest_window, drop, drag,
|
||||
_gdk_win32_drag_action_to_string (actions),
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_get_selected_action (drag))));
|
||||
|
||||
if (drag_win32->dest_window != dest_window)
|
||||
{
|
||||
/* Send a leave to the last destination */
|
||||
if (drop)
|
||||
_gdk_win32_local_drop_target_dragleave (drop, time_);
|
||||
|
||||
drag_win32->dest_window = dest_window;
|
||||
drag_win32->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
|
||||
_gdk_win32_local_drop_target_dragenter (drag,
|
||||
gdk_win32_handle_table_lookup (dest_window),
|
||||
x_root,
|
||||
y_root,
|
||||
key_state,
|
||||
time_,
|
||||
&actions);
|
||||
|
||||
drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
|
||||
maybe_emit_action_changed (drag_win32, actions);
|
||||
}
|
||||
|
||||
/* Send a drag-motion event */
|
||||
|
||||
drag_win32->util_data.last_x = x_root;
|
||||
drag_win32->util_data.last_y = y_root;
|
||||
|
||||
if (drop != NULL &&
|
||||
drag_win32->drag_status == GDK_DRAG_STATUS_DRAG &&
|
||||
_gdk_win32_local_drop_target_will_emit_motion (drop, x_root, y_root, key_state))
|
||||
{
|
||||
actions = gdk_drag_get_actions (drag);
|
||||
drag_win32->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
|
||||
|
||||
_gdk_win32_local_drop_target_dragover (drop, drag, x_root, y_root, key_state, time_, &actions);
|
||||
|
||||
maybe_emit_action_changed (drag_win32, actions);
|
||||
}
|
||||
|
||||
GDK_NOTE (DND, g_print (" returning %s\n"
|
||||
" drag=%p:{actions=%s,action=%s}\n",
|
||||
(drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG) ? "TRUE" : "FALSE",
|
||||
drag,
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_get_actions (drag)),
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_get_selected_action (drag))));
|
||||
return (drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG);
|
||||
}
|
||||
|
||||
static void
|
||||
send_source_state_update (GdkWin32Clipdrop *clipdrop,
|
||||
GdkWin32Drag *drag_win32,
|
||||
@@ -1771,7 +2003,6 @@ gdk_win32_drag_drop (GdkDrag *drag,
|
||||
{
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
gpointer ddd;
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
@@ -1780,12 +2011,29 @@ gdk_win32_drag_drop (GdkDrag *drag,
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_drop\n"));
|
||||
|
||||
ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
|
||||
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
|
||||
{
|
||||
GdkDrop *drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
|
||||
|
||||
drag_win32->util_data.state = GDK_WIN32_DND_DROPPED;
|
||||
if (drop)
|
||||
{
|
||||
GdkDragAction actions;
|
||||
|
||||
if (ddd)
|
||||
send_source_state_update (clipdrop, drag_win32, ddd);
|
||||
actions = gdk_drag_get_actions (drag);
|
||||
_gdk_win32_local_drop_target_drop (drop, drag, time_, &actions);
|
||||
maybe_emit_action_changed (drag_win32, actions);
|
||||
_gdk_win32_local_drag_drop_response (drag, actions);
|
||||
}
|
||||
}
|
||||
else if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
|
||||
{
|
||||
gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
|
||||
|
||||
drag_win32->util_data.state = GDK_WIN32_DND_DROPPED;
|
||||
|
||||
if (ddd)
|
||||
send_source_state_update (clipdrop, drag_win32, ddd);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1875,8 +2123,6 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
|
||||
{
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkDragAnim *anim;
|
||||
GdkWin32Clipdrop *clipdrop;
|
||||
gpointer ddd;
|
||||
/*
|
||||
cairo_surface_t *win_surface;
|
||||
cairo_surface_t *surface;
|
||||
@@ -1891,16 +2137,23 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
|
||||
/* FIXME: This is temporary, until the code is fixed to ensure that
|
||||
* gdk_drag_finish () is called by GTK.
|
||||
*/
|
||||
clipdrop = _gdk_win32_clipdrop_get ();
|
||||
ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
|
||||
if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
|
||||
{
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
|
||||
|
||||
if (success)
|
||||
drag_win32->util_data.state = GDK_WIN32_DND_DROPPED;
|
||||
else
|
||||
drag_win32->util_data.state = GDK_WIN32_DND_NONE;
|
||||
if (success)
|
||||
drag_win32->util_data.state = GDK_WIN32_DND_DROPPED;
|
||||
else
|
||||
drag_win32->util_data.state = GDK_WIN32_DND_NONE;
|
||||
|
||||
if (ddd)
|
||||
send_source_state_update (clipdrop, drag_win32, ddd);
|
||||
if (ddd)
|
||||
send_source_state_update (clipdrop, drag_win32, ddd);
|
||||
}
|
||||
else if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
drag_win32->handle_events = FALSE;
|
||||
|
||||
@@ -1943,7 +2196,7 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
|
||||
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
|
||||
gdk_drag_anim_timeout, anim,
|
||||
(GDestroyNotify) gdk_drag_anim_destroy);
|
||||
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
|
||||
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2026,6 +2279,14 @@ gdk_win32_drag_cancel (GdkDrag *drag,
|
||||
drag,
|
||||
reason_str));
|
||||
|
||||
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
|
||||
{
|
||||
GdkDrop *drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
|
||||
if (drop)
|
||||
_gdk_win32_local_drop_target_dragleave (drop, GDK_CURRENT_TIME);
|
||||
drop = NULL;
|
||||
}
|
||||
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
drag_context_ungrab (drag);
|
||||
gdk_drag_drop_done (drag, FALSE);
|
||||
@@ -2047,6 +2308,28 @@ gdk_win32_drag_drop_performed (GdkDrag *drag,
|
||||
#define BIG_STEP 20
|
||||
#define SMALL_STEP 1
|
||||
|
||||
static void
|
||||
gdk_local_drag_update (GdkDrag *drag,
|
||||
double x_root,
|
||||
double y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 evtime)
|
||||
{
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
HWND dest_window;
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
|
||||
dest_window = gdk_win32_drag_find_window (drag,
|
||||
drag_win32->drag_surface,
|
||||
x_root, y_root);
|
||||
|
||||
gdk_win32_local_drag_motion (drag, dest_window, x_root, y_root,
|
||||
gdk_drag_get_actions (drag),
|
||||
grfKeyState, evtime);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_motion_event (GdkDrag *drag,
|
||||
GdkEvent *event)
|
||||
@@ -2056,7 +2339,6 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
|
||||
DWORD key_state;
|
||||
double x, y;
|
||||
double x_root, y_root;
|
||||
GdkWin32Clipdrop *clipdrop;
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_dnd_handle_motion_event: 0x%p\n", drag));
|
||||
|
||||
@@ -2071,18 +2353,26 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
|
||||
|
||||
key_state = manufacture_keystate_from_GMT (state);
|
||||
|
||||
clipdrop = _gdk_win32_clipdrop_get ();
|
||||
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
|
||||
{
|
||||
gdk_local_drag_update (drag, x_root, y_root, key_state,
|
||||
gdk_event_get_time (event));
|
||||
}
|
||||
else if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
|
||||
{
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
|
||||
GDK_NOTE (DND, g_print ("Post WM_MOUSEMOVE keystate=%lu\n", key_state));
|
||||
GDK_NOTE (DND, g_print ("Post WM_MOUSEMOVE keystate=%lu\n", key_state));
|
||||
|
||||
drag_win32->util_data.last_x = x_root;
|
||||
drag_win32->util_data.last_y = y_root;
|
||||
drag_win32->util_data.last_x = x_root;
|
||||
drag_win32->util_data.last_y = y_root;
|
||||
|
||||
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id,
|
||||
WM_MOUSEMOVE,
|
||||
key_state,
|
||||
MAKELPARAM (x * drag_win32->scale,
|
||||
y * drag_win32->scale)));
|
||||
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id,
|
||||
WM_MOUSEMOVE,
|
||||
key_state,
|
||||
MAKELPARAM (x * drag_win32->scale,
|
||||
y * drag_win32->scale)));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2164,6 +2454,11 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
|
||||
if (drag_win32->drag_surface)
|
||||
move_drag_surface (drag, drag_win32->util_data.last_x, drag_win32->util_data.last_y);
|
||||
|
||||
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
|
||||
gdk_local_drag_update (drag, drag_win32->util_data.last_x, drag_win32->util_data.last_y,
|
||||
manufacture_keystate_from_GMT (state),
|
||||
gdk_event_get_time (event));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
+211
-21
@@ -140,6 +140,9 @@ struct _drop_target_context
|
||||
IDataObject *data_object;
|
||||
};
|
||||
|
||||
/* TRUE to use OLE2 protocol, FALSE to use local protocol */
|
||||
static gboolean use_ole2_dnd = TRUE;
|
||||
|
||||
static void
|
||||
gdk_win32_drop_init (GdkWin32Drop *drop)
|
||||
{
|
||||
@@ -193,6 +196,28 @@ gdk_drop_new (GdkDisplay *display,
|
||||
return GDK_DROP (drop_win32);
|
||||
}
|
||||
|
||||
/* Gets the GdkDrop that corresponds to a particular GdkSurface.
|
||||
* Will be NULL for surfaces that are not registered as drop targets,
|
||||
* or for surfaces that are currently not under the drag cursor.
|
||||
* This function is only used for local DnD, where we do have
|
||||
* a real GdkSurface that corresponds to the HWND under cursor.
|
||||
*/
|
||||
GdkDrop *
|
||||
_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest)
|
||||
{
|
||||
GdkWin32Surface *impl;
|
||||
|
||||
if (dest == NULL)
|
||||
return NULL;
|
||||
|
||||
impl = GDK_WIN32_SURFACE (dest);
|
||||
|
||||
if (impl->drop_target != NULL)
|
||||
return impl->drop_target->drop;
|
||||
|
||||
return impl->drop;
|
||||
}
|
||||
|
||||
|
||||
#define PRINT_GUID(guid) \
|
||||
g_print ("%.08lx-%.04x-%.04x-%.02x%.02x-%.02x%.02x%.02x%.02x%.02x%.02x", \
|
||||
@@ -426,6 +451,51 @@ set_source_actions_helper (GdkDrop *drop,
|
||||
return actions;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
|
||||
GdkSurface *dest_surface,
|
||||
int x_root,
|
||||
int y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions)
|
||||
{
|
||||
GdkDrop *drop;
|
||||
GdkWin32Drop *drop_win32;
|
||||
GdkDisplay *display;
|
||||
GdkDragAction source_actions;
|
||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (dest_surface);
|
||||
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragenter %p @ %d : %d"
|
||||
" for dest window 0x%p"
|
||||
". actions = %s\n",
|
||||
drag, x_root, y_root,
|
||||
dest_surface,
|
||||
_gdk_win32_drag_action_to_string (*actions)));
|
||||
|
||||
display = gdk_surface_get_display (dest_surface);
|
||||
drop = gdk_drop_new (display,
|
||||
gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
|
||||
drag,
|
||||
gdk_drag_get_formats (drag),
|
||||
dest_surface,
|
||||
GDK_DRAG_PROTO_LOCAL);
|
||||
drop_win32 = GDK_WIN32_DROP (drop);
|
||||
|
||||
impl->drop = drop;
|
||||
|
||||
source_actions = set_source_actions_helper (drop, *actions, grfKeyState);
|
||||
|
||||
gdk_drop_emit_enter_event (drop, TRUE, x_root, y_root, time_);
|
||||
drop_win32->last_key_state = grfKeyState;
|
||||
drop_win32->last_x = x_root;
|
||||
drop_win32->last_y = y_root;
|
||||
*actions = filter_actions (drop_win32->actions, source_actions);
|
||||
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragenter returns with actions %s\n",
|
||||
_gdk_win32_drag_action_to_string (*actions)));
|
||||
}
|
||||
|
||||
/* The pdwEffect here initially points
|
||||
* to a DWORD that contains the value of dwOKEffects argument in DoDragDrop,
|
||||
* i.e. the drag action that the drag source deems acceptable.
|
||||
@@ -505,6 +575,55 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
|
||||
int x_root,
|
||||
int y_root,
|
||||
DWORD grfKeyState)
|
||||
{
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
|
||||
|
||||
if (x_root != drop_win32->last_x ||
|
||||
y_root != drop_win32->last_y ||
|
||||
grfKeyState != drop_win32->last_key_state)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_dragover (GdkDrop *drop,
|
||||
GdkDrag *drag,
|
||||
int x_root,
|
||||
int y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions)
|
||||
{
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
|
||||
GdkDragAction source_actions;
|
||||
|
||||
source_actions = set_source_actions_helper (drop, *actions, grfKeyState);
|
||||
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragover %p @ %d : %d"
|
||||
", actions = %s\n",
|
||||
drop, x_root, y_root,
|
||||
_gdk_win32_drag_action_to_string (*actions)));
|
||||
|
||||
if (_gdk_win32_local_drop_target_will_emit_motion (drop, x_root, y_root, grfKeyState))
|
||||
{
|
||||
gdk_drop_emit_motion_event (drop, TRUE, x_root, y_root, time_);
|
||||
drop_win32->last_key_state = grfKeyState;
|
||||
drop_win32->last_x = x_root;
|
||||
drop_win32->last_y = y_root;
|
||||
}
|
||||
|
||||
*actions = filter_actions (drop_win32->actions, source_actions);
|
||||
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragover returns with actions %s\n",
|
||||
_gdk_win32_drag_action_to_string (*actions)));
|
||||
}
|
||||
|
||||
/* NOTE: This method is called continuously, even if nothing is
|
||||
* happening, as long as the drag operation is in progress and
|
||||
* the cursor is above our window.
|
||||
@@ -562,6 +681,18 @@ idroptarget_dragover (LPDROPTARGET This,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (gdk_drop_get_surface (drop));
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragleave %p\n", drop));
|
||||
|
||||
gdk_drop_emit_leave_event (drop, TRUE, time_);
|
||||
|
||||
g_clear_object (&impl->drop);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
idroptarget_dragleave (LPDROPTARGET This)
|
||||
{
|
||||
@@ -577,6 +708,35 @@ idroptarget_dragleave (LPDROPTARGET This)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_drop (GdkDrop *drop,
|
||||
GdkDrag *drag,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions)
|
||||
{
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
|
||||
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_drop %p ", drop));
|
||||
|
||||
set_source_actions_helper (drop,
|
||||
*actions,
|
||||
drop_win32->last_key_state);
|
||||
|
||||
drop_win32->drop_finished = FALSE;
|
||||
gdk_drop_emit_drop_event (drop, TRUE, drop_win32->last_x, drop_win32->last_y, time_);
|
||||
|
||||
while (!drop_win32->drop_finished)
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
|
||||
/* Notify local source of the DnD result
|
||||
* Special case:
|
||||
* drop_win32->actions is guaranteed to contain 1 action after gdk_drop_finish ()
|
||||
*/
|
||||
*actions = drop_win32->actions;
|
||||
|
||||
GDK_NOTE (DND, g_print ("drop with action %s\n", _gdk_win32_drag_action_to_string (*actions)));
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
idroptarget_drop (LPDROPTARGET This,
|
||||
LPDATAOBJECT pDataObj,
|
||||
@@ -918,6 +1078,14 @@ gdk_win32_drop_status (GdkDrop *drop,
|
||||
_gdk_win32_drag_action_to_string (preferred)));
|
||||
|
||||
drop_win32->actions = actions;
|
||||
|
||||
if (drop_win32->protocol == GDK_DRAG_PROTO_OLE2)
|
||||
return;
|
||||
|
||||
drag = gdk_drop_get_drag (drop);
|
||||
|
||||
if (drag != NULL)
|
||||
_gdk_win32_local_drag_give_feedback (drag, actions);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -933,6 +1101,9 @@ gdk_win32_drop_finish (GdkDrop *drop,
|
||||
|
||||
drop_win32->actions = action;
|
||||
drop_win32->drop_finished = TRUE;
|
||||
|
||||
if (drop_win32->protocol == GDK_DRAG_PROTO_OLE2)
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -965,7 +1136,6 @@ _gdk_win32_surface_register_dnd (GdkSurface *window)
|
||||
{
|
||||
drop_target_context *ctx;
|
||||
HRESULT hr;
|
||||
GdkWin32Surface *impl;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
@@ -976,30 +1146,43 @@ _gdk_win32_surface_register_dnd (GdkSurface *window)
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_surface_register_dnd: %p\n", GDK_SURFACE_HWND (window)));
|
||||
|
||||
impl = GDK_WIN32_SURFACE (window);
|
||||
|
||||
/* Return if window is already setup for DND. */
|
||||
if (impl->drop_target != NULL)
|
||||
return;
|
||||
|
||||
ctx = target_context_new (window);
|
||||
|
||||
hr = CoLockObjectExternal ((IUnknown *) &ctx->idt, TRUE, FALSE);
|
||||
if (!SUCCEEDED (hr))
|
||||
OTHER_API_FAILED ("CoLockObjectExternal");
|
||||
if (!use_ole2_dnd)
|
||||
{
|
||||
/* We always claim to accept dropped files, but in fact we might not,
|
||||
* of course. This function is called in such a way that it cannot know
|
||||
* whether the window (widget) in question actually accepts files
|
||||
* (in gtk, data of type text/uri-list) or not.
|
||||
*/
|
||||
gdk_win32_display_add_filter (GDK_WIN32_DISPLAY (gdk_display_get_default ()), gdk_dropfiles_filter, NULL);
|
||||
DragAcceptFiles (GDK_SURFACE_HWND (window), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = RegisterDragDrop (GDK_SURFACE_HWND (window), &ctx->idt);
|
||||
if (hr == DRAGDROP_E_ALREADYREGISTERED)
|
||||
{
|
||||
g_print ("DRAGDROP_E_ALREADYREGISTERED\n");
|
||||
CoLockObjectExternal ((IUnknown *) &ctx->idt, FALSE, FALSE);
|
||||
}
|
||||
else if (!SUCCEEDED (hr))
|
||||
OTHER_API_FAILED ("RegisterDragDrop");
|
||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
||||
|
||||
/* Return if window is already setup for DND. */
|
||||
if (impl->drop_target != NULL)
|
||||
return;
|
||||
|
||||
ctx = target_context_new (window);
|
||||
|
||||
hr = CoLockObjectExternal ((IUnknown *) &ctx->idt, TRUE, FALSE);
|
||||
if (!SUCCEEDED (hr))
|
||||
OTHER_API_FAILED ("CoLockObjectExternal");
|
||||
else
|
||||
{
|
||||
impl->drop_target = ctx;
|
||||
hr = RegisterDragDrop (GDK_SURFACE_HWND (window), &ctx->idt);
|
||||
if (hr == DRAGDROP_E_ALREADYREGISTERED)
|
||||
{
|
||||
g_print ("DRAGDROP_E_ALREADYREGISTERED\n");
|
||||
CoLockObjectExternal ((IUnknown *) &ctx->idt, FALSE, FALSE);
|
||||
}
|
||||
else if (!SUCCEEDED (hr))
|
||||
OTHER_API_FAILED ("RegisterDragDrop");
|
||||
else
|
||||
{
|
||||
impl->drop_target = ctx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1235,3 +1418,10 @@ gdk_win32_drop_class_init (GdkWin32DropClass *klass)
|
||||
drop_class->read_async = gdk_win32_drop_read_async;
|
||||
drop_class->read_finish = gdk_win32_drop_read_finish;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_drop_init (void)
|
||||
{
|
||||
if (g_strcmp0 (getenv ("GDK_WIN32_OLE2_DND"), "0") == 0)
|
||||
use_ole2_dnd = FALSE;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
#include "gdkdisplay-win32.h"
|
||||
//#include "gdkselection-win32.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
@@ -503,7 +502,7 @@ _gdk_events_init (GdkDisplay *display)
|
||||
#endif
|
||||
|
||||
source = g_source_new (&event_funcs, sizeof (GdkWin32EventSource));
|
||||
g_source_set_static_name (source, "GDK Win32 event source");
|
||||
g_source_set_name (source, "GDK Win32 event source");
|
||||
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
|
||||
|
||||
event_source = (GdkWin32EventSource *)source;
|
||||
|
||||
@@ -277,7 +277,7 @@ gdk_win32_display_init_egl (GdkDisplay *display,
|
||||
display_win32->egl_disp = egl_disp;
|
||||
display_win32->egl_version = epoxy_egl_version (egl_disp);
|
||||
|
||||
eglBindAPI (EGL_OPENGL_ES_API);
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
display_win32->hasEglSurfacelessContext =
|
||||
epoxy_has_egl_extension (egl_disp, "EGL_KHR_surfaceless_context");
|
||||
|
||||
@@ -278,9 +278,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
if (best_idx == 0 ||
|
||||
!wglMakeCurrent (hdc, display_win32->dummy_context_wgl.hglrc))
|
||||
{
|
||||
if (display_win32->dummy_context_wgl.hglrc != NULL)
|
||||
wglDeleteContext (display_win32->dummy_context_wgl.hglrc);
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No GL implementation is available"));
|
||||
@@ -291,22 +288,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
display_win32->wgl_pixel_format = best_idx;
|
||||
display_win32->gl_version = epoxy_gl_version ();
|
||||
|
||||
/* We must have OpenGL/WGL 2.0 or later, or have the GL_ARB_shader_objects extension */
|
||||
if (display_win32->gl_version < 20)
|
||||
{
|
||||
if (!epoxy_has_gl_extension ("GL_ARB_shader_objects"))
|
||||
{
|
||||
wglMakeCurrent (NULL, NULL);
|
||||
wglDeleteContext (display_win32->dummy_context_wgl.hglrc);
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No GL implementation is available"));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
display_win32->hasWglARBCreateContext =
|
||||
epoxy_has_wgl_extension (hdc, "WGL_ARB_create_context");
|
||||
display_win32->hasWglEXTSwapControl =
|
||||
|
||||
@@ -253,6 +253,7 @@ _gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol)
|
||||
CASE (NONE);
|
||||
CASE (WIN32_DROPFILES);
|
||||
CASE (OLE2);
|
||||
CASE (LOCAL);
|
||||
#undef CASE
|
||||
default: return static_printf ("illegal_%d", protocol);
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ typedef enum
|
||||
GDK_DRAG_PROTO_NONE = 0,
|
||||
GDK_DRAG_PROTO_WIN32_DROPFILES,
|
||||
GDK_DRAG_PROTO_OLE2,
|
||||
GDK_DRAG_PROTO_LOCAL,
|
||||
} GdkDragProtocol;
|
||||
|
||||
GType _gdk_gc_win32_get_type (void);
|
||||
@@ -441,6 +442,7 @@ BOOL WINAPI GtkShowWindow (GdkSurface *window,
|
||||
/* Initialization */
|
||||
void _gdk_win32_surfaceing_init (void);
|
||||
void _gdk_drag_init (void);
|
||||
void _gdk_drop_init (void);
|
||||
void _gdk_events_init (GdkDisplay *display);
|
||||
|
||||
#endif /* __GDK_PRIVATE_WIN32_H__ */
|
||||
|
||||
@@ -204,6 +204,7 @@ gdk_surface_win32_finalize (GObject *object)
|
||||
}
|
||||
|
||||
_gdk_win32_surface_unregister_dnd (GDK_SURFACE (surface));
|
||||
g_clear_object (&surface->drop);
|
||||
|
||||
g_assert (surface->transient_owner == NULL);
|
||||
g_assert (surface->transient_children == NULL);
|
||||
|
||||
@@ -251,6 +251,10 @@ struct _GdkWin32Surface
|
||||
* For OLE2 protocol only.
|
||||
*/
|
||||
drop_target_context *drop_target;
|
||||
/* Temporarily holds the GdkDrop currently associated with this window.
|
||||
* For LOCAL protocol only.
|
||||
*/
|
||||
GdkDrop *drop;
|
||||
|
||||
GdkSurface *transient_owner;
|
||||
GSList *transient_children;
|
||||
|
||||
@@ -93,6 +93,38 @@ struct _GdkWin32DragClass
|
||||
gpointer _gdk_win32_dnd_thread_main (gpointer data);
|
||||
|
||||
GdkDrag *_gdk_win32_find_drag_for_dest_window (HWND dest_window);
|
||||
GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest);
|
||||
|
||||
gboolean _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
|
||||
int x_root,
|
||||
int y_root,
|
||||
DWORD grfKeyState);
|
||||
|
||||
void _gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
|
||||
GdkSurface *dest_surface,
|
||||
int x_root,
|
||||
int y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions);
|
||||
void _gdk_win32_local_drop_target_dragover (GdkDrop *drop,
|
||||
GdkDrag *drag,
|
||||
int x_root,
|
||||
int y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions);
|
||||
void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
|
||||
guint32 time_);
|
||||
void _gdk_win32_local_drop_target_drop (GdkDrop *drop,
|
||||
GdkDrag *drag,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions);
|
||||
|
||||
void _gdk_win32_local_drag_give_feedback (GdkDrag *drag,
|
||||
GdkDragAction actions);
|
||||
void _gdk_win32_local_drag_drop_response (GdkDrag *drag,
|
||||
GdkDragAction action);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "gdkintl.h"
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <glib.h>
|
||||
#ifdef HAVE_DESKTOPAPPINFO
|
||||
@@ -220,7 +219,7 @@ startup_timeout (void *data)
|
||||
std->timeout_id = 0;
|
||||
else {
|
||||
std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std);
|
||||
gdk_source_set_static_name_by_id (std->timeout_id, "[gtk] startup_timeout");
|
||||
g_source_set_name_by_id (std->timeout_id, "[gtk] startup_timeout");
|
||||
}
|
||||
|
||||
/* always remove this one, but we may have reinstalled another one. */
|
||||
@@ -257,7 +256,7 @@ add_startup_timeout (GdkX11Screen *screen,
|
||||
if (data->timeout_id == 0) {
|
||||
data->timeout_id = g_timeout_add_seconds (STARTUP_TIMEOUT_LENGTH_SECONDS,
|
||||
startup_timeout, data);
|
||||
gdk_source_set_static_name_by_id (data->timeout_id, "[gtk] startup_timeout");
|
||||
g_source_set_name_by_id (data->timeout_id, "[gtk] startup_timeout");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -46,7 +46,6 @@ in this Software without prior written authorization from The Open Group.
|
||||
#include "gdkasync.h"
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <X11/Xlibint.h>
|
||||
|
||||
@@ -172,7 +171,7 @@ send_event_handler (Display *dpy,
|
||||
{
|
||||
guint id;
|
||||
id = g_idle_add (callback_idle, state);
|
||||
gdk_source_set_static_name_by_id (id, "[gtk] callback_idle");
|
||||
g_source_set_name_by_id (id, "[gtk] callback_idle");
|
||||
}
|
||||
|
||||
DeqAsyncHandler(state->dpy, &state->async);
|
||||
@@ -708,7 +707,7 @@ roundtrip_handler (Display *dpy,
|
||||
{
|
||||
guint id;
|
||||
id = g_idle_add (roundtrip_callback_idle, state);
|
||||
gdk_source_set_static_name_by_id (id, "[gtk] roundtrip_callback_idle");
|
||||
g_source_set_name_by_id (id, "[gtk] roundtrip_callback_idle");
|
||||
}
|
||||
|
||||
DeqAsyncHandler(state->dpy, &state->async);
|
||||
|
||||
@@ -884,10 +884,8 @@ gdk_x11_drag_handle_finished (GdkDisplay *display,
|
||||
if (drag_x11->version == 5)
|
||||
drag_x11->drop_failed = xevent->xclient.data.l[1] == 0;
|
||||
|
||||
g_object_ref (drag);
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
gdk_drag_drop_done (drag, !drag_x11->drop_failed);
|
||||
g_object_unref (drag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1864,7 +1862,7 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
|
||||
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
|
||||
gdk_drag_anim_timeout, anim,
|
||||
(GDestroyNotify) gdk_drag_anim_destroy);
|
||||
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
|
||||
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
|
||||
g_object_unref (drag);
|
||||
}
|
||||
|
||||
|
||||
@@ -1282,10 +1282,7 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
|
||||
|
||||
class_hint = XAllocClassHint ();
|
||||
class_hint->res_name = (char *) g_get_prgname ();
|
||||
if (display_x11->program_class)
|
||||
class_hint->res_class = (char *) display_x11->program_class;
|
||||
else
|
||||
class_hint->res_class = class_hint->res_name;
|
||||
class_hint->res_class = (char *) display_x11->program_class;
|
||||
XSetClassHint (xdisplay, impl->xid, class_hint);
|
||||
XFree (class_hint);
|
||||
|
||||
|
||||
+22
-75
@@ -30,7 +30,7 @@
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
#include "gdk/gdk-private.h"
|
||||
|
||||
#include <hb-ot.h>
|
||||
#include <cairo-ft.h>
|
||||
|
||||
static inline void
|
||||
gsk_cairo_rectangle (cairo_t *cr,
|
||||
@@ -2146,7 +2146,7 @@ gsk_outset_shadow_get_extents (GskOutsetShadowNode *self,
|
||||
{
|
||||
float clip_radius;
|
||||
|
||||
clip_radius = gsk_cairo_blur_compute_pixels (self->blur_radius / 2.0);
|
||||
clip_radius = gsk_cairo_blur_compute_pixels (self->blur_radius);
|
||||
*top = MAX (0, clip_radius + self->spread - self->dy);
|
||||
*right = MAX (0, ceil (clip_radius + self->spread + self->dx));
|
||||
*bottom = MAX (0, ceil (clip_radius + self->spread + self->dy));
|
||||
@@ -3852,7 +3852,7 @@ gsk_shadow_node_diff (GskRenderNode *node1,
|
||||
return;
|
||||
}
|
||||
|
||||
clip_radius = gsk_cairo_blur_compute_pixels (shadow1->radius / 2.0);
|
||||
clip_radius = gsk_cairo_blur_compute_pixels (shadow1->radius);
|
||||
top = MAX (top, ceil (clip_radius - shadow1->dy));
|
||||
right = MAX (right, ceil (clip_radius + shadow1->dx));
|
||||
bottom = MAX (bottom, ceil (clip_radius + shadow1->dy));
|
||||
@@ -3886,7 +3886,7 @@ gsk_shadow_node_get_bounds (GskShadowNode *self,
|
||||
|
||||
for (i = 0; i < self->n_shadows; i++)
|
||||
{
|
||||
float clip_radius = gsk_cairo_blur_compute_pixels (self->shadows[i].radius / 2.0);
|
||||
float clip_radius = gsk_cairo_blur_compute_pixels (self->shadows[i].radius);
|
||||
top = MAX (top, clip_radius - self->shadows[i].dy);
|
||||
right = MAX (right, clip_radius + self->shadows[i].dx);
|
||||
bottom = MAX (bottom, clip_radius + self->shadows[i].dy);
|
||||
@@ -4377,15 +4377,6 @@ gsk_text_node_draw (GskRenderNode *node,
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/* We steal one of the bits in PangoGlyphVisAttr */
|
||||
|
||||
G_STATIC_ASSERT (sizeof (PangoGlyphVisAttr) == 4);
|
||||
|
||||
#define COLOR_GLYPH_BIT 2
|
||||
#define GLYPH_IS_COLOR(g) (((*(guint32*)&(g)->attr) & COLOR_GLYPH_BIT) != 0)
|
||||
#define GLYPH_SET_COLOR(g) (*(guint32*)(&(g)->attr) |= COLOR_GLYPH_BIT)
|
||||
#define GLYPH_CLEAR_COLOR(g) (*(guint32*)(&(g)->attr) &= ~COLOR_GLYPH_BIT)
|
||||
|
||||
static void
|
||||
gsk_text_node_diff (GskRenderNode *node1,
|
||||
GskRenderNode *node2,
|
||||
@@ -4410,8 +4401,7 @@ gsk_text_node_diff (GskRenderNode *node1,
|
||||
info1->geometry.width == info2->geometry.width &&
|
||||
info1->geometry.x_offset == info2->geometry.x_offset &&
|
||||
info1->geometry.y_offset == info2->geometry.y_offset &&
|
||||
info1->attr.is_cluster_start == info2->attr.is_cluster_start &&
|
||||
GLYPH_IS_COLOR (info1) == GLYPH_IS_COLOR (info2))
|
||||
info1->attr.is_cluster_start == info2->attr.is_cluster_start)
|
||||
continue;
|
||||
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
@@ -4425,43 +4415,20 @@ gsk_text_node_diff (GskRenderNode *node1,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
font_has_color_glyphs (PangoFont *font)
|
||||
font_has_color_glyphs (const PangoFont *font)
|
||||
{
|
||||
hb_face_t *face = hb_font_get_face (pango_font_get_hb_font (font));
|
||||
cairo_scaled_font_t *scaled_font;
|
||||
gboolean has_color = FALSE;
|
||||
|
||||
return hb_ot_color_has_layers (face) ||
|
||||
hb_ot_color_has_png (face) ||
|
||||
hb_ot_color_has_svg (face);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glyph_has_color (PangoFont *font,
|
||||
guint glyph)
|
||||
{
|
||||
hb_font_t *hb_font = pango_font_get_hb_font (font);
|
||||
hb_face_t *face = hb_font_get_face (hb_font);
|
||||
hb_blob_t *blob;
|
||||
|
||||
if (hb_ot_color_glyph_get_layers (face, glyph, 0, NULL, NULL) > 0)
|
||||
return TRUE;
|
||||
|
||||
blob = hb_ot_color_glyph_reference_png (hb_font, glyph);
|
||||
if (blob)
|
||||
scaled_font = pango_cairo_font_get_scaled_font ((PangoCairoFont *)font);
|
||||
if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_FT)
|
||||
{
|
||||
guint length = hb_blob_get_length (blob);
|
||||
hb_blob_destroy (blob);
|
||||
return length > 0;
|
||||
FT_Face ft_face = cairo_ft_scaled_font_lock_face (scaled_font);
|
||||
has_color = (FT_HAS_COLOR (ft_face) != 0);
|
||||
cairo_ft_scaled_font_unlock_face (scaled_font);
|
||||
}
|
||||
|
||||
blob = hb_ot_color_glyph_reference_svg (face, glyph);
|
||||
if (blob)
|
||||
{
|
||||
guint length = hb_blob_get_length (blob);
|
||||
hb_blob_destroy (blob);
|
||||
return length > 0;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return has_color;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4487,9 +4454,6 @@ gsk_text_node_new (PangoFont *font,
|
||||
GskTextNode *self;
|
||||
GskRenderNode *node;
|
||||
PangoRectangle ink_rect;
|
||||
PangoGlyphInfo *glyph_infos;
|
||||
gboolean has_color_glyphs;
|
||||
int n;
|
||||
|
||||
pango_glyph_string_extents (glyphs, font, &ink_rect, NULL);
|
||||
pango_extents_to_pixels (&ink_rect, NULL);
|
||||
@@ -4502,36 +4466,19 @@ gsk_text_node_new (PangoFont *font,
|
||||
node = (GskRenderNode *) self;
|
||||
|
||||
self->font = g_object_ref (font);
|
||||
self->has_color_glyphs = font_has_color_glyphs (font);
|
||||
self->color = *color;
|
||||
self->offset = *offset;
|
||||
self->has_color_glyphs = FALSE;
|
||||
self->glyphs = g_malloc_n (glyphs->num_glyphs, sizeof (PangoGlyphInfo));
|
||||
|
||||
glyph_infos = g_malloc_n (glyphs->num_glyphs, sizeof (PangoGlyphInfo));
|
||||
has_color_glyphs = font_has_color_glyphs (font);
|
||||
|
||||
n = 0;
|
||||
/* skip empty glyphs */
|
||||
self->num_glyphs = 0;
|
||||
for (int i = 0; i < glyphs->num_glyphs; i++)
|
||||
{
|
||||
/* skip empty glyphs */
|
||||
if (glyphs->glyphs[i].glyph == PANGO_GLYPH_EMPTY)
|
||||
continue;
|
||||
|
||||
glyph_infos[n] = glyphs->glyphs[i];
|
||||
GLYPH_CLEAR_COLOR (&glyph_infos[n]);
|
||||
|
||||
if (has_color_glyphs &&
|
||||
glyph_has_color (font, glyph_infos[n].glyph))
|
||||
{
|
||||
self->has_color_glyphs = TRUE;
|
||||
GLYPH_SET_COLOR (&glyph_infos[n]);
|
||||
}
|
||||
|
||||
n++;
|
||||
if (glyphs->glyphs[i].glyph != PANGO_GLYPH_EMPTY)
|
||||
self->glyphs[self->num_glyphs++] = glyphs->glyphs[i];
|
||||
}
|
||||
|
||||
self->glyphs = glyph_infos;
|
||||
self->num_glyphs = n;
|
||||
|
||||
graphene_rect_init (&node->bounds,
|
||||
offset->x + ink_rect.x - 1,
|
||||
offset->y + ink_rect.y - 1,
|
||||
@@ -4866,7 +4813,7 @@ gsk_blur_node_diff (GskRenderNode *node1,
|
||||
cairo_region_t *sub;
|
||||
int i, n, clip_radius;
|
||||
|
||||
clip_radius = ceil (gsk_cairo_blur_compute_pixels (self1->radius / 2.0));
|
||||
clip_radius = ceil (gsk_cairo_blur_compute_pixels (self1->radius));
|
||||
sub = cairo_region_create ();
|
||||
gsk_render_node_diff (self1->child, self2->child, sub);
|
||||
|
||||
@@ -4913,7 +4860,7 @@ gsk_blur_node_new (GskRenderNode *child,
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->radius = radius;
|
||||
|
||||
clip_radius = gsk_cairo_blur_compute_pixels (radius / 2.0);
|
||||
clip_radius = gsk_cairo_blur_compute_pixels (radius);
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, &child->bounds);
|
||||
graphene_rect_inset (&self->render_node.bounds,
|
||||
|
||||
@@ -165,7 +165,8 @@ render_glyph (cairo_surface_t *surface,
|
||||
const GskNglGlyphValue *value)
|
||||
{
|
||||
cairo_t *cr;
|
||||
cairo_glyph_t glyph;
|
||||
PangoGlyphString glyph_string;
|
||||
PangoGlyphInfo glyph_info;
|
||||
|
||||
g_assert (surface != NULL);
|
||||
g_assert (scaled_font != NULL);
|
||||
@@ -174,11 +175,18 @@ render_glyph (cairo_surface_t *surface,
|
||||
cairo_set_scaled_font (cr, scaled_font);
|
||||
cairo_set_source_rgba (cr, 1, 1, 1, 1);
|
||||
|
||||
glyph.index = key->glyph;
|
||||
glyph.x = 0.25 * key->xshift - value->ink_rect.x;
|
||||
glyph.y = 0.25 * key->yshift - value->ink_rect.y;
|
||||
glyph_info.glyph = key->glyph;
|
||||
glyph_info.geometry.width = value->ink_rect.width * 1024;
|
||||
if (glyph_info.glyph & PANGO_GLYPH_UNKNOWN_FLAG)
|
||||
glyph_info.geometry.x_offset = 256 * key->xshift;
|
||||
else
|
||||
glyph_info.geometry.x_offset = 256 * key->xshift - value->ink_rect.x * 1024;
|
||||
glyph_info.geometry.y_offset = 256 * key->yshift - value->ink_rect.y * 1024;
|
||||
|
||||
cairo_show_glyphs (cr, &glyph, 1);
|
||||
glyph_string.num_glyphs = 1;
|
||||
glyph_string.glyphs = &glyph_info;
|
||||
|
||||
pango_cairo_show_glyph_string (cr, key->font, &glyph_string);
|
||||
cairo_destroy (cr);
|
||||
|
||||
cairo_surface_flush (surface);
|
||||
|
||||
@@ -137,11 +137,9 @@ gsk_ngl_renderer_unrealize (GskRenderer *renderer)
|
||||
|
||||
g_assert (GSK_IS_NGL_RENDERER (renderer));
|
||||
|
||||
gdk_gl_context_make_current (self->context);
|
||||
|
||||
g_clear_object (&self->driver);
|
||||
g_clear_object (&self->command_queue);
|
||||
g_clear_object (&self->context);
|
||||
g_clear_object (&self->command_queue);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
|
||||
+11
-19
@@ -1397,7 +1397,7 @@ gsk_ngl_render_job_visit_color_node (GskNglRenderJob *job,
|
||||
GskNglCommandBatch *batch;
|
||||
|
||||
rgba = gsk_color_node_get_color (node);
|
||||
if (RGBA_IS_CLEAR (rgba))
|
||||
if (gdk_rgba_is_clear (rgba))
|
||||
return;
|
||||
|
||||
rgba_to_half (rgba, color);
|
||||
@@ -2835,9 +2835,6 @@ compute_phase_and_pos (float value, float *pos)
|
||||
}
|
||||
}
|
||||
|
||||
#define COLOR_GLYPH_BIT 2
|
||||
#define GLYPH_IS_COLOR(g) (((*(guint32*)&(g)->attr) & COLOR_GLYPH_BIT) != 0)
|
||||
|
||||
static inline void
|
||||
gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
|
||||
const GskRenderNode *node,
|
||||
@@ -2858,9 +2855,7 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
|
||||
guint last_texture = 0;
|
||||
GskNglDrawVertex *vertices;
|
||||
guint used = 0;
|
||||
guint16 nc[4] = { FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE };
|
||||
guint16 cc[4];
|
||||
const guint16 *c;
|
||||
guint16 c[4] = { FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE };
|
||||
const PangoGlyphInfo *gi;
|
||||
guint i;
|
||||
int yshift;
|
||||
@@ -2869,11 +2864,16 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
|
||||
if (num_glyphs == 0)
|
||||
return;
|
||||
|
||||
if ((force_color || !gsk_text_node_has_color_glyphs (node)) &&
|
||||
RGBA_IS_CLEAR (color))
|
||||
return;
|
||||
/* If the font has color glyphs, we don't need to recolor anything.
|
||||
* We tell the shader by setting the color to vec4(-1).
|
||||
*/
|
||||
if (force_color || !gsk_text_node_has_color_glyphs (node))
|
||||
{
|
||||
if (gdk_rgba_is_clear (color))
|
||||
return;
|
||||
|
||||
rgba_to_half (color, cc);
|
||||
rgba_to_half (color, c);
|
||||
}
|
||||
|
||||
lookup.font = (PangoFont *)font;
|
||||
lookup.scale = (guint) (text_scale * 1024);
|
||||
@@ -2897,14 +2897,6 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
|
||||
|
||||
lookup.glyph = gi->glyph;
|
||||
|
||||
/* If the glyph has color, we don't need to recolor anything.
|
||||
* We tell the shader by setting the color to vec4(-1).
|
||||
*/
|
||||
if (!force_color && GLYPH_IS_COLOR (gi))
|
||||
c = nc;
|
||||
else
|
||||
c = cc;
|
||||
|
||||
cx = (float)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
|
||||
lookup.xshift = compute_phase_and_pos (x + cx, &cx);
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
#include "a11y/atspi/atspi-accessible.h"
|
||||
#include "a11y/atspi/atspi-application.h"
|
||||
@@ -613,7 +612,7 @@ gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
|
||||
return;
|
||||
|
||||
self->register_id = g_idle_add (root_register, self);
|
||||
gdk_source_set_static_name_by_id (self->register_id, "[gtk] ATSPI root registration");
|
||||
g_source_set_name_by_id (self->register_id, "[gtk] ATSPI root registration");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtk/gtkcomposetable.h"
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* This program reads a Compose file and generates files with sequences,
|
||||
* character data, and definitions for the builtin compose table of GTK.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#define MAX_SEQ_LEN 5
|
||||
#define N_INDEX_SIZE 30
|
||||
#define DATA_SIZE 16447
|
||||
#define N_CHARS 1241
|
||||
#define DATA_SIZE 16521
|
||||
#define N_CHARS 1572
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -55,7 +55,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_actionable_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const char * gtk_actionable_get_action_name (GtkActionable *actionable);
|
||||
const char * gtk_actionable_get_action_name (GtkActionable *actionable);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_actionable_set_action_name (GtkActionable *actionable,
|
||||
const char *action_name);
|
||||
|
||||
@@ -2242,23 +2242,6 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_CONTENT_FORMATS))
|
||||
{
|
||||
GdkContentFormats *formats;
|
||||
|
||||
formats = gdk_content_formats_parse (string);
|
||||
if (formats)
|
||||
g_value_take_boxed (value, formats);
|
||||
else
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_INVALID_VALUE,
|
||||
"Could not parse GdkContentFormats '%s'",
|
||||
string);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, GSK_TYPE_TRANSFORM))
|
||||
{
|
||||
GskTransform *transform;
|
||||
|
||||
+6
-10
@@ -573,8 +573,6 @@ parse_object (GtkBuildableParseContext *context,
|
||||
const char *object_id = NULL;
|
||||
char *internal_id = NULL;
|
||||
int line;
|
||||
gpointer line_ptr;
|
||||
gboolean has_duplicate;
|
||||
|
||||
child_info = state_peek_info (data, ChildInfo);
|
||||
if (child_info && child_info->tag_type == TAG_OBJECT)
|
||||
@@ -675,14 +673,14 @@ parse_object (GtkBuildableParseContext *context,
|
||||
object_info->parent = (CommonInfo*)child_info;
|
||||
state_push (data, object_info);
|
||||
|
||||
has_duplicate = g_hash_table_lookup_extended (data->object_ids, object_id, NULL, &line_ptr);
|
||||
if (has_duplicate != 0)
|
||||
line = GPOINTER_TO_INT (g_hash_table_lookup (data->object_ids, object_id));
|
||||
if (line != 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_DUPLICATE_ID,
|
||||
"Duplicate object ID '%s' (previously on line %d)",
|
||||
object_id, GPOINTER_TO_INT (line_ptr));
|
||||
object_id, line);
|
||||
_gtk_builder_prefix_error (data->builder, context, error);
|
||||
return;
|
||||
}
|
||||
@@ -703,8 +701,6 @@ parse_template (GtkBuildableParseContext *context,
|
||||
const char *object_class = NULL;
|
||||
const char *parent_class = NULL;
|
||||
int line;
|
||||
gpointer line_ptr;
|
||||
gboolean has_duplicate;
|
||||
GType template_type;
|
||||
GType parsed_type;
|
||||
|
||||
@@ -781,14 +777,14 @@ parse_template (GtkBuildableParseContext *context,
|
||||
object_info->object = gtk_builder_get_object (data->builder, object_class);
|
||||
state_push (data, object_info);
|
||||
|
||||
has_duplicate = g_hash_table_lookup_extended (data->object_ids, object_class, NULL, &line_ptr);
|
||||
if (has_duplicate != 0)
|
||||
line = GPOINTER_TO_INT (g_hash_table_lookup (data->object_ids, object_class));
|
||||
if (line != 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_DUPLICATE_ID,
|
||||
"Duplicate object ID '%s' (previously on line %d)",
|
||||
object_class, GPOINTER_TO_INT (line_ptr));
|
||||
object_class, line);
|
||||
_gtk_builder_prefix_error (data->builder, context, error);
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -791,7 +791,7 @@ gtk_real_button_activate (GtkButton *button)
|
||||
if (gtk_widget_get_realized (widget) && !priv->activate_timeout)
|
||||
{
|
||||
priv->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT, button_activate_timeout, button);
|
||||
gdk_source_set_static_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
|
||||
g_source_set_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
|
||||
|
||||
gtk_widget_add_css_class (GTK_WIDGET (button), "keyboard-activating");
|
||||
priv->button_down = TRUE;
|
||||
|
||||
@@ -420,6 +420,9 @@ gtk_check_button_focus (GtkWidget *widget,
|
||||
GtkDirectionType direction)
|
||||
{
|
||||
GtkCheckButton *self = GTK_CHECK_BUTTON (widget);
|
||||
GtkCheckButton *active_button;
|
||||
|
||||
active_button = get_group_active_button (self);
|
||||
|
||||
if (gtk_widget_is_focus (widget))
|
||||
{
|
||||
@@ -468,7 +471,9 @@ gtk_check_button_focus (GtkWidget *widget,
|
||||
if (new_focus)
|
||||
{
|
||||
gtk_widget_grab_focus (new_focus);
|
||||
gtk_widget_activate (new_focus);
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (new_focus), TRUE);
|
||||
if (active_button && active_button != (GtkCheckButton *)new_focus)
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (active_button), FALSE);
|
||||
}
|
||||
|
||||
g_ptr_array_free (child_array, TRUE);
|
||||
@@ -477,9 +482,6 @@ gtk_check_button_focus (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkCheckButton *active_button;
|
||||
|
||||
active_button = get_group_active_button (self);
|
||||
if (active_button && active_button != self)
|
||||
return FALSE;
|
||||
|
||||
@@ -496,10 +498,7 @@ gtk_check_button_real_activate (GtkCheckButton *self)
|
||||
if (priv->active && (priv->group_prev || priv->group_next))
|
||||
return;
|
||||
|
||||
if (priv->action_helper)
|
||||
gtk_action_helper_activate (priv->action_helper);
|
||||
else
|
||||
gtk_check_button_set_active (self, !gtk_check_button_get_active (self));
|
||||
gtk_check_button_set_active (self, !gtk_check_button_get_active (self));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+128
-101
@@ -486,16 +486,15 @@ parser_remove_duplicates (GtkComposeParser *parser)
|
||||
GHashTableIter iter;
|
||||
gunichar *sequence;
|
||||
char *value;
|
||||
GString *output;
|
||||
|
||||
output = g_string_new ("");
|
||||
|
||||
g_hash_table_iter_init (&iter, parser->sequences);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *)&sequence, (gpointer *)&value))
|
||||
{
|
||||
static guint keysyms[MAX_COMPOSE_LEN + 1];
|
||||
static guint16 keysyms[MAX_COMPOSE_LEN + 1];
|
||||
int i;
|
||||
int n_compose = 0;
|
||||
gunichar output_char;
|
||||
char buf[8] = { 0, };
|
||||
gboolean remove_sequence = FALSE;
|
||||
|
||||
if (value[0] == '\0')
|
||||
@@ -515,8 +514,8 @@ parser_remove_duplicates (GtkComposeParser *parser)
|
||||
|
||||
for (i = 0; i < MAX_COMPOSE_LEN + 1; i++)
|
||||
{
|
||||
guint codepoint = sequence[i];
|
||||
keysyms[i] = codepoint;
|
||||
gunichar codepoint = sequence[i];
|
||||
keysyms[i] = (guint16) codepoint;
|
||||
|
||||
if (codepoint == 0)
|
||||
break;
|
||||
@@ -530,9 +529,10 @@ parser_remove_duplicates (GtkComposeParser *parser)
|
||||
n_compose++;
|
||||
}
|
||||
|
||||
if (gtk_check_algorithmically (keysyms, n_compose, output))
|
||||
if (gtk_check_algorithmically (keysyms, n_compose, &output_char))
|
||||
{
|
||||
if (strcmp (value, output->str) == 0)
|
||||
g_unichar_to_utf8 (output_char, buf);
|
||||
if (strcmp (value, buf) == 0)
|
||||
remove_sequence = TRUE;
|
||||
}
|
||||
|
||||
@@ -540,8 +540,6 @@ next:
|
||||
if (remove_sequence)
|
||||
g_hash_table_iter_remove (&iter);
|
||||
}
|
||||
|
||||
g_string_free (output, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1071,22 +1069,22 @@ gtk_compose_table_parse (const char *compose_file,
|
||||
return compose_table;
|
||||
}
|
||||
|
||||
static const char *prefix =
|
||||
"# GTK has rewritten this file to add the line:\n"
|
||||
"\n"
|
||||
"include \"%L\"\n"
|
||||
"\n"
|
||||
"# This is necessary to add your own Compose sequences\n"
|
||||
"# in addition to the builtin sequences of GTK. If this\n"
|
||||
"# is not what you want, just remove that line.\n"
|
||||
"#\n"
|
||||
"# A backup of the previous file contents has been made.\n"
|
||||
"\n"
|
||||
"\n";
|
||||
|
||||
static gboolean
|
||||
rewrite_compose_file (const char *compose_file)
|
||||
{
|
||||
static const char *prefix =
|
||||
"# GTK has rewritten this file to add the line:\n"
|
||||
"\n"
|
||||
"include \"%L\"\n"
|
||||
"\n"
|
||||
"# This is necessary to add your own Compose sequences\n"
|
||||
"# in addition to the builtin sequences of GTK. If this\n"
|
||||
"# is not what you want, just remove that line.\n"
|
||||
"#\n"
|
||||
"# A backup of the previous file contents has been made.\n"
|
||||
"\n"
|
||||
"\n";
|
||||
|
||||
char *path = NULL;
|
||||
char *content = NULL;
|
||||
gsize content_len;
|
||||
@@ -1217,7 +1215,7 @@ static int
|
||||
compare_seq (const void *key, const void *value)
|
||||
{
|
||||
int i = 0;
|
||||
const guint *keysyms = key;
|
||||
const guint16 *keysyms = key;
|
||||
const guint16 *seq = value;
|
||||
|
||||
while (keysyms[i])
|
||||
@@ -1236,7 +1234,7 @@ compare_seq (const void *key, const void *value)
|
||||
static int
|
||||
compare_seq_index (const void *key, const void *value)
|
||||
{
|
||||
const guint *keysyms = key;
|
||||
const guint16 *keysyms = key;
|
||||
const guint16 *seq = value;
|
||||
|
||||
if (keysyms[0] < seq[0])
|
||||
@@ -1262,7 +1260,7 @@ compare_seq_index (const void *key, const void *value)
|
||||
*/
|
||||
gboolean
|
||||
gtk_compose_table_check (const GtkComposeTable *table,
|
||||
const guint *compose_buffer,
|
||||
const guint16 *compose_buffer,
|
||||
int n_compose,
|
||||
gboolean *compose_finish,
|
||||
gboolean *compose_match,
|
||||
@@ -1354,47 +1352,6 @@ gtk_compose_table_check (const GtkComposeTable *table,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_compose_table_get_prefix (const GtkComposeTable *table,
|
||||
const guint *compose_buffer,
|
||||
int n_compose,
|
||||
int *prefix)
|
||||
{
|
||||
int index_stride = table->max_seq_len + 1;
|
||||
int p = 0;
|
||||
|
||||
for (int idx = 0; idx < table->n_index_size; idx++)
|
||||
{
|
||||
const guint16 *seq_index = table->data + (idx * index_stride);
|
||||
|
||||
if (seq_index[0] == compose_buffer[0])
|
||||
{
|
||||
p = 1;
|
||||
|
||||
for (int i = 1; i < table->max_seq_len; i++)
|
||||
{
|
||||
int len = i + 1;
|
||||
|
||||
for (int j = seq_index[i]; j < seq_index[i + 1]; j += len)
|
||||
{
|
||||
int k;
|
||||
|
||||
for (k = 0; k < MIN (len, n_compose) - 1; k++)
|
||||
{
|
||||
if (compose_buffer[k + 1] != table->data[j + k])
|
||||
break;
|
||||
}
|
||||
p = MAX (p, k + 1);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*prefix = p;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_compose_table_foreach (const GtkComposeTable *table,
|
||||
GtkComposeSequenceCallback callback,
|
||||
@@ -1462,56 +1419,119 @@ gtk_compose_table_foreach (const GtkComposeTable *table,
|
||||
#define IS_DEAD_KEY(k) \
|
||||
((k) >= GDK_KEY_dead_grave && (k) <= GDK_KEY_dead_greek)
|
||||
|
||||
/* This function receives a sequence of Unicode characters and tries to
|
||||
* normalize it (NFC). We check for the case where the resulting string
|
||||
* has length 1 (single character).
|
||||
* NFC normalisation normally rearranges diacritic marks, unless these
|
||||
* belong to the same Canonical Combining Class.
|
||||
* If they belong to the same canonical combining class, we produce all
|
||||
* permutations of the diacritic marks, then attempt to normalize.
|
||||
*/
|
||||
static gboolean
|
||||
check_normalize_nfc (gunichar *combination_buffer,
|
||||
int n_compose)
|
||||
{
|
||||
gunichar *combination_buffer_temp;
|
||||
char *combination_utf8_temp = NULL;
|
||||
char *nfc_temp = NULL;
|
||||
int n_combinations;
|
||||
gunichar temp_swap;
|
||||
int i;
|
||||
|
||||
combination_buffer_temp = g_alloca (n_compose * sizeof (gunichar));
|
||||
|
||||
n_combinations = 1;
|
||||
|
||||
for (i = 1; i < n_compose; i++)
|
||||
n_combinations *= i;
|
||||
|
||||
/* Xorg reuses dead_tilde for the perispomeni diacritic mark.
|
||||
* We check if base character belongs to Greek Unicode block,
|
||||
* and if so, we replace tilde with perispomeni.
|
||||
*/
|
||||
if (combination_buffer[0] >= 0x390 && combination_buffer[0] <= 0x3FF)
|
||||
{
|
||||
for (i = 1; i < n_compose; i++ )
|
||||
if (combination_buffer[i] == 0x303)
|
||||
combination_buffer[i] = 0x342;
|
||||
}
|
||||
|
||||
memcpy (combination_buffer_temp, combination_buffer, n_compose * sizeof (gunichar) );
|
||||
|
||||
for (i = 0; i < n_combinations; i++)
|
||||
{
|
||||
g_unicode_canonical_ordering (combination_buffer_temp, n_compose);
|
||||
combination_utf8_temp = g_ucs4_to_utf8 (combination_buffer_temp, n_compose, NULL, NULL, NULL);
|
||||
nfc_temp = g_utf8_normalize (combination_utf8_temp, -1, G_NORMALIZE_NFC);
|
||||
|
||||
if (g_utf8_strlen (nfc_temp, -1) == 1)
|
||||
{
|
||||
memcpy (combination_buffer, combination_buffer_temp, n_compose * sizeof (gunichar) );
|
||||
|
||||
g_free (combination_utf8_temp);
|
||||
g_free (nfc_temp);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_free (combination_utf8_temp);
|
||||
g_free (nfc_temp);
|
||||
|
||||
if (n_compose > 2)
|
||||
{
|
||||
temp_swap = combination_buffer_temp[i % (n_compose - 1) + 1];
|
||||
combination_buffer_temp[i % (n_compose - 1) + 1] = combination_buffer_temp[(i+1) % (n_compose - 1) + 1];
|
||||
combination_buffer_temp[(i+1) % (n_compose - 1) + 1] = temp_swap;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_check_algorithmically (const guint *compose_buffer,
|
||||
int n_compose,
|
||||
GString *output)
|
||||
gtk_check_algorithmically (const guint16 *compose_buffer,
|
||||
int n_compose,
|
||||
gunichar *output_char)
|
||||
|
||||
{
|
||||
int i;
|
||||
gunichar *combination_buffer;
|
||||
char *combination_utf8, *nfc;
|
||||
|
||||
g_string_set_size (output, 0);
|
||||
combination_buffer = alloca (sizeof (gunichar) * (n_compose + 1));
|
||||
|
||||
if (output_char)
|
||||
*output_char = 0;
|
||||
|
||||
for (i = 0; i < n_compose && IS_DEAD_KEY (compose_buffer[i]); i++)
|
||||
;
|
||||
|
||||
/* Can't combine if there's no base character: incomplete sequence */
|
||||
/* Allow at most 2 dead keys */
|
||||
if (i > 2)
|
||||
return FALSE;
|
||||
|
||||
/* Can't combine if there's no base character */
|
||||
if (i == n_compose)
|
||||
return TRUE;
|
||||
|
||||
if (i > 0 && i == n_compose - 1)
|
||||
{
|
||||
GString *input;
|
||||
char *nfc;
|
||||
gunichar ch;
|
||||
|
||||
ch = gdk_keyval_to_unicode (compose_buffer[i]);
|
||||
|
||||
/* We don't allow combining with non-letters */
|
||||
if (!g_unichar_isalpha (ch))
|
||||
return FALSE;
|
||||
|
||||
input = g_string_sized_new (4 * n_compose);
|
||||
|
||||
g_string_append_unichar (input, ch);
|
||||
|
||||
combination_buffer[0] = gdk_keyval_to_unicode (compose_buffer[i]);
|
||||
combination_buffer[n_compose] = 0;
|
||||
i--;
|
||||
while (i >= 0)
|
||||
{
|
||||
switch (compose_buffer[i])
|
||||
{
|
||||
#define CASE(keysym, unicode) \
|
||||
case GDK_KEY_dead_##keysym: g_string_append_unichar (input, unicode); break
|
||||
case GDK_KEY_dead_##keysym: combination_buffer[i+1] = unicode; break
|
||||
|
||||
CASE (grave, 0x0300);
|
||||
CASE (acute, 0x0301);
|
||||
CASE (circumflex, 0x0302);
|
||||
case GDK_KEY_dead_tilde:
|
||||
if (g_unichar_get_script (ch) == G_UNICODE_SCRIPT_GREEK)
|
||||
g_string_append_unichar (input, 0x342); /* combining perispomeni */
|
||||
else
|
||||
g_string_append_unichar (input, 0x303); /* combining tilde */
|
||||
break;
|
||||
CASE (tilde, 0x0303); /* Also used with perispomeni, 0x342. */
|
||||
CASE (macron, 0x0304);
|
||||
CASE (breve, 0x0306);
|
||||
CASE (abovedot, 0x0307);
|
||||
@@ -1529,7 +1549,7 @@ gtk_check_algorithmically (const guint *compose_buffer,
|
||||
CASE (horn, 0x031B); /* Legacy use for psili, 0x313 (or 0x343). */
|
||||
CASE (stroke, 0x335);
|
||||
CASE (abovecomma, 0x0313); /* Equivalent to psili */
|
||||
CASE (abovereversedcomma, 0x0314); /* Equivalent to dasia */
|
||||
CASE (abovereversedcomma, 0x0314); /* Equivalent to dasia */
|
||||
CASE (doublegrave, 0x30F);
|
||||
CASE (belowring, 0x325);
|
||||
CASE (belowmacron, 0x331);
|
||||
@@ -1557,20 +1577,27 @@ gtk_check_algorithmically (const guint *compose_buffer,
|
||||
CASE (capital_schwa, 0x1DEA);
|
||||
#undef CASE
|
||||
default:
|
||||
g_string_append_unichar (input, gdk_keyval_to_unicode (compose_buffer[i]));
|
||||
combination_buffer[i+1] = gdk_keyval_to_unicode (compose_buffer[i]);
|
||||
}
|
||||
i--;
|
||||
}
|
||||
|
||||
nfc = g_utf8_normalize (input->str, input->len, G_NORMALIZE_NFC);
|
||||
/* If the buffer normalizes to a single character, then modify the order
|
||||
* of combination_buffer accordingly, if necessary, and return TRUE.
|
||||
*/
|
||||
if (check_normalize_nfc (combination_buffer, n_compose))
|
||||
{
|
||||
combination_utf8 = g_ucs4_to_utf8 (combination_buffer, -1, NULL, NULL, NULL);
|
||||
nfc = g_utf8_normalize (combination_utf8, -1, G_NORMALIZE_NFC);
|
||||
|
||||
g_string_assign (output, nfc);
|
||||
if (output_char)
|
||||
*output_char = g_utf8_get_char (nfc);
|
||||
|
||||
g_free (nfc);
|
||||
g_free (combination_utf8);
|
||||
g_free (nfc);
|
||||
|
||||
g_string_free (input, TRUE);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -74,20 +74,15 @@ void gtk_compose_table_foreach (const GtkComposeTable *table,
|
||||
gpointer data);
|
||||
|
||||
gboolean gtk_compose_table_check (const GtkComposeTable *table,
|
||||
const guint *compose_buffer,
|
||||
const guint16 *compose_buffer,
|
||||
int n_compose,
|
||||
gboolean *compose_finish,
|
||||
gboolean *compose_match,
|
||||
GString *output);
|
||||
|
||||
void gtk_compose_table_get_prefix (const GtkComposeTable *table,
|
||||
const guint *compose_buffer,
|
||||
int n_compose,
|
||||
int *prefix);
|
||||
|
||||
gboolean gtk_check_algorithmically (const guint *compose_buffer,
|
||||
gboolean gtk_check_algorithmically (const guint16 *compose_buffer,
|
||||
int n_compose,
|
||||
GString *output);
|
||||
gunichar *output);
|
||||
|
||||
guint32 gtk_compose_table_data_hash (const guint16 *data,
|
||||
int max_seq_len,
|
||||
|
||||
@@ -106,7 +106,7 @@ gtk_css_dimension_value_parse (GtkCssParser *parser,
|
||||
|
||||
if (i >= G_N_ELEMENTS (units))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "'%s' is not a valid unit", token->dimension.dimension);
|
||||
gtk_css_parser_error_syntax (parser, "'%s' is not a valid unit.", token->dimension.dimension);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ gtk_css_dimension_value_parse (GtkCssParser *parser,
|
||||
if (flags & GTK_CSS_POSITIVE_ONLY &&
|
||||
number < 0)
|
||||
{
|
||||
gtk_css_parser_error_value (parser, "Negative values are not allowed");
|
||||
gtk_css_parser_error_value (parser, "negative values are not allowed.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -542,8 +542,8 @@ gtk_css_shadow_value_get_extents (const GtkCssValue *value,
|
||||
|
||||
spread = _gtk_css_number_value_get (shadow->spread, 0);
|
||||
radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||
if (!value->is_filter)
|
||||
radius = radius / 2.0;
|
||||
if (value->is_filter)
|
||||
radius = radius * 2;
|
||||
clip_radius = gsk_cairo_blur_compute_pixels (radius);
|
||||
hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
|
||||
voffset = _gtk_css_number_value_get (shadow->voffset, 0);
|
||||
|
||||
+5
-16
@@ -344,7 +344,7 @@ gtk_drop_target_accept (GtkDropTarget *self,
|
||||
if (self->formats == NULL)
|
||||
return TRUE;
|
||||
|
||||
return gdk_content_formats_match_gtype (self->formats, gdk_drop_get_formats (drop)) != G_TYPE_INVALID;
|
||||
return gdk_content_formats_match (self->formats, gdk_drop_get_formats (drop));
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
@@ -544,12 +544,6 @@ gtk_drop_target_set_property (GObject *object,
|
||||
gtk_drop_target_set_actions (self, g_value_get_flags (value));
|
||||
break;
|
||||
|
||||
case PROP_FORMATS:
|
||||
self->formats = g_value_dup_boxed (value);
|
||||
if (self->formats == NULL)
|
||||
self->formats = gdk_content_formats_new (NULL, 0);
|
||||
break;
|
||||
|
||||
case PROP_PRELOAD:
|
||||
gtk_drop_target_set_preload (self, g_value_get_boolean (value));
|
||||
break;
|
||||
@@ -667,7 +661,7 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
|
||||
P_("Formats"),
|
||||
P_("The supported formats"),
|
||||
GDK_TYPE_CONTENT_FORMATS,
|
||||
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
GTK_PARAM_READABLE);
|
||||
|
||||
/**
|
||||
* GtkDropTarget:preload: (attributes org.gtk.Property.get=gtk_drop_target_get_preload org.gtk.Property.set=gtk_drop_target_set_preload)
|
||||
@@ -849,6 +843,7 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
|
||||
static void
|
||||
gtk_drop_target_init (GtkDropTarget *self)
|
||||
{
|
||||
self->formats = gdk_content_formats_new (NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -869,19 +864,13 @@ gtk_drop_target_new (GType type,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
GtkDropTarget *result;
|
||||
GdkContentFormats *formats;
|
||||
|
||||
if (type != G_TYPE_INVALID)
|
||||
formats = gdk_content_formats_new_for_gtype (type);
|
||||
else
|
||||
formats = NULL;
|
||||
|
||||
result = g_object_new (GTK_TYPE_DROP_TARGET,
|
||||
"formats", formats,
|
||||
"actions", actions,
|
||||
NULL);
|
||||
|
||||
g_clear_pointer (&formats, gdk_content_formats_unref);
|
||||
if (type != G_TYPE_INVALID)
|
||||
gtk_drop_target_set_gtypes (result, &type, 1);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1016,7 +1016,7 @@ gtk_emoji_chooser_init (GtkEmojiChooser *chooser)
|
||||
populate_recent_section (chooser);
|
||||
|
||||
chooser->populate_idle = g_idle_add (populate_emoji_chooser, chooser);
|
||||
gdk_source_set_static_name_by_id (chooser->populate_idle, "[gtk] populate_emoji_chooser");
|
||||
g_source_set_name_by_id (chooser->populate_idle, "[gtk] populate_emoji_chooser");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1982,7 +1982,7 @@ gtk_entry_completion_changed (GtkWidget *widget,
|
||||
g_timeout_add (COMPLETION_TIMEOUT,
|
||||
gtk_entry_completion_timeout,
|
||||
completion);
|
||||
gdk_source_set_static_name_by_id (completion->completion_timeout, "[gtk] gtk_entry_completion_timeout");
|
||||
g_source_set_name_by_id (completion->completion_timeout, "[gtk] gtk_entry_completion_timeout");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2048,7 +2048,7 @@ completion_inserted_text_callback (GtkEntryBuffer *buffer,
|
||||
g_cclosure_new_object (G_CALLBACK (check_completion_callback),
|
||||
G_OBJECT (completion)));
|
||||
g_source_attach (completion->check_completion_idle, NULL);
|
||||
g_source_set_static_name (completion->check_completion_idle, "[gtk] check_completion_callback");
|
||||
g_source_set_name (completion->check_completion_idle, "[gtk] check_completion_callback");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ void _gtk_entry_completion_connect (GtkEntryCompletion *completion,
|
||||
GtkEntry *entry);
|
||||
void _gtk_entry_completion_disconnect (GtkEntryCompletion *completion);
|
||||
|
||||
GtkIMContext * _gtk_entry_get_im_context (GtkEntry *entry);
|
||||
GtkEventController * gtk_entry_get_key_controller (GtkEntry *entry);
|
||||
GtkText *gtk_entry_get_text_widget (GtkEntry *entry);
|
||||
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ gtk_expander_drag_enter (GtkDropControllerMotion *motion,
|
||||
if (!expander->expanded && !expander->expand_timer)
|
||||
{
|
||||
expander->expand_timer = g_timeout_add (TIMEOUT_EXPAND, (GSourceFunc) expand_timeout, expander);
|
||||
gdk_source_set_static_name_by_id (expander->expand_timer, "[gtk] expand_timeout");
|
||||
g_source_set_name_by_id (expander->expand_timer, "[gtk] expand_timeout");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2234,7 +2234,7 @@ location_entry_changed_cb (GtkEditable *editable,
|
||||
impl->location_changed_id = g_timeout_add (LOCATION_CHANGED_TIMEOUT,
|
||||
location_changed_timeout_cb,
|
||||
impl);
|
||||
gdk_source_set_static_name_by_id (impl->location_changed_id, "[gtk] location_changed_timeout_cb");
|
||||
g_source_set_name_by_id (impl->location_changed_id, "[gtk] location_changed_timeout_cb");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3822,7 +3822,7 @@ load_setup_timer (GtkFileChooserWidget *impl)
|
||||
g_assert (impl->load_state != LOAD_PRELOAD);
|
||||
|
||||
impl->load_timeout_id = g_timeout_add (MAX_LOADING_TIME, load_timeout_cb, impl);
|
||||
gdk_source_set_static_name_by_id (impl->load_timeout_id, "[gtk] load_timeout_cb");
|
||||
g_source_set_name_by_id (impl->load_timeout_id, "[gtk] load_timeout_cb");
|
||||
impl->load_state = LOAD_PRELOAD;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "gtktreednd.h"
|
||||
#include "gtktreemodel.h"
|
||||
#include "gtkfilter.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
/*** Structure: how GtkFileSystemModel works
|
||||
*
|
||||
@@ -1096,7 +1095,7 @@ gtk_file_system_model_got_files (GObject *object, GAsyncResult *res, gpointer da
|
||||
thaw_func,
|
||||
model,
|
||||
NULL);
|
||||
gdk_source_set_static_name_by_id (model->dir_thaw_source, "[gtk] thaw_func");
|
||||
g_source_set_name_by_id (model->dir_thaw_source, "[gtk] thaw_func");
|
||||
}
|
||||
|
||||
for (walk = files; walk; walk = walk->next)
|
||||
|
||||
@@ -267,7 +267,7 @@ gtk_filter_list_model_start_filtering (GtkFilterListModel *self,
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PENDING]);
|
||||
g_assert (self->pending_cb == 0);
|
||||
self->pending_cb = g_idle_add (gtk_filter_list_model_run_filter_cb, self);
|
||||
gdk_source_set_static_name_by_id (self->pending_cb, "[gtk] gtk_filter_list_model_run_filter_cb");
|
||||
g_source_set_name_by_id (self->pending_cb, "[gtk] gtk_filter_list_model_run_filter_cb");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+34
-43
@@ -386,18 +386,15 @@ user_filter_cb (gpointer item,
|
||||
|
||||
ret = FALSE;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
langs = pango_fc_font_get_languages (PANGO_FC_FONT (font));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
if (langs)
|
||||
for (i = 0; langs[i]; i++)
|
||||
{
|
||||
if (langs[i] == self->filter_language)
|
||||
{
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; langs[i]; i++)
|
||||
{
|
||||
if (langs[i] == self->filter_language)
|
||||
{
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (font);
|
||||
@@ -603,20 +600,17 @@ maybe_update_preview_text (GtkFontChooserWidget *self,
|
||||
alt_default = pango_language_from_string (q);
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
languages = pango_fc_font_get_languages (PANGO_FC_FONT (font));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
/* If the font supports the default language, just use it. */
|
||||
if (languages)
|
||||
for (i = 0; languages[i]; i++)
|
||||
{
|
||||
if (languages[i] == default_lang || languages[i] == alt_default)
|
||||
{
|
||||
lang = default_lang;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
for (i = 0; languages[i]; i++)
|
||||
{
|
||||
if (languages[i] == default_lang || languages[i] == alt_default)
|
||||
{
|
||||
lang = default_lang;
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise, we make a list of representative languages */
|
||||
langs = g_hash_table_new (NULL, NULL);
|
||||
@@ -1072,31 +1066,28 @@ add_languages_from_font (GtkFontChooserWidget *self,
|
||||
PangoLanguage **langs;
|
||||
int i;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
langs = pango_fc_font_get_languages (PANGO_FC_FONT (font));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
if (langs)
|
||||
for (i = 0; langs[i]; i++)
|
||||
{
|
||||
if (!g_hash_table_contains (self->language_table, langs[i]))
|
||||
{
|
||||
g_hash_table_add (self->language_table, langs[i]);
|
||||
if (get_language_name (langs[i]))
|
||||
{
|
||||
const char *l = pango_language_to_string (langs[i]);
|
||||
gulong id = 0;
|
||||
for (i = 0; langs[i]; i++)
|
||||
{
|
||||
if (!g_hash_table_contains (self->language_table, langs[i]))
|
||||
{
|
||||
g_hash_table_add (self->language_table, langs[i]);
|
||||
if (get_language_name (langs[i]))
|
||||
{
|
||||
const char *l = pango_language_to_string (langs[i]);
|
||||
gulong id = 0;
|
||||
|
||||
/* Pre-select the default language */
|
||||
if (pango_language_matches (default_lang, l))
|
||||
id = g_signal_connect (model, "items-changed", G_CALLBACK (select_added), NULL);
|
||||
/* Pre-select the default language */
|
||||
if (pango_language_matches (default_lang, l))
|
||||
id = g_signal_connect (model, "items-changed", G_CALLBACK (select_added), NULL);
|
||||
|
||||
gtk_string_list_append (self->languages, l);
|
||||
gtk_string_list_append (self->languages, l);
|
||||
|
||||
if (id)
|
||||
g_signal_handler_disconnect (model, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (id)
|
||||
g_signal_handler_disconnect (model, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (font);
|
||||
|
||||
@@ -146,7 +146,7 @@ _gtk_gesture_click_update_timeout (GtkGestureClick *gesture)
|
||||
g_object_get (settings, "gtk-double-click-time", &double_click_time, NULL);
|
||||
|
||||
priv->double_click_timeout_id = g_timeout_add (double_click_time, _double_click_timeout_cb, gesture);
|
||||
gdk_source_set_static_name_by_id (priv->double_click_timeout_id, "[gtk] _double_click_timeout_cb");
|
||||
g_source_set_name_by_id (priv->double_click_timeout_id, "[gtk] _double_click_timeout_cb");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -150,7 +150,7 @@ gtk_gesture_long_press_begin (GtkGesture *gesture,
|
||||
gtk_gesture_get_point (gesture, sequence,
|
||||
&priv->initial_x, &priv->initial_y);
|
||||
priv->timeout_id = g_timeout_add (delay, _gtk_gesture_long_press_timeout, gesture);
|
||||
gdk_source_set_static_name_by_id (priv->timeout_id, "[gtk] _gtk_gesture_long_press_timeout");
|
||||
g_source_set_name_by_id (priv->timeout_id, "[gtk] _gtk_gesture_long_press_timeout");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -95,13 +95,13 @@ _gtk_gesture_rotate_get_angle (GtkGestureRotate *rotate,
|
||||
goto out;
|
||||
|
||||
last_event = gtk_gesture_get_last_event (gesture, sequences->data);
|
||||
phase = gdk_touchpad_event_get_gesture_phase (last_event);
|
||||
|
||||
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH)
|
||||
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH &&
|
||||
(phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN ||
|
||||
phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE ||
|
||||
phase == GDK_TOUCHPAD_GESTURE_PHASE_END))
|
||||
{
|
||||
phase = gdk_touchpad_event_get_gesture_phase (last_event);
|
||||
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_CANCEL)
|
||||
goto out;
|
||||
|
||||
*angle = priv->accum_touchpad_angle;
|
||||
}
|
||||
else
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ gtk_icon_helper_paintable_get_current_image (GdkPaintable *paintable)
|
||||
if (self->paintable == NULL)
|
||||
return NULL;
|
||||
|
||||
return gdk_paintable_get_current_image (self->paintable);
|
||||
return gtk_icon_helper_paintable_get_current_image (self->paintable);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
+1
-1
@@ -1342,7 +1342,7 @@ queue_theme_changed (GtkIconTheme *self)
|
||||
theme_changed_idle__mainthread_unlocked,
|
||||
gtk_icon_theme_ref_ref (self->ref),
|
||||
(GDestroyNotify)gtk_icon_theme_ref_unref);
|
||||
gdk_source_set_static_name_by_id (self->theme_changed_idle, "[gtk] theme_changed_idle");
|
||||
g_source_set_name_by_id (self->theme_changed_idle, "[gtk] theme_changed_idle");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1831,7 +1831,7 @@ gtk_icon_view_motion (GtkEventController *controller,
|
||||
|
||||
if (icon_view->priv->scroll_timeout_id == 0) {
|
||||
icon_view->priv->scroll_timeout_id = g_timeout_add (30, rubberband_scroll_timeout, icon_view);
|
||||
gdk_source_set_static_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] rubberband_scroll_timeout");
|
||||
g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] rubberband_scroll_timeout");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -6065,7 +6065,7 @@ gtk_icon_view_drag_motion (GtkDropTargetAsync *dest,
|
||||
if (icon_view->priv->scroll_timeout_id == 0)
|
||||
{
|
||||
icon_view->priv->scroll_timeout_id = g_timeout_add (50, drag_scroll_timeout, icon_view);
|
||||
gdk_source_set_static_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] drag_scroll_timeout");
|
||||
g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk] drag_scroll_timeout");
|
||||
}
|
||||
|
||||
if (target == GTK_TYPE_TREE_ROW_DATA)
|
||||
|
||||
+79
-99
@@ -31,16 +31,27 @@
|
||||
* `GtkIMContext` is used by GTK text input widgets like `GtkText`
|
||||
* to map from key events to Unicode character strings.
|
||||
*
|
||||
* By default, GTK uses a platform-dependent default input method.
|
||||
* On Windows, the default implementation is IME-based and on Wayland,
|
||||
* it is using the Wayland text protocol. The choice can be overridden
|
||||
* programmatically via the [property@Gtk.Settings:gtk-im-module] setting.
|
||||
* Users may set the `GTK_IM_MODULE` environment variable to override the
|
||||
* default.
|
||||
*
|
||||
* Text widgets have a :im-module property (e.g. [property@Gtk.TextView:im-module])
|
||||
* that may also be used to set input methods for specific widget instances.
|
||||
* For instance, a certain entry widget might be expected to contain
|
||||
* certain characters which would be easier to input with a specific
|
||||
* input method.
|
||||
*
|
||||
* An input method may consume multiple key events in sequence before finally
|
||||
* outputting the composed result. This is called *preediting*, and an input
|
||||
* method may provide feedback about this process by displaying the intermediate
|
||||
* composition states as preedit text. To do so, the `GtkIMContext` will emit
|
||||
* [signal@Gtk.IMContext::preedit-start], [signal@Gtk.IMContext::preedit-changed]
|
||||
* and [signal@Gtk.IMContext::preedit-end] signals.
|
||||
* composition states as preedit text.
|
||||
*
|
||||
* For instance, the built-in GTK input method [class@Gtk.IMContextSimple]
|
||||
* implements the input of arbitrary Unicode code points by holding down the
|
||||
* <kbd>Control</kbd> and <kbd>Shift</kbd> keys and then typing <kbd>u</kbd>
|
||||
* For instance, the built-in GTK input method `GtkIMContextSimple` implements
|
||||
* the input of arbitrary Unicode code points by holding down the
|
||||
* <kbd>Control</kbd> and <kbd>Shift</kbd> keys and then typing <kbd>U</kbd>
|
||||
* followed by the hexadecimal digits of the code point. When releasing the
|
||||
* <kbd>Control</kbd> and <kbd>Shift</kbd> keys, preediting ends and the
|
||||
* character is inserted as text. For example,
|
||||
@@ -52,9 +63,6 @@
|
||||
* Additional input methods can be made available for use by GTK widgets as
|
||||
* loadable modules. An input method module is a small shared library which
|
||||
* provides a `GIOExtension` for the extension point named "gtk-im-module".
|
||||
*
|
||||
* To connect a widget to the users preferred input method, you should use
|
||||
* [class@Gtk.IMMulticontext].
|
||||
*/
|
||||
|
||||
enum {
|
||||
@@ -115,74 +123,72 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkIMContext, gtk_im_context, G_TYPE_OBJECT
|
||||
|
||||
/**
|
||||
* GtkIMContextClass:
|
||||
* @preedit_start: Default handler of the [signal@Gtk.IMContext::preedit-start] signal.
|
||||
* @preedit_end: Default handler of the [signal@Gtk.IMContext::preedit-end] signal.
|
||||
* @preedit_changed: Default handler of the [signal@Gtk.IMContext::preedit-changed]
|
||||
* @preedit_start: Default handler of the `GtkIMContext::preedit-start` signal.
|
||||
* @preedit_end: Default handler of the `GtkIMContext::preedit-end` signal.
|
||||
* @preedit_changed: Default handler of the `GtkIMContext::preedit-changed`
|
||||
* signal.
|
||||
* @commit: Default handler of the [signal@Gtk.IMContext::commit] signal.
|
||||
* @commit: Default handler of the `GtkIMContext::commit` signal.
|
||||
* @retrieve_surrounding: Default handler of the
|
||||
* [signal@Gtk.IMContext::retrieve-surrounding] signal.
|
||||
* `GtkIMContext::retrieve-surrounding` signal.
|
||||
* @delete_surrounding: Default handler of the
|
||||
* [signal@Gtk.IMContext::delete-surrounding] signal.
|
||||
* @set_client_widget: Called via [method@Gtk.IMContext.set_client_widget] when
|
||||
* the input window where the entered text will appear changes. Override this
|
||||
* to keep track of the current input window, for instance for the purpose of
|
||||
* `GtkIMContext::delete-surrounding` signal.
|
||||
* @set_client_widget: Called via gtk_im_context_set_client_widget() when the
|
||||
* input window where the entered text will appear changes. Override this to
|
||||
* keep track of the current input window, for instance for the purpose of
|
||||
* positioning a status display of your input method.
|
||||
* @get_preedit_string: Called via [method@Gtk.IMContext.get_preedit_string]
|
||||
* to retrieve the text currently being preedited for display at the cursor
|
||||
* @get_preedit_string: Called via gtk_im_context_get_preedit_string() to
|
||||
* retrieve the text currently being preedited for display at the cursor
|
||||
* position. Any input method which composes complex characters or any
|
||||
* other compositions from multiple sequential key presses should override
|
||||
* this method to provide feedback.
|
||||
* @filter_keypress: Called via [method@Gtk.IMContext.filter_keypress] on every
|
||||
* @filter_keypress: Called via gtk_im_context_filter_keypress() on every
|
||||
* key press or release event. Every non-trivial input method needs to
|
||||
* override this in order to implement the mapping from key events to text.
|
||||
* A return value of %TRUE indicates to the caller that the event was
|
||||
* consumed by the input method. In that case, the [signal@Gtk.IMContext::commit]
|
||||
* consumed by the input method. In that case, the `GtkIMContext::commit`
|
||||
* signal should be emitted upon completion of a key sequence to pass the
|
||||
* resulting text back to the input widget. Alternatively, %FALSE may be
|
||||
* returned to indicate that the event wasn’t handled by the input method.
|
||||
* If a builtin mapping exists for the key, it is used to produce a
|
||||
* character.
|
||||
* @focus_in: Called via [method@Gtk.IMContext.focus_in] when the input widget
|
||||
* @focus_in: Called via gtk_im_context_focus_in() when the input widget
|
||||
* has gained focus. May be overridden to keep track of the current focus.
|
||||
* @focus_out: Called via [method@Gtk.IMContext.focus_out] when the input widget
|
||||
* @focus_out: Called via gtk_im_context_focus_out() when the input widget
|
||||
* has lost focus. May be overridden to keep track of the current focus.
|
||||
* @reset: Called via [method@Gtk.IMContext.reset] to signal a change such as a
|
||||
* @reset: Called via gtk_im_context_reset() to signal a change such as a
|
||||
* change in cursor position. An input method that implements preediting
|
||||
* should override this method to clear the preedit state on reset.
|
||||
* @set_cursor_location: Called via [method@Gtk.IMContext.set_cursor_location]
|
||||
* @set_cursor_location: Called via gtk_im_context_set_cursor_location()
|
||||
* to inform the input method of the current cursor location relative to
|
||||
* the client window. May be overridden to implement the display of popup
|
||||
* windows at the cursor position.
|
||||
* @set_use_preedit: Called via [method@Gtk.IMContext.set_use_preedit] to control
|
||||
* @set_use_preedit: Called via gtk_im_context_set_use_preedit() to control
|
||||
* the use of the preedit string. Override this to display feedback by some
|
||||
* other means if turned off.
|
||||
* @set_surrounding: Called via [method@Gtk.IMContext.set_surrounding] in
|
||||
* response to [signal@Gtk.IMContext::retrieve-surrounding] signal to update
|
||||
* the input method’s idea of the context around the cursor. It is not necessary
|
||||
* to override this method even with input methods which implement
|
||||
* context-dependent behavior. The base implementation is sufficient for
|
||||
* [method@Gtk.IMContext.get_surrounding] to work.
|
||||
* @get_surrounding: Called via [method@Gtk.IMContext.get_surrounding] to update
|
||||
* the context around the cursor location. It is not necessary to override this
|
||||
* method even with input methods which implement context-dependent behavior.
|
||||
* The base implementation emits [signal@Gtk.IMContext::retrieve-surrounding]
|
||||
* and records the context received by the subsequent invocation of
|
||||
* [vfunc@Gtk.IMContext.get_surrounding].
|
||||
* @set_surrounding_with_selection: Called via
|
||||
* [method@Gtk.IMContext.set_surrounding_with_selection] in response to the
|
||||
* [signal@Gtk.IMContext::retrieve-surrounding] signal to update the input
|
||||
* @set_surrounding: Called via gtk_im_context_set_surrounding() in response
|
||||
* to signal `GtkIMContext::retrieve-surrounding` to update the input
|
||||
* method’s idea of the context around the cursor. It is not necessary to
|
||||
* override this method even with input methods which implement
|
||||
* context-dependent behavior. The base implementation is sufficient for
|
||||
* [method@Gtk.IMContext.get_surrounding] to work.
|
||||
* @get_surrounding_with_selection: Called via
|
||||
* [method@Gtk.IMContext.get_surrounding_with_selection] to update the
|
||||
* context around the cursor location. It is not necessary to override
|
||||
* gtk_im_context_get_surrounding() to work.
|
||||
* @get_surrounding: Called via gtk_im_context_get_surrounding() to update
|
||||
* the context around the cursor location. It is not necessary to override
|
||||
* this method even with input methods which implement context-dependent
|
||||
* behavior. The base implementation emits
|
||||
* [signal@Gtk.IMContext::retrieve-surrounding] and records the context
|
||||
* received by the subsequent invocation of [vfunc@Gtk.IMContext.get_surrounding].
|
||||
* `GtkIMContext::retrieve-surrounding` and records the context received
|
||||
* by the subsequent invocation of @get_surrounding.
|
||||
* @set_surrounding_with_selection: Called via gtk_im_context_set_surrounding_with_selection()
|
||||
* in response to signal `GtkIMContext::retrieve-surrounding` to update the input
|
||||
* method’s idea of the context around the cursor. It is not necessary to
|
||||
* override this method even with input methods which implement
|
||||
* context-dependent behavior. The base implementation is sufficient for
|
||||
* gtk_im_context_get_surrounding() to work.
|
||||
* @get_surrounding_with_selection: Called via gtk_im_context_get_surrounding_with_selection()
|
||||
* to update the context around the cursor location. It is not necessary to override
|
||||
* this method even with input methods which implement context-dependent
|
||||
* behavior. The base implementation emits
|
||||
* `GtkIMContext::retrieve-surrounding` and records the context received
|
||||
* by the subsequent invocation of @get_surrounding.
|
||||
*/
|
||||
static void
|
||||
gtk_im_context_class_init (GtkIMContextClass *klass)
|
||||
@@ -212,7 +218,6 @@ gtk_im_context_class_init (GtkIMContextClass *klass)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkIMContext::preedit-end:
|
||||
* @context: the object on which the signal is emitted
|
||||
@@ -228,16 +233,14 @@ gtk_im_context_class_init (GtkIMContextClass *klass)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkIMContext::preedit-changed:
|
||||
* @context: the object on which the signal is emitted
|
||||
*
|
||||
* The ::preedit-changed signal is emitted whenever the preedit sequence
|
||||
* currently being entered has changed.
|
||||
*
|
||||
* It is also emitted at the end of a preedit sequence, in which case
|
||||
* [method@Gtk.IMContext.get_preedit_string] returns the empty string.
|
||||
* currently being entered has changed. It is also emitted at the end of
|
||||
* a preedit sequence, in which case
|
||||
* gtk_im_context_get_preedit_string() returns the empty string.
|
||||
*/
|
||||
im_context_signals[PREEDIT_CHANGED] =
|
||||
g_signal_new (I_("preedit-changed"),
|
||||
@@ -247,20 +250,14 @@ gtk_im_context_class_init (GtkIMContextClass *klass)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkIMContext::commit:
|
||||
* @context: the object on which the signal is emitted
|
||||
* @str: the completed character(s) entered by the user
|
||||
*
|
||||
* The ::commit signal is emitted when a complete input sequence
|
||||
* has been entered by the user.
|
||||
*
|
||||
* If the commit comes after a preediting sequence, the
|
||||
* ::commit signal is emitted after ::preedit-end.
|
||||
*
|
||||
* This can be a single character immediately after a key press or
|
||||
* the final result of preediting.
|
||||
* has been entered by the user. This can be a single character
|
||||
* immediately after a key press or the final result of preediting.
|
||||
*/
|
||||
im_context_signals[COMMIT] =
|
||||
g_signal_new (I_("commit"),
|
||||
@@ -271,16 +268,14 @@ gtk_im_context_class_init (GtkIMContextClass *klass)
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
/**
|
||||
* GtkIMContext::retrieve-surrounding:
|
||||
* @context: the object on which the signal is emitted
|
||||
*
|
||||
* The ::retrieve-surrounding signal is emitted when the input method
|
||||
* requires the context surrounding the cursor.
|
||||
*
|
||||
* The callback should set the input method surrounding context by
|
||||
* calling the [method@Gtk.IMContext.set_surrounding] method.
|
||||
* requires the context surrounding the cursor. The callback should set
|
||||
* the input method surrounding context by calling the
|
||||
* gtk_im_context_set_surrounding() method.
|
||||
*
|
||||
* Returns: %TRUE if the signal was handled.
|
||||
*/
|
||||
@@ -295,13 +290,12 @@ gtk_im_context_class_init (GtkIMContextClass *klass)
|
||||
g_signal_set_va_marshaller (im_context_signals[RETRIEVE_SURROUNDING],
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
_gtk_marshal_BOOLEAN__VOIDv);
|
||||
|
||||
/**
|
||||
* GtkIMContext::delete-surrounding:
|
||||
* @context: the object on which the signal is emitted
|
||||
* @offset: the character offset from the cursor position of the text
|
||||
* to be deleted. A negative value indicates a position before
|
||||
* the cursor.
|
||||
* @offset: the character offset from the cursor position of the text
|
||||
* to be deleted. A negative value indicates a position before
|
||||
* the cursor.
|
||||
* @n_chars: the number of characters to be deleted
|
||||
*
|
||||
* The ::delete-surrounding signal is emitted when the input method
|
||||
@@ -323,14 +317,6 @@ gtk_im_context_class_init (GtkIMContextClass *klass)
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
_gtk_marshal_BOOLEAN__INT_INTv);
|
||||
|
||||
/**
|
||||
* GtkIMContext:input-purpose:
|
||||
*
|
||||
* The purpose of the text field that the `GtkIMContext is connected to.
|
||||
*
|
||||
* This property can be used by on-screen keyboards and other input
|
||||
* methods to adjust their behaviour.
|
||||
*/
|
||||
properties[PROP_INPUT_PURPOSE] =
|
||||
g_param_spec_enum ("input-purpose",
|
||||
P_("Purpose"),
|
||||
@@ -339,12 +325,6 @@ gtk_im_context_class_init (GtkIMContextClass *klass)
|
||||
GTK_INPUT_PURPOSE_FREE_FORM,
|
||||
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkIMContext:input-hints:
|
||||
*
|
||||
* Additional hints that allow input methods to fine-tune
|
||||
* their behaviour.
|
||||
*/
|
||||
properties[PROP_INPUT_HINTS] =
|
||||
g_param_spec_flags ("input-hints",
|
||||
P_("hints"),
|
||||
@@ -485,9 +465,9 @@ gtk_im_context_set_client_widget (GtkIMContext *context,
|
||||
* string. The string retrieved must be freed with g_free().
|
||||
* @attrs: (out) (transfer full): location to store the retrieved
|
||||
* attribute list. When you are done with this list, you
|
||||
* must unreference it with [method@Pango.AttrList.unref].
|
||||
* @cursor_pos: (out): location to store position of cursor
|
||||
* (in characters) within the preedit string.
|
||||
* must unreference it with pango_attr_list_unref().
|
||||
* @cursor_pos: (out): location to store position of cursor (in characters)
|
||||
* within the preedit string.
|
||||
*
|
||||
* Retrieve the current preedit string for the input context,
|
||||
* and a list of attributes to apply to the string.
|
||||
@@ -547,7 +527,7 @@ gtk_im_context_filter_keypress (GtkIMContext *context,
|
||||
* @group: the active keyboard group for the event
|
||||
*
|
||||
* Allow an input method to forward key press and release events
|
||||
* to another input method without necessarily having a `GdkEvent`
|
||||
* to another input methodm without necessarily having a `GdkEvent`
|
||||
* available.
|
||||
*
|
||||
* Returns: %TRUE if the input method handled the key event.
|
||||
@@ -693,7 +673,7 @@ gtk_im_context_reset (GtkIMContext *context)
|
||||
* Notify the input method that a change in cursor
|
||||
* position has been made.
|
||||
*
|
||||
* The location is relative to the client widget.
|
||||
* The location is relative to the client window.
|
||||
*/
|
||||
void
|
||||
gtk_im_context_set_cursor_location (GtkIMContext *context,
|
||||
@@ -770,8 +750,8 @@ gtk_im_context_set_surrounding (GtkIMContext *context,
|
||||
*
|
||||
* Sets surrounding context around the insertion point and preedit
|
||||
* string. This function is expected to be called in response to the
|
||||
* [signal@Gtk.IMContext::retrieve_surrounding] signal, and will likely
|
||||
* have no effect if called at other times.
|
||||
* GtkIMContext::retrieve_surrounding signal, and will likely have no
|
||||
* effect if called at other times.
|
||||
*
|
||||
* Since: 4.2
|
||||
*/
|
||||
@@ -922,24 +902,24 @@ gtk_im_context_get_surrounding_with_selection (GtkIMContext *context,
|
||||
*
|
||||
* Asks the widget that the input context is attached to delete
|
||||
* characters around the cursor position by emitting the
|
||||
* `::delete_surrounding` signal.
|
||||
* GtkIMContext::delete_surrounding signal.
|
||||
*
|
||||
* Note that @offset and @n_chars are in characters not in bytes
|
||||
* which differs from the usage other places in `GtkIMContext`.
|
||||
*
|
||||
* In order to use this function, you should first call
|
||||
* [method@Gtk.IMContext.get_surrounding] to get the current context,
|
||||
* and call this function immediately afterwards to make sure that you
|
||||
* gtk_im_context_get_surrounding() to get the current context, and
|
||||
* call this function immediately afterwards to make sure that you
|
||||
* know what you are deleting. You should also account for the fact
|
||||
* that even if the signal was handled, the input context might not
|
||||
* have deleted all the characters that were requested to be deleted.
|
||||
*
|
||||
* This function is used by an input method that wants to make
|
||||
* subsitutions in the existing text in response to new input.
|
||||
* It is not useful for applications.
|
||||
*
|
||||
* subsitutions in the existing text in response to new input. It is
|
||||
* not useful for applications.
|
||||
*
|
||||
* Returns: %TRUE if the signal was handled.
|
||||
*/
|
||||
**/
|
||||
gboolean
|
||||
gtk_im_context_delete_surrounding (GtkIMContext *context,
|
||||
int offset,
|
||||
|
||||
+59
-77
@@ -79,7 +79,7 @@
|
||||
|
||||
struct _GtkIMContextSimplePrivate
|
||||
{
|
||||
guint *compose_buffer;
|
||||
guint16 *compose_buffer;
|
||||
int compose_buffer_len;
|
||||
GString *tentative_match;
|
||||
int tentative_match_len;
|
||||
@@ -118,7 +118,7 @@ init_builtin_table (void)
|
||||
G_LOCK_DEFINE_STATIC (global_tables);
|
||||
static GSList *global_tables;
|
||||
|
||||
static const guint gtk_compose_ignore[] = {
|
||||
static const guint16 gtk_compose_ignore[] = {
|
||||
0, /* Yes, XKB will send us key press events with NoSymbol :( */
|
||||
GDK_KEY_Overlay1_Enable,
|
||||
GDK_KEY_Overlay2_Enable,
|
||||
@@ -384,7 +384,7 @@ gtk_im_context_simple_init (GtkIMContextSimple *context_simple)
|
||||
priv = context_simple->priv = gtk_im_context_simple_get_instance_private (context_simple);
|
||||
|
||||
priv->compose_buffer_len = builtin_compose_table.max_seq_len + 1;
|
||||
priv->compose_buffer = g_new0 (guint, priv->compose_buffer_len);
|
||||
priv->compose_buffer = g_new0 (guint16, priv->compose_buffer_len);
|
||||
priv->tentative_match = g_string_new ("");
|
||||
priv->tentative_match_len = 0;
|
||||
}
|
||||
@@ -544,22 +544,18 @@ is_dead_key (guint keysym)
|
||||
return GDK_KEY_dead_grave <= keysym && keysym <= GDK_KEY_dead_greek;
|
||||
}
|
||||
|
||||
static void
|
||||
append_dead_key (GString *string,
|
||||
guint keysym)
|
||||
static gunichar
|
||||
dead_key_to_unicode (guint keysym,
|
||||
gboolean *need_space)
|
||||
{
|
||||
/* Sadly, not all the dead keysyms have spacing mark equivalents
|
||||
* in Unicode. For those that don't, we use NBSP + the non-spacing
|
||||
* mark as an approximation.
|
||||
* in Unicode. For those that don't, we use space + the non-spacing
|
||||
* mark as an approximation
|
||||
*/
|
||||
switch (keysym)
|
||||
{
|
||||
#define CASE(keysym, unicode, sp) \
|
||||
case GDK_KEY_dead_##keysym: \
|
||||
if (sp) \
|
||||
g_string_append_unichar (string, 0xA0); \
|
||||
g_string_append_unichar (string, unicode); \
|
||||
break;
|
||||
#define CASE(keysym, unicode, sp) \
|
||||
case GDK_KEY_dead_##keysym: *need_space = sp; return unicode;
|
||||
|
||||
CASE (grave, 0x60, 0);
|
||||
CASE (acute, 0xb4, 0);
|
||||
@@ -610,7 +606,8 @@ append_dead_key (GString *string,
|
||||
CASE (capital_schwa, 0x1dea, 1);
|
||||
#undef CASE
|
||||
default:
|
||||
g_string_append_unichar (string, gdk_keyval_to_unicode (keysym));
|
||||
*need_space = FALSE;
|
||||
return gdk_keyval_to_unicode (keysym);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,7 +622,7 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
|
||||
guint keyval;
|
||||
|
||||
context = GTK_IM_CONTEXT (context_simple);
|
||||
|
||||
|
||||
priv->in_compose_sequence = FALSE;
|
||||
|
||||
/* No compose sequences found, check first if we have a partial
|
||||
@@ -635,12 +632,12 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
|
||||
{
|
||||
int len = priv->tentative_match_len;
|
||||
int i;
|
||||
guint *compose_buffer;
|
||||
guint16 *compose_buffer;
|
||||
char *str;
|
||||
|
||||
compose_buffer = alloca (sizeof (guint) * priv->compose_buffer_len);
|
||||
compose_buffer = alloca (sizeof (guint16) * priv->compose_buffer_len);
|
||||
|
||||
memcpy (compose_buffer, priv->compose_buffer, sizeof (guint) * priv->compose_buffer_len);
|
||||
memcpy (compose_buffer, priv->compose_buffer, sizeof (guint16) * priv->compose_buffer_len);
|
||||
|
||||
str = g_strdup (priv->tentative_match->str);
|
||||
gtk_im_context_simple_commit_string (context_simple, str);
|
||||
@@ -678,6 +675,7 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
|
||||
|
||||
if (n_compose > 1 && i >= n_compose - 1)
|
||||
{
|
||||
gboolean need_space;
|
||||
GString *s;
|
||||
|
||||
s = g_string_new ("");
|
||||
@@ -686,7 +684,15 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
|
||||
{
|
||||
/* dead keys are never *really* dead */
|
||||
for (int j = 0; j < i; j++)
|
||||
append_dead_key (s, priv->compose_buffer[j]);
|
||||
{
|
||||
ch = dead_key_to_unicode (priv->compose_buffer[j], &need_space);
|
||||
if (ch)
|
||||
{
|
||||
if (need_space)
|
||||
g_string_append_c (s, ' ');
|
||||
g_string_append_unichar (s, ch);
|
||||
}
|
||||
}
|
||||
|
||||
ch = gdk_keyval_to_unicode (priv->compose_buffer[i]);
|
||||
if (ch != 0 && ch != ' ' && !g_unichar_iscntrl (ch))
|
||||
@@ -696,7 +702,14 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
|
||||
}
|
||||
else
|
||||
{
|
||||
append_dead_key (s, priv->compose_buffer[0]);
|
||||
ch = dead_key_to_unicode (priv->compose_buffer[0], &need_space);
|
||||
if (ch)
|
||||
{
|
||||
if (need_space)
|
||||
g_string_append_c (s, ' ');
|
||||
g_string_append_unichar (s, ch);
|
||||
}
|
||||
|
||||
gtk_im_context_simple_commit_string (context_simple, s->str);
|
||||
|
||||
for (i = 1; i < n_compose; i++)
|
||||
@@ -808,6 +821,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
int i;
|
||||
gboolean compose_finish;
|
||||
gboolean compose_match;
|
||||
gunichar output_char;
|
||||
guint keyval, state;
|
||||
|
||||
while (priv->compose_buffer[n_compose] != 0 && n_compose < priv->compose_buffer_len)
|
||||
@@ -987,22 +1001,16 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (is_escape)
|
||||
{
|
||||
if (priv->in_hex_sequence || priv->in_compose_sequence)
|
||||
{
|
||||
gtk_im_context_simple_reset (context);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (priv->in_hex_sequence)
|
||||
{
|
||||
if (hex_keyval && n_compose < 6)
|
||||
priv->compose_buffer[n_compose++] = hex_keyval;
|
||||
else if (is_escape)
|
||||
{
|
||||
gtk_im_context_simple_reset (context);
|
||||
return TRUE;
|
||||
}
|
||||
else if (!is_hex_end)
|
||||
{
|
||||
/* non-hex character in hex sequence, or sequence too long */
|
||||
@@ -1015,7 +1023,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
if (n_compose + 1 == priv->compose_buffer_len)
|
||||
{
|
||||
priv->compose_buffer_len += 1;
|
||||
priv->compose_buffer = g_renew (guint, priv->compose_buffer, priv->compose_buffer_len);
|
||||
priv->compose_buffer = g_renew (guint16, priv->compose_buffer, priv->compose_buffer_len);
|
||||
}
|
||||
|
||||
priv->compose_buffer[n_compose++] = keyval;
|
||||
@@ -1063,7 +1071,6 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
else /* Then, check for compose sequences */
|
||||
{
|
||||
gboolean success = FALSE;
|
||||
int prefix = 0;
|
||||
GString *output;
|
||||
|
||||
output = g_string_new ("");
|
||||
@@ -1102,29 +1109,18 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
success = TRUE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
int table_prefix;
|
||||
|
||||
gtk_compose_table_get_prefix ((GtkComposeTable *)tmp_list->data,
|
||||
priv->compose_buffer, n_compose,
|
||||
&table_prefix);
|
||||
|
||||
prefix = MAX (prefix, table_prefix);
|
||||
}
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
G_UNLOCK (global_tables);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_string_free (output, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
g_string_free (output, TRUE);
|
||||
|
||||
if (gtk_check_algorithmically (priv->compose_buffer, n_compose, output))
|
||||
if (success)
|
||||
return TRUE;
|
||||
|
||||
if (gtk_check_algorithmically (priv->compose_buffer, n_compose, &output_char))
|
||||
{
|
||||
if (!priv->in_compose_sequence)
|
||||
{
|
||||
@@ -1132,30 +1128,11 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
g_signal_emit_by_name (context_simple, "preedit-start");
|
||||
}
|
||||
|
||||
if (output->len > 0)
|
||||
gtk_im_context_simple_commit_string (context_simple, output->str);
|
||||
if (output_char)
|
||||
gtk_im_context_simple_commit_char (context_simple, output_char);
|
||||
else
|
||||
g_signal_emit_by_name (context_simple, "preedit-changed");
|
||||
|
||||
g_string_free (output, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_string_free (output, TRUE);
|
||||
|
||||
/* If we get here, no Compose sequence matched.
|
||||
* Only beep if we were in a sequence before.
|
||||
*/
|
||||
if (prefix > 0)
|
||||
{
|
||||
for (i = prefix; i < n_compose; i++)
|
||||
priv->compose_buffer[i] = 0;
|
||||
|
||||
beep_surface (gdk_event_get_surface (event));
|
||||
|
||||
g_signal_emit_by_name (context_simple, "preedit-changed");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1218,23 +1195,28 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext *context,
|
||||
if (priv->compose_buffer[i] == GDK_KEY_Multi_key)
|
||||
{
|
||||
/* We only show the Compose key visibly when it is the
|
||||
* only glyph in the preedit, or when the sequence contains
|
||||
* multiple Compose keys, or when it occurs in the
|
||||
* only glyph in the preedit, or when it occurs in the
|
||||
* middle of the sequence. Sadly, the official character,
|
||||
* U+2384, COMPOSITION SYMBOL, is bit too distracting, so
|
||||
* we use U+00B7, MIDDLE DOT.
|
||||
*/
|
||||
if (priv->compose_buffer[1] == 0 || i > 0 ||
|
||||
priv->compose_buffer[i + 1] == GDK_KEY_Multi_key)
|
||||
if (priv->compose_buffer[1] == 0 || i > 0)
|
||||
g_string_append (s, "·");
|
||||
}
|
||||
else
|
||||
{
|
||||
gunichar ch;
|
||||
gboolean need_space;
|
||||
|
||||
if (is_dead_key (priv->compose_buffer[i]))
|
||||
{
|
||||
append_dead_key (s, priv->compose_buffer[i]);
|
||||
ch = dead_key_to_unicode (priv->compose_buffer[i], &need_space);
|
||||
if (ch)
|
||||
{
|
||||
if (need_space)
|
||||
g_string_append_c (s, ' ');
|
||||
g_string_append_unichar (s, ch);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
/**
|
||||
* GtkIMMulticontext:
|
||||
*
|
||||
* `GtkIMMulticontext` is an input method context supporting multiple,
|
||||
* switchable input methods.
|
||||
* `GtkIMMulticontext` is input method supporting multiple, switchable input
|
||||
* methods.
|
||||
*
|
||||
* Text widgets such as `GtkText` or `GtkTextView` use a `GtkIMMultiContext`
|
||||
* to implement their `im-module` property for switching between different
|
||||
@@ -587,16 +587,12 @@ gtk_im_multicontext_get_context_id (GtkIMMulticontext *context)
|
||||
/**
|
||||
* gtk_im_multicontext_set_context_id:
|
||||
* @context: a `GtkIMMulticontext`
|
||||
* @context_id: (nullable): the id to use
|
||||
* @context_id: the id to use
|
||||
*
|
||||
* Sets the context id for @context.
|
||||
*
|
||||
* This causes the currently active delegate of @context to be
|
||||
* replaced by the delegate corresponding to the new context id.
|
||||
*
|
||||
* Setting this to a non-%NULL value overrides the system-wide
|
||||
* IM module setting. See the [property@Gtk.Settings:gtk-im-module]
|
||||
* property.
|
||||
*/
|
||||
void
|
||||
gtk_im_multicontext_set_context_id (GtkIMMulticontext *context,
|
||||
|
||||
+4
-5
@@ -106,16 +106,15 @@
|
||||
*
|
||||
* # GtkInfoBar as GtkBuildable
|
||||
*
|
||||
* The `GtkInfoBar` implementation of the `GtkBuildable` interface exposes
|
||||
* the content area and action area as internal children with the names
|
||||
* “content_area” and “action_area”.
|
||||
*
|
||||
* `GtkInfoBar` supports a custom <action-widgets> element, which can contain
|
||||
* multiple <action-widget> elements. The “response” attribute specifies a
|
||||
* numeric response, and the content of the element is the id of widget
|
||||
* (which should be a child of the dialogs @action_area).
|
||||
*
|
||||
* `GtkInfoBar` supports adding action widgets by specifying “action” as
|
||||
* the “type” attribute of a `<child>` element. The widget will be added
|
||||
* either to the action area. The response id has to be associated
|
||||
* with the action widget using the `<action-widgets>` element.
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* `GtkInfoBar` has a single CSS node with name infobar. The node may get
|
||||
|
||||
+1
-1
@@ -3187,7 +3187,7 @@ strip_ulines (const char *text,
|
||||
}
|
||||
|
||||
*q = *p;
|
||||
if (after_uline && *p != '_' && *accel_key == 0)
|
||||
if (after_uline && *accel_key == 0)
|
||||
*accel_key = g_utf8_get_char (p);
|
||||
|
||||
q++;
|
||||
|
||||
+5
-5
@@ -1433,14 +1433,14 @@ gtk_list_store_clear (GtkListStore *list_store)
|
||||
|
||||
/**
|
||||
* gtk_list_store_iter_is_valid:
|
||||
* @list_store: a list store
|
||||
* @iter: the iterator to check
|
||||
* @list_store: A `GtkListStore`.
|
||||
* @iter: A `GtkTreeIter`
|
||||
*
|
||||
* > This function is slow. Only use it for debugging and/or testing
|
||||
* > purposes.
|
||||
*
|
||||
* Checks if the given iter is a valid iter for this `GtkListStore`.
|
||||
*
|
||||
* This function is slow. Only use it for debugging and/or testing
|
||||
* purposes.
|
||||
*
|
||||
* Returns: %TRUE if the iter is valid, %FALSE if the iter is invalid.
|
||||
**/
|
||||
gboolean
|
||||
|
||||
+1
-1
@@ -868,7 +868,7 @@ gtk_main_sync (void)
|
||||
|
||||
store.store_loop = g_main_loop_new (NULL, TRUE);
|
||||
store.timeout_id = g_timeout_add_seconds (10, (GSourceFunc) sync_timed_out_cb, &store);
|
||||
gdk_source_set_static_name_by_id (store.timeout_id, "[gtk] gtk_main_sync clipboard store timeout");
|
||||
g_source_set_name_by_id (store.timeout_id, "[gtk] gtk_main_sync clipboard store timeout");
|
||||
|
||||
if (g_main_loop_is_running (store.store_loop))
|
||||
g_main_loop_run (store.store_loop);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user