Support back key
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 23 Feb 2017 05:41:18 +0000 (14:41 +0900)
committerInHong Han <inhong1.han@samsung.com>
Thu, 23 Feb 2017 11:45:56 +0000 (20:45 +0900)
Change-Id: If9f77f2f03429b60b71926c6ae970aef8a979d4c
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
ism/extras/wayland_immodule/wayland_imcontext.c
ism/src/scim_helper.cpp
packaging/isf.spec

index b196932b512e75dd65a821501384c07b6e3d0b81..15cbe68f5712301c81db6220aea0697a503f5cff 100644 (file)
@@ -674,14 +674,14 @@ _ecore_event_to_ecore_imf_key_up_event(Ecore_Event_Key *ecore_event, Ecore_IMF_E
 #endif
 
 static Eina_Bool
-key_down_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+key_down_filter_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
     Ecore_Event_Key *ev = (Ecore_Event_Key *)event;
-    if (!ev || !ev->keyname) return EINA_TRUE;
+    if (!ev || !ev->keyname) return EINA_TRUE; /* the event is kept */
 
     Ecore_IMF_Context *active_ctx = get_using_ctx ();
 
-    if (!active_ctx) return EINA_TRUE;
+    if (!active_ctx) return EINA_TRUE; /* the event is kept */
 
     if ((_input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_SHOW ||
         _input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW) &&
@@ -690,34 +690,40 @@ key_down_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
         LOGD ("%s key is pressed.\n", ev->keyname);
 
 #ifdef ENABLE_HIDE_PANEL_KEY
-        return EINA_FALSE;
+        return EINA_FALSE; /* the event is removed from the queue */
 #else
         Ecore_IMF_Event_Key_Down imf_event;
         _ecore_event_to_ecore_imf_key_down_event(ev, &imf_event);
 
-        if (ecore_imf_context_filter_event(active_ctx, ECORE_IMF_EVENT_KEY_DOWN, (Ecore_IMF_Event *)&imf_event)) {
-            return EINA_FALSE;
+        Eina_Bool filter_ret = ecore_imf_context_filter_event(active_ctx, ECORE_IMF_EVENT_KEY_DOWN, (Ecore_IMF_Event *)&imf_event);
+        LOGD ("%s key is pressed. ret : %d\n", ev->keyname, filter_ret);
+        if (filter_ret) {
+            return EINA_FALSE; /* the event is removed from the queue */
         }
 
-        return EINA_TRUE;
-#endif
+#ifdef _TV
+        return EINA_TRUE; /* the event is kept */
+#else
+        return EINA_FALSE; /* the event is removed from the queue */
+#endif /* _TV */
+#endif /* ENABLE_HIDE_PANEL_KEY */
     }
-    return EINA_TRUE;
+    return EINA_TRUE; /* the event is kept */
 }
 
 static Eina_Bool
-key_up_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+key_up_filter_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
     Ecore_Event_Key *ev = (Ecore_Event_Key *)event;
-    if (!ev || !ev->keyname) return EINA_TRUE;
+    if (!ev || !ev->keyname) return EINA_TRUE; /* the event is kept */
 
     Ecore_IMF_Context *active_ctx = get_using_ctx ();
 
-    if (!active_ctx) return EINA_TRUE;
+    if (!active_ctx) return EINA_TRUE; /* the event is kept */
 
     if (_input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_HIDE ||
         !check_hide_key(ev->keyname))
-        return EINA_TRUE;
+        return EINA_TRUE; /* the event is kept */
 
     LOGD ("%s key is released.\n", ev->keyname);
 
@@ -725,20 +731,28 @@ key_up_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
     ecore_imf_context_reset(active_ctx);
     _input_panel_hide(active_ctx, EINA_TRUE);
 
-    return EINA_FALSE;
+    return EINA_FALSE; /* the event is removed from the queue */
 #else
     Ecore_IMF_Event_Key_Up imf_event;
     _ecore_event_to_ecore_imf_key_up_event(ev, &imf_event);
 
-    if (ecore_imf_context_filter_event(active_ctx, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event *)&imf_event)) {
-        return EINA_FALSE;
+    Eina_Bool filter_ret = ecore_imf_context_filter_event(active_ctx, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event *)&imf_event);
+    LOGD ("%s key is released. ret : %d\n", ev->keyname, filter_ret);
+    if (filter_ret) {
+        return EINA_FALSE; /* the event is removed from the queue */
     }
     else {
         ecore_imf_context_reset(active_ctx);
 
-        return EINA_TRUE;
+#ifdef _TV
+        return EINA_TRUE; /* the event is kept */
+#else
+        _input_panel_hide(active_ctx, EINA_TRUE);
+
+        return EINA_FALSE; /* the event is removed from the queue */
+#endif /* _TV */
     }
-#endif
+#endif /* ENABLE_HIDE_PANEL_KEY */
 }
 
 #ifdef _WEARABLE
@@ -773,10 +787,10 @@ static Eina_Bool
 _ecore_event_filter_cb(void *data, void *loop_data EINA_UNUSED, int type, void *event)
 {
     if (type == ECORE_EVENT_KEY_DOWN) {
-        return key_down_cb(data, type, event);
+        return key_down_filter_cb(data, type, event);
     }
     else if (type == ECORE_EVENT_KEY_UP) {
-        return key_up_cb(data, type, event);
+        return key_up_filter_cb(data, type, event);
     }
 #ifdef _WEARABLE
     /* The IME needs to process Rotary event prior to client application */
index 2bccba2b3151534229ce1444110c84bba2a323c9..55463485e14d895be464ef2dd13a03beccdc5a2e 100644 (file)
@@ -1145,13 +1145,16 @@ HelperAgent::handle_message (MessageItem *message)
             MessageItemProcessKeyEvent *subclass = static_cast<MessageItemProcessKeyEvent*>(message);
             uint32 ret = 0;
             m_impl->signal_process_key_event(this, subclass->get_key_ref(), ret);
-            if (ret == 0)
-                if (!m_impl->si.null ())
-                {
-                    ret = m_impl->si->process_key_event (subclass->get_key_ref());
-                    LOGD("imengine(%s) process key %d return %d", m_impl->si->get_factory_uuid().c_str(),
-                        subclass->get_key_ref().code, ret);
+            if (ret == 0) {
+                if (!m_impl->si.null ()) {
+                    if (!(subclass->get_key_ref().get_key_string().compare("KeyRelease+XF86Back") == 0 ||
+                          subclass->get_key_ref().get_key_string().compare("XF86Back") == 0)) {
+                        ret = m_impl->si->process_key_event (subclass->get_key_ref());
+                        LOGD("imengine(%s) process key %d return %d", m_impl->si->get_factory_uuid().c_str(),
+                            subclass->get_key_ref().code, ret);
+                    }
                 }
+            }
             m_impl->process_key_event_done (subclass->get_key_ref(), ret, subclass->get_serial_ref());
             break;
         }
index 09172ac1f11a1ecf091591c65c53d5c3edfcc4ce..98bcb67984286f6dcc2043f8888df6a6bffd499d 100644 (file)
@@ -124,13 +124,13 @@ export CXXFLAGS="$CXXFLAGS -DWAYLAND"
 %endif
 
 %if "%{profile}" == "wearable"
-CFLAGS+=" -D_WEARABLE -DENABLE_HIDE_PANEL_KEY=1";
-CXXFLAGS+=" -D_WEARABLE -DENABLE_HIDE_PANEL_KEY=1";
+CFLAGS+=" -D_WEARABLE";
+CXXFLAGS+=" -D_WEARABLE";
 %endif
 
 %if "%{profile}" == "mobile" || "%{profile}" == "common"
-CFLAGS+=" -D_MOBILE -DENABLE_HIDE_PANEL_KEY=1";
-CXXFLAGS+=" -D_MOBILE -DENABLE_HIDE_PANEL_KEY=1";
+CFLAGS+=" -D_MOBILE";
+CXXFLAGS+=" -D_MOBILE";
 %endif
 
 %if "%{profile}" == "tv"