Fix back key doesn't work in legacy applications based on 2.x 99/78799/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 7 Jul 2016 02:21:20 +0000 (11:21 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 7 Jul 2016 02:21:49 +0000 (11:21 +0900)
Change-Id: Id7b963d937b088cda84eb9cd85d37689c038ce8d

ism/extras/wayland_immodule/wayland_imcontext.c

index 16ccf17..f3d4fb9 100644 (file)
@@ -52,6 +52,7 @@ static Ecore_Timer *_hide_timer  = NULL;
 
 // TIZEN_ONLY(20150708): Support back key
 #define BACK_KEY "XF86Back"
+#define OLD_BACK_KEY "XF86Stop"
 
 static Eina_Bool             input_detected = EINA_FALSE;
 static Eina_Bool             will_hide = EINA_FALSE;
@@ -148,6 +149,19 @@ get_using_ctx ()
 }
 
 static Eina_Bool
+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;
+}
+
+static Eina_Bool
 key_down_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
     Ecore_Event_Key *ev = (Ecore_Event_Key *)event;
@@ -155,8 +169,10 @@ key_down_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 
     if ((_input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_SHOW ||
          _input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW) &&
-         strcmp(ev->keyname, BACK_KEY) == 0)
+        check_hide_key(ev->keyname)) {
+        LOGD ("%s key is pressed.\n", ev->keyname);
         return EINA_FALSE;
+    }
 
     return EINA_TRUE;
 }
@@ -172,9 +188,11 @@ key_up_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
     if (!active_ctx) return EINA_TRUE;
 
     if (_input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_HIDE ||
-        strcmp(ev->keyname, BACK_KEY) != 0)
+        !check_hide_key(ev->keyname))
         return EINA_TRUE;
 
+    LOGD ("%s key is released.\n", ev->keyname);
+
     ecore_imf_context_reset(active_ctx);
 
     _input_panel_hide(active_ctx, EINA_TRUE);