summaryrefslogtreecommitdiff
path: root/gtk/gtkimmodule.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2019-01-21 00:48:48 +0100
committerBenjamin Otte <otte@redhat.com>2019-01-22 04:33:11 +0100
commit7978e0496377556b88f5bba24844c94311a58ebc (patch)
tree05cc6c9ab853b8d287b8de81ff89eefb81964dcc /gtk/gtkimmodule.c
parentbbd1532f84da5ab9b1e76b004fce13722c4cb673 (diff)
downloadgtk+-7978e0496377556b88f5bba24844c94311a58ebc.tar.gz
immodule: Clean up loading code
Remove the unneeded is_platform() check and just go by extension point priority. Also g_error() out if no im module exists, because "simple" is compiled in and should always exist.
Diffstat (limited to 'gtk/gtkimmodule.c')
-rw-r--r--gtk/gtkimmodule.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c
index d626a7ebc6..a4c90dac13 100644
--- a/gtk/gtkimmodule.c
+++ b/gtk/gtkimmodule.c
@@ -105,16 +105,6 @@ _gtk_im_module_create (const gchar *context_id)
}
static gboolean
-is_platform (const char *context_id)
-{
- return g_strcmp0 (context_id, "wayland") == 0 ||
- g_strcmp0 (context_id, "broadway") == 0 ||
- g_strcmp0 (context_id, "xim") == 0 ||
- g_strcmp0 (context_id, "quartz") == 0 ||
- g_strcmp0 (context_id, "ime") == 0;
-}
-
-static gboolean
match_backend (GdkDisplay *display,
const char *context_id)
{
@@ -205,6 +195,8 @@ _gtk_im_module_get_default_context_id (GdkDisplay *display)
const gchar *context_id = NULL;
const gchar *envvar;
GtkSettings *settings;
+ GIOExtensionPoint *ep;
+ GList *l;
char *tmp;
envvar = g_getenv ("GTK_IM_MODULE");
@@ -235,26 +227,19 @@ _gtk_im_module_get_default_context_id (GdkDisplay *display)
return context_id;
}
- GIOExtensionPoint *ep;
- GList *list, *l;
-
ep = g_io_extension_point_lookup (GTK_IM_MODULE_EXTENSION_POINT_NAME);
- list = g_io_extension_point_get_extensions (ep);
- for (l = list; l; l = l->next)
+ for (l = g_io_extension_point_get_extensions (ep); l; l = l->next)
{
GIOExtension *ext = l->data;
- const char *context_id;
context_id = g_io_extension_get_name (ext);
if (match_backend (display, context_id))
return context_id;
-
- // FIXME: locale matching
- if (!is_platform (context_id))
- return context_id;
}
- return context_id ? context_id : SIMPLE_ID;
+ g_error ("GTK was run without any IM module being present. This must not happen.");
+
+ return SIMPLE_ID;
}
void