diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2017-04-01 23:25:13 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2017-05-25 16:25:58 +0200 |
commit | d39afa60118f6e7a5cc2305c0f7bcfcf9ab955ee (patch) | |
tree | 192398294447efc44c076c85354b14cc7af0541e /gtk | |
parent | 5836beee78fc3acf7a48ec01ab1dda72eac2bfc0 (diff) | |
download | gtk+-d39afa60118f6e7a5cc2305c0f7bcfcf9ab955ee.tar.gz |
imcontext: Remove API dependency on GdkWindow
There is now a set_client_widget() to hint the IM about positioning
and whatnot.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkentry.c | 4 | ||||
-rw-r--r-- | gtk/gtkimcontext.c | 18 | ||||
-rw-r--r-- | gtk/gtkimcontext.h | 10 | ||||
-rw-r--r-- | gtk/gtkimcontextsimple.c | 16 | ||||
-rw-r--r-- | gtk/gtkimmulticontext.c | 24 | ||||
-rw-r--r-- | gtk/gtktextview.c | 6 |
6 files changed, 39 insertions, 39 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index dded3b8f0e..fcfce25e85 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3109,7 +3109,7 @@ gtk_entry_realize (GtkWidget *widget) gtk_widget_register_window (widget, priv->text_area); - gtk_im_context_set_client_window (priv->im_context, priv->text_area); + gtk_im_context_set_client_widget (priv->im_context, widget); gtk_entry_adjust_scroll (entry); gtk_entry_update_primary_selection (entry); @@ -3139,7 +3139,7 @@ gtk_entry_unrealize (GtkWidget *widget) gtk_entry_reset_layout (entry); - gtk_im_context_set_client_window (priv->im_context, NULL); + gtk_im_context_set_client_widget (priv->im_context, NULL); clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY); if (gtk_clipboard_get_owner (clipboard) == G_OBJECT (entry)) diff --git a/gtk/gtkimcontext.c b/gtk/gtkimcontext.c index 5ca199f1d1..1cffd09d41 100644 --- a/gtk/gtkimcontext.c +++ b/gtk/gtkimcontext.c @@ -159,7 +159,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkIMContext, gtk_im_context, G_TYPE_OBJECT * #GtkIMContext::retrieve-surrounding signal. * @delete_surrounding: Default handler of the * #GtkIMContext::delete-surrounding signal. - * @set_client_window: Called via gtk_im_context_set_client_window() when the + * @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. @@ -437,27 +437,27 @@ gtk_im_context_real_get_surrounding (GtkIMContext *context, } /** - * gtk_im_context_set_client_window: + * gtk_im_context_set_client_widget: * @context: a #GtkIMContext - * @window: (allow-none): the client window. This may be %NULL to indicate - * that the previous client window no longer exists. + * @widget: (allow-none): the client widget. This may be %NULL to indicate + * that the previous client widget no longer exists. * * Set the client window for the input context; this is the - * #GdkWindow in which the input appears. This window is + * #GtkWidget holding the input focus. This widget is * used in order to correctly position status windows, and may * also be used for purposes internal to the input method. **/ void -gtk_im_context_set_client_window (GtkIMContext *context, - GdkWindow *window) +gtk_im_context_set_client_widget (GtkIMContext *context, + GtkWidget *widget) { GtkIMContextClass *klass; g_return_if_fail (GTK_IS_IM_CONTEXT (context)); klass = GTK_IM_CONTEXT_GET_CLASS (context); - if (klass->set_client_window) - klass->set_client_window (context, window); + if (klass->set_client_widget) + klass->set_client_widget (context, widget); } /** diff --git a/gtk/gtkimcontext.h b/gtk/gtkimcontext.h index d1acc639c4..3d77266975 100644 --- a/gtk/gtkimcontext.h +++ b/gtk/gtkimcontext.h @@ -23,7 +23,7 @@ #error "Only <gtk/gtk.h> can be included directly." #endif -#include <gdk/gdk.h> +#include <gtk/gtkwidget.h> G_BEGIN_DECLS @@ -61,8 +61,8 @@ struct _GtkIMContextClass gint n_chars); /* Virtual functions */ - void (*set_client_window) (GtkIMContext *context, - GdkWindow *window); + void (*set_client_widget) (GtkIMContext *context, + GtkWidget *widget); void (*get_preedit_string) (GtkIMContext *context, gchar **str, PangoAttrList **attrs, @@ -97,8 +97,8 @@ GDK_AVAILABLE_IN_ALL GType gtk_im_context_get_type (void) G_GNUC_CONST; GDK_AVAILABLE_IN_ALL -void gtk_im_context_set_client_window (GtkIMContext *context, - GdkWindow *window); +void gtk_im_context_set_client_widget (GtkIMContext *context, + GtkWidget *widget); GDK_AVAILABLE_IN_ALL void gtk_im_context_get_preedit_string (GtkIMContext *context, gchar **str, diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c index a4b4a50d87..5404f0a1ef 100644 --- a/gtk/gtkimcontextsimple.c +++ b/gtk/gtkimcontextsimple.c @@ -117,8 +117,8 @@ static void gtk_im_context_simple_get_preedit_string (GtkIMContext gchar **str, PangoAttrList **attrs, gint *cursor_pos); -static void gtk_im_context_simple_set_client_window (GtkIMContext *context, - GdkWindow *window); +static void gtk_im_context_simple_set_client_widget (GtkIMContext *context, + GtkWidget *widget); G_DEFINE_TYPE_WITH_PRIVATE (GtkIMContextSimple, gtk_im_context_simple, GTK_TYPE_IM_CONTEXT) @@ -131,7 +131,7 @@ gtk_im_context_simple_class_init (GtkIMContextSimpleClass *class) im_context_class->filter_keypress = gtk_im_context_simple_filter_keypress; im_context_class->reset = gtk_im_context_simple_reset; im_context_class->get_preedit_string = gtk_im_context_simple_get_preedit_string; - im_context_class->set_client_window = gtk_im_context_simple_set_client_window; + im_context_class->set_client_widget = gtk_im_context_simple_set_client_widget; gobject_class->finalize = gtk_im_context_simple_finalize; } @@ -1390,22 +1390,22 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext *context, } static void -gtk_im_context_simple_set_client_window (GtkIMContext *context, - GdkWindow *window) +gtk_im_context_simple_set_client_widget (GtkIMContext *context, + GtkWidget *widget) { GtkIMContextSimple *im_context_simple = GTK_IM_CONTEXT_SIMPLE (context); gboolean run_compose_table = FALSE; - if (!window) + if (!widget) return; /* Load compose table for X11 or Wayland. */ #ifdef GDK_WINDOWING_X11 - if (GDK_IS_X11_DISPLAY (gdk_window_get_display (window))) + if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (widget))) run_compose_table = TRUE; #endif #ifdef GDK_WINDOWING_WAYLAND - if (GDK_IS_WAYLAND_DISPLAY (gdk_window_get_display (window))) + if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget))) run_compose_table = TRUE; #endif diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c index 32503a3c70..978f32f4ab 100644 --- a/gtk/gtkimmulticontext.c +++ b/gtk/gtkimmulticontext.c @@ -42,7 +42,7 @@ struct _GtkIMMulticontextPrivate { GtkIMContext *slave; - GdkWindow *client_window; + GtkWidget *client_widget; GdkRectangle cursor_location; gchar *context_id; @@ -61,8 +61,8 @@ static void gtk_im_multicontext_set_slave (GtkIMMulticontext GtkIMContext *slave, gboolean finalizing); -static void gtk_im_multicontext_set_client_window (GtkIMContext *context, - GdkWindow *window); +static void gtk_im_multicontext_set_client_widget (GtkIMContext *context, + GtkWidget *widget); static void gtk_im_multicontext_get_preedit_string (GtkIMContext *context, gchar **str, PangoAttrList **attrs, @@ -114,7 +114,7 @@ gtk_im_multicontext_class_init (GtkIMMulticontextClass *class) gobject_class->notify = gtk_im_multicontext_notify; - im_context_class->set_client_window = gtk_im_multicontext_set_client_window; + im_context_class->set_client_widget = gtk_im_multicontext_set_client_widget; im_context_class->get_preedit_string = gtk_im_multicontext_get_preedit_string; im_context_class->filter_keypress = gtk_im_multicontext_filter_keypress; im_context_class->focus_in = gtk_im_multicontext_focus_in; @@ -230,8 +230,8 @@ gtk_im_multicontext_set_slave (GtkIMMulticontext *multicontext, if (!priv->use_preedit) /* Default is TRUE */ gtk_im_context_set_use_preedit (slave, FALSE); - if (priv->client_window) - gtk_im_context_set_client_window (slave, priv->client_window); + if (priv->client_widget) + gtk_im_context_set_client_widget (slave, priv->client_widget); if (priv->have_cursor_location) gtk_im_context_set_cursor_location (slave, &priv->cursor_location); if (priv->focus_in) @@ -292,8 +292,8 @@ im_module_setting_changed (GtkSettings *settings, static void -gtk_im_multicontext_set_client_window (GtkIMContext *context, - GdkWindow *window) +gtk_im_multicontext_set_client_widget (GtkIMContext *context, + GtkWidget *widget) { GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context); GtkIMMulticontextPrivate *priv = multicontext->priv; @@ -302,11 +302,11 @@ gtk_im_multicontext_set_client_window (GtkIMContext *context, GtkSettings *settings; gboolean connected; - priv->client_window = window; + priv->client_widget = widget; - if (window) + if (widget) { - screen = gdk_window_get_screen (window); + screen = gtk_widget_get_screen (widget); settings = gtk_settings_get_for_screen (screen); connected = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (settings), @@ -324,7 +324,7 @@ gtk_im_multicontext_set_client_window (GtkIMContext *context, slave = gtk_im_multicontext_get_slave (multicontext); if (slave) - gtk_im_context_set_client_window (slave, window); + gtk_im_context_set_client_widget (slave, widget); } static void diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 300e68d04c..a0f1ca1832 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -9808,8 +9808,8 @@ text_window_realize (GtkTextWindow *win, g_clear_object (&cursor); } - gtk_im_context_set_client_window (GTK_TEXT_VIEW (widget)->priv->im_context, - win->window); + gtk_im_context_set_client_widget (GTK_TEXT_VIEW (widget)->priv->im_context, + widget); break; default: break; @@ -9829,7 +9829,7 @@ text_window_unrealize (GtkTextWindow *win) { if (win->type == GTK_TEXT_WINDOW_TEXT) { - gtk_im_context_set_client_window (GTK_TEXT_VIEW (win->widget)->priv->im_context, + gtk_im_context_set_client_widget (GTK_TEXT_VIEW (win->widget)->priv->im_context, NULL); } |