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
This commit is contained in:
Rui Matos 2012-04-29 02:44:23 +02:00
parent a4d76439e6
commit a0f155e839

View File

@ -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;