[gtk+] immulticontext: Always check if the global context id changed



commit a0f155e83938f6c3e63c312107dee2a970c2eb15
Author: Rui Matos <tiagomatos gmail com>
Date:   Sun Apr 29 02:44:23 2012 +0200

    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

 gtk/gtkimmulticontext.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index 2b887b9..8ff04da 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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]