From 2a187d3abe4c85062063983833c0460a60c67530 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Mon, 18 Jun 2012 23:38:23 +0000 Subject: [PATCH] ecore_imf: just use the styles that are supported! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we want a fancy XIM style that is unsupported, do not use it... but the fallback (no preedit, no status). This allows poor's man XIM to work for those without SCIM and similar. Elementary is now working properly with ' + a = รก SVN revision: 72426 --- .../src/modules/immodules/xim/ecore_imf_xim.c | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/legacy/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/legacy/ecore/src/modules/immodules/xim/ecore_imf_xim.c index 093f99b869..107a3ac383 100644 --- a/legacy/ecore/src/modules/immodules/xim/ecore_imf_xim.c +++ b/legacy/ecore/src/modules/immodules/xim/ecore_imf_xim.c @@ -1226,7 +1226,48 @@ get_ic(Ecore_IMF_Context *ctx) im_style |= XIMStatusNothing; } - if (im_info->im) + if (!im_info->xim_styles) + { + EINA_LOG_WARN("No XIM styles supported! Wanted %#llx", + (unsigned long long)im_style); + im_style = 0; + } + else + { + XIMStyle fallback = 0; + int i; + + for (i = 0; i < im_info->xim_styles->count_styles; i++) + { + XIMStyle cur = im_info->xim_styles->supported_styles[i]; + if (cur == im_style) + break; + else if (cur == (XIMPreeditNothing | XIMStatusNothing)) + /* TODO: fallback is just that or the anyone? */ + fallback = cur; + } + + if (i == im_info->xim_styles->count_styles) + { + if (fallback) + { + EINA_LOG_WARN("Wanted XIM style %#llx not found, " + "using fallback %#llx instead.", + (unsigned long long)im_style, + (unsigned long long)fallback); + im_style = fallback; + } + else + { + EINA_LOG_WARN("Wanted XIM style %#llx not found, " + "no fallback supported.", + (unsigned long long)im_style); + im_style = 0; + } + } + } + + if ((im_info->im) && (im_style)) { ic = XCreateIC(im_info->im, XNInputStyle, im_style,