summaryrefslogtreecommitdiff
path: root/gtk/gtkimmulticontext.c
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2012-04-29 02:44:23 +0200
committerRui Matos <tiagomatos@gmail.com>2012-05-08 00:35:30 +0200
commita0f155e83938f6c3e63c312107dee2a970c2eb15 (patch)
treee990e2d4aa2686d077211b39ac0b69c18a2dfe24 /gtk/gtkimmulticontext.c
parenta4d76439e6d99630319cf5c87633887fb6e9c08f (diff)
downloadgtk+-a0f155e83938f6c3e63c312107dee2a970c2eb15.tar.gz
immulticontext: Always check if the global context id changed
This makes sure that if the gtk-im-module setting changes we update our internal state immediately on the next event whichever it is. In particular this fixes the case of the gtk-im-module setting changing while the user is typing and the slave context remaining the same, effectively ignoring the setting change. https://bugzilla.gnome.org/show_bug.cgi?id=675365
Diffstat (limited to 'gtk/gtkimmulticontext.c')
-rw-r--r--gtk/gtkimmulticontext.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index 2b887b9607..8ff04da6ef 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -257,6 +257,9 @@ gtk_im_multicontext_get_slave (GtkIMMulticontext *multicontext)
{
GtkIMMulticontextPrivate *priv = multicontext->priv;
+ if (g_strcmp0 (priv->context_id, get_effective_context_id (multicontext)) != 0)
+ gtk_im_multicontext_set_slave (multicontext, NULL, FALSE);
+
if (!priv->slave)
{
GtkIMContext *slave;
@@ -290,7 +293,8 @@ gtk_im_multicontext_set_client_window (GtkIMContext *context,
{
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
GtkIMMulticontextPrivate *priv = multicontext->priv;
- GdkScreen *screen;
+ GtkIMContext *slave;
+ GdkScreen *screen;
GtkSettings *settings;
gboolean connected;
@@ -314,11 +318,9 @@ gtk_im_multicontext_set_client_window (GtkIMContext *context,
}
}
- if (g_strcmp0 (priv->context_id, get_effective_context_id (multicontext)) != 0)
- gtk_im_multicontext_set_slave (multicontext, NULL, FALSE);
-
- if (priv->slave)
- gtk_im_context_set_client_window (priv->slave, window);
+ slave = gtk_im_multicontext_get_slave (multicontext);
+ if (slave)
+ gtk_im_context_set_client_window (slave, window);
}
static void
@@ -392,12 +394,7 @@ gtk_im_multicontext_focus_in (GtkIMContext *context)
{
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
GtkIMMulticontextPrivate *priv = multicontext->priv;
- GtkIMContext *slave;
-
- if (g_strcmp0 (priv->context_id, get_effective_context_id (multicontext)) != 0)
- gtk_im_multicontext_set_slave (multicontext, NULL, FALSE);
-
- slave = gtk_im_multicontext_get_slave (multicontext);
+ GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
priv->focus_in = TRUE;