X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkimmodule.c;h=e6372f2edb6763b233b81164d2618e952e98033a;hb=HEAD;hp=ef547fc5f959ee9db1881112b29e9c86dba829ac;hpb=5c4f2ef0c1e658827091aadf4fc3c4d5f5964785;p=~andy%2Fgtk diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c index ef547fc5f..e6372f2ed 100644 --- a/gtk/gtkimmodule.c +++ b/gtk/gtkimmodule.c @@ -12,8 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * License along with this library. If not, see .Free */ /* @@ -32,12 +31,19 @@ #include #include -#include "gtkimmodule.h" +#include "gtkimmoduleprivate.h" #include "gtkimcontextsimple.h" #include "gtksettings.h" #include "gtkprivate.h" #include "gtkintl.h" +#undef GDK_DEPRECATED +#undef GDK_DEPRECATED_FOR +#define GDK_DEPRECATED +#define GDK_DEPRECATED_FOR(f) + +#include "deprecated/gtkrc.h" + #define SIMPLE_ID "gtk-im-context-simple" /** @@ -632,6 +638,28 @@ match_locale (const gchar *locale, return 0; } +static const gchar * +lookup_immodule (gchar **immodules_list) +{ + while (immodules_list && *immodules_list) + { + if (g_strcmp0 (*immodules_list, SIMPLE_ID) == 0) + return SIMPLE_ID; + else + { + gboolean found; + gchar *context_id; + found = g_hash_table_lookup_extended (contexts_hash, *immodules_list, + (gpointer *) &context_id, NULL); + if (found) + return context_id; + } + immodules_list++; + } + + return NULL; +} + /** * _gtk_im_module_get_default_context_id: * @client_window: a window @@ -648,7 +676,7 @@ _gtk_im_module_get_default_context_id (GdkWindow *client_window) const gchar *context_id = NULL; gint best_goodness = 0; gint i; - gchar *tmp_locale, *tmp; + gchar *tmp_locale, *tmp, **immodules; const gchar *envvar; GdkScreen *screen; GtkSettings *settings; @@ -656,11 +684,16 @@ _gtk_im_module_get_default_context_id (GdkWindow *client_window) if (!contexts_hash) gtk_im_module_initialize (); - envvar = g_getenv ("GTK_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) + { + immodules = g_strsplit(envvar, ":", 0); + context_id = lookup_immodule(immodules); + g_strfreev(immodules); + + if (context_id) + return context_id; + } /* Check if the certain immodule is set in XSETTINGS. */ @@ -671,15 +704,9 @@ _gtk_im_module_get_default_context_id (GdkWindow *client_window) g_object_get (G_OBJECT (settings), "gtk-im-module", &tmp, NULL); if (tmp) { - if (strcmp (tmp, SIMPLE_ID) == 0) - context_id = SIMPLE_ID; - else - { - GtkIMModule *module; - module = g_hash_table_lookup (contexts_hash, tmp); - if (module) - context_id = module->contexts[0]->context_id; - } + immodules = g_strsplit(tmp, ":", 0); + context_id = lookup_immodule(immodules); + g_strfreev(immodules); g_free (tmp); if (context_id)