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.

Backport of a0f155e839.

https://bugzilla.gnome.org/show_bug.cgi?id=675365
This commit is contained in:
Matthias Clasen 2012-09-09 20:06:38 -04:00
parent 1533e67ae4
commit c8aa94f7a8

View File

@ -237,6 +237,9 @@ get_effective_context_id (GtkIMMulticontext *multicontext)
static GtkIMContext *
gtk_im_multicontext_get_slave (GtkIMMulticontext *multicontext)
{
if (g_strcmp0 (multicontext->context_id, get_effective_context_id (multicontext)) != 0)
gtk_im_multicontext_set_slave (multicontext, NULL, FALSE);
if (!multicontext->slave)
{
GtkIMContext *slave;
@ -269,7 +272,8 @@ gtk_im_multicontext_set_client_window (GtkIMContext *context,
GdkWindow *window)
{
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
GdkScreen *screen;
GtkIMContext *slave;
GdkScreen *screen;
GtkSettings *settings;
gboolean connected;
@ -293,11 +297,9 @@ gtk_im_multicontext_set_client_window (GtkIMContext *context,
}
}
if (g_strcmp0 (multicontext->context_id, get_effective_context_id (multicontext)) != 0)
gtk_im_multicontext_set_slave (multicontext, NULL, FALSE);
if (multicontext->slave)
gtk_im_context_set_client_window (multicontext->slave, window);
slave = gtk_im_multicontext_get_slave (multicontext);
if (slave)
gtk_im_context_set_client_window (slave, window);
}
static void
@ -356,15 +358,10 @@ static void
gtk_im_multicontext_focus_in (GtkIMContext *context)
{
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
GtkIMContext *slave;
GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
if (g_strcmp0 (multicontext->context_id, get_effective_context_id (multicontext)) != 0)
gtk_im_multicontext_set_slave (multicontext, NULL, FALSE);
slave = gtk_im_multicontext_get_slave (multicontext);
multicontext->priv->focus_in = TRUE;
if (slave)
gtk_im_context_focus_in (slave);
}