Revise code to handle IME hide key 32/230432/4
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 10 Apr 2020 03:33:52 +0000 (12:33 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 13 Apr 2020 07:16:35 +0000 (16:16 +0900)
Change-Id: I3acf95c7917c86d761b49e33d6a5b4b15a0e3621
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
ism/extras/wayland_immodule/wayland_imcontext.c

index 0fa5cd2..5951a5d 100644 (file)
@@ -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