Merge branch 'shorter-im-context-ids' into 'main'

immmodule: Warn if GTK_IM_MODULE is bad

See merge request GNOME/gtk!5229
This commit is contained in:
Matthias Clasen 2022-11-18 19:33:17 +00:00
commit 4a71957c1f

View File

@ -66,8 +66,10 @@
#include <windows.h>
#endif
#define SIMPLE_ID "gtk-im-context-simple"
#define NONE_ID "gtk-im-context-none"
#define SIMPLE_ID "gtk-im-context-simple"
#define ALT_SIMPLE_ID "simple"
#define NONE_ID "gtk-im-context-none"
#define ALT_NONE_ID "none"
/**
* _gtk_im_module_create:
@ -151,9 +153,11 @@ lookup_immodule (GdkDisplay *display,
if (!match_backend (display, immodules_list[i]))
continue;
if (g_strcmp0 (immodules_list[i], SIMPLE_ID) == 0)
if (g_strcmp0 (immodules_list[i], SIMPLE_ID) == 0 ||
g_strcmp0 (immodules_list[i], ALT_SIMPLE_ID) == 0)
return SIMPLE_ID;
else if (g_strcmp0 (immodules_list[i], NONE_ID) == 0)
else if (g_strcmp0 (immodules_list[i], NONE_ID) == 0 ||
g_strcmp0 (immodules_list[i], ALT_NONE_ID) == 0)
return NONE_ID;
else
{
@ -199,6 +203,16 @@ _gtk_im_module_get_default_context_id (GdkDisplay *display)
if (context_id)
return context_id;
else
{
static gboolean warned;
if (!warned)
{
g_warning ("No IM module matching GTK_IM_MODULE=%s found", envvar);
warned = TRUE;
}
}
}
/* Check if the certain immodule is set in XSETTINGS. */