[PATCH] Add $GTK3_IM_MODULE to gtk3



Currently gtk3 reads $GTK_IM_MODULE environment variable for the
specified IM module as well as in gtk2.  This works when an IM module
is available both for gtk2 and gtk3.  But some IMs like SCIM don't
support gtk3 (officially) yet.  So, when GTK_IM_MODULE=scim is set,
all gtk3-native apps will fallback to "simple", i.e. actually no IM
can be used.

This patch adds a check of $GTK3_IM_MODULE variable in prior to
$GTK_IM_MODULE so that user can specify gtk3-specific IM module.
In most cases, passing GTK3_IM_MODULE="xim" should work as fallback.

[Note: there are different (probably more elegant) approaches by
 implementing the proper fallback mechanism.  For example,
    https://bugzilla.gnome.org/show_bug.cgi?id=603559
 which has been opened for quite long time.

 The only practical drawback of the patch above is it'd be needed to
 be applied to both Gtk2 and Gtk3 so that the single
 GTK_IM_MODULE="scim:xim" to work.

 I decided to post my version since it doesn't conflict conceptually
 with the fallback patch, and it's simpler for the aim.]

Reference: https://bugzilla.novell.com/show_bug.cgi?id=723382

Signed-off-by: Takashi Iwai <tiwai suse de>

---
 gtk/gtkimmodule.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/gtk/gtkimmodule.c
+++ b/gtk/gtkimmodule.c
@@ -672,6 +672,12 @@
   if (!contexts_hash)
     gtk_im_module_initialize ();
 
+  envvar = g_getenv ("GTK3_IM_MODULE");
+  if (envvar &&
+      (strcmp (envvar, SIMPLE_ID) == 0 ||
+       g_hash_table_lookup (contexts_hash, envvar))) 
+    return envvar;
+
   envvar = g_getenv ("GTK_IM_MODULE");
   if (envvar &&
       (strcmp (envvar, SIMPLE_ID) == 0 ||


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