From 0051d55ad856e85e5cda0d101485d9f634dfbec5 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 10 Apr 2020 12:33:52 +0900 Subject: [PATCH] Revise code to handle IME hide key Change-Id: I3acf95c7917c86d761b49e33d6a5b4b15a0e3621 Signed-off-by: Jihoon Kim --- ism/extras/wayland_immodule/wayland_imcontext.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 0fa5cd2..5951a5d 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -105,10 +105,6 @@ static Ecore_Timer *_hide_timer = NULL; static const char *_ecore_imf_event_empty = ""; -// TIZEN_ONLY(20150708): Support back key -#define BACK_KEY "XF86Back" -#define OLD_BACK_KEY "XF86Stop" - static Eina_Bool will_hide = EINA_FALSE; static Eina_Bool ignore_hide = EINA_FALSE; @@ -184,6 +180,12 @@ static LanguageInfo __language_infos [] = { { "sd_IN", INPUT_LANG_SINDHI, 0x0964 }, }; +static const char *hide_keys [] = { + "Escape", + "XF86Back", // BACK_KEY + "XF86Stop" // OLD_BACK_KEY +}; + struct _WaylandIMContext { Ecore_IMF_Context *ctx; @@ -685,12 +687,14 @@ check_hide_key(const char *keyname) { if (!keyname) return EINA_FALSE; - if (strcmp(keyname, "Escape") == 0 || - strcmp(keyname, BACK_KEY) == 0 || - strcmp(keyname, OLD_BACK_KEY) == 0) - return EINA_TRUE; - else - return EINA_FALSE; + unsigned int i = 0; + for (i = 0; i < (sizeof(hide_keys) / sizeof(hide_keys[0])); i++) { + if (strcmp(keyname, hide_keys[i]) == 0) { + return EINA_TRUE; + } + } + + return EINA_FALSE; } static unsigned int -- 2.7.4