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 /modules/input | |
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 'modules/input')
-rw-r--r-- | modules/input/gtkimcontextxim.c | 13 | ||||
-rw-r--r-- | modules/input/imbroadway.c | 16 |
2 files changed, 15 insertions, 14 deletions
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c index 886e2e68d6..58bd3a822d 100644 --- a/modules/input/gtkimcontextxim.c +++ b/modules/input/gtkimcontextxim.c @@ -106,8 +106,8 @@ struct _StatusWindow static void gtk_im_context_xim_class_init (GtkIMContextXIMClass *class); static void gtk_im_context_xim_init (GtkIMContextXIM *im_context_xim); static void gtk_im_context_xim_finalize (GObject *obj); -static void gtk_im_context_xim_set_client_window (GtkIMContext *context, - GdkWindow *client_window); +static void gtk_im_context_xim_set_client_widget (GtkIMContext *context, + GtkWidget *widget); static gboolean gtk_im_context_xim_filter_keypress (GtkIMContext *context, GdkEventKey *key); static void gtk_im_context_xim_reset (GtkIMContext *context); @@ -478,7 +478,7 @@ gtk_im_context_xim_class_init (GtkIMContextXIMClass *class) parent_class = g_type_class_peek_parent (class); - im_context_class->set_client_window = gtk_im_context_xim_set_client_window; + im_context_class->set_client_widget = gtk_im_context_xim_set_client_widget; im_context_class->filter_keypress = gtk_im_context_xim_filter_keypress; im_context_class->reset = gtk_im_context_xim_reset; im_context_class->get_preedit_string = gtk_im_context_xim_get_preedit_string; @@ -596,12 +596,13 @@ set_ic_client_window (GtkIMContextXIM *context_xim, } static void -gtk_im_context_xim_set_client_window (GtkIMContext *context, - GdkWindow *client_window) +gtk_im_context_xim_set_client_widget (GtkIMContext *context, + GtkWidget *widget) { GtkIMContextXIM *context_xim = GTK_IM_CONTEXT_XIM (context); + GtkWidget *toplevel = gtk_widget_get_toplevel (widget); - set_ic_client_window (context_xim, client_window); + set_ic_client_window (context_xim, gtk_widget_get_window (toplevel)); } GtkIMContext * diff --git a/modules/input/imbroadway.c b/modules/input/imbroadway.c index 140aa0e8c6..6a15999428 100644 --- a/modules/input/imbroadway.c +++ b/modules/input/imbroadway.c @@ -34,7 +34,7 @@ typedef struct _GtkIMContextBroadway { GtkIMContextSimple parent; - GdkWindow *client_window; + GtkWidget *client_widget; } GtkIMContextBroadway; typedef struct _GtkIMContextBroadwayClass @@ -66,11 +66,11 @@ static const GtkIMContextInfo *info_list[] = #endif static void -broadway_set_client_window (GtkIMContext *context, GdkWindow *window) +broadway_set_client_widget (GtkIMContext *context, GtkWidget *widget) { GtkIMContextBroadway *bw = GTK_IM_CONTEXT_BROADWAY (context); - bw->client_window = window; + bw->client_widget = widget; } static void @@ -79,9 +79,9 @@ broadway_focus_in (GtkIMContext *context) GtkIMContextBroadway *bw = GTK_IM_CONTEXT_BROADWAY (context); GdkDisplay *display; - if (bw->client_window) + if (bw->client_widget) { - display = gdk_window_get_display (bw->client_window); + display = gtk_widget_get_display (bw->client_widget); gdk_broadway_display_show_keyboard (GDK_BROADWAY_DISPLAY (display)); } } @@ -92,9 +92,9 @@ broadway_focus_out (GtkIMContext *context) GtkIMContextBroadway *bw = GTK_IM_CONTEXT_BROADWAY (context); GdkDisplay *display; - if (bw->client_window) + if (bw->client_widget) { - display = gdk_window_get_display (bw->client_window); + display = gtk_widget_get_display (bw->client_widget); gdk_broadway_display_hide_keyboard (GDK_BROADWAY_DISPLAY (display)); } } @@ -106,7 +106,7 @@ gtk_im_context_broadway_class_init (GtkIMContextClass *klass) klass->focus_in = broadway_focus_in; klass->focus_out = broadway_focus_out; - klass->set_client_window = broadway_set_client_window; + klass->set_client_widget = broadway_set_client_widget; } static void |