added hotkeys in the config file for hiding ise 21/31521/1
authorWonkeun Oh <wonkeun.oh@samsung.com>
Mon, 10 Mar 2014 11:06:15 +0000 (20:06 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 5 Dec 2014 12:35:17 +0000 (21:35 +0900)
Change-Id: Ifc5bb8e22c5f2557c5ffad9ce0b40ba19deb203a

ism/configs/config
ism/extras/efl_immodule/isf_imf_context.cpp
ism/src/scim_config_path.h

index 83d6883..08427a6 100755 (executable)
@@ -10,6 +10,7 @@
 /Hotkeys/FrontEnd/ShowFactoryMenu = Control+Alt+Right
 /Hotkeys/FrontEnd/Trigger = Shift+space,Hangul
 /Hotkeys/FrontEnd/ValidKeyMask = Shift+Control+Alt+CapsLock+Meta+QuirkKanaRo
+/Hotkeys/FrontEnd/HideISE = Escape,XF86Stop,XF86Back
 /IMEngine/Hangul/AutoReorder = false
 /Panel/Gtk/Color/ActiveBackground = light sky blue
 /Panel/Gtk/Color/ActiveText = black
index c57c020..ec31162 100644 (file)
@@ -495,13 +495,19 @@ _key_down_cb (void *data, int type, void *event)
     Ecore_IMF_Context *active_ctx = get_using_ic (ECORE_IMF_INPUT_PANEL_STATE_EVENT, ECORE_IMF_INPUT_PANEL_STATE_SHOW);
     if (!ev || !ev->keyname || !active_ctx) return ECORE_CALLBACK_RENEW;
 
-    if ((!strcmp (ev->keyname, "Escape") || !strcmp (ev->keyname, KEY_END)) &&
-        ecore_imf_context_input_panel_state_get (active_ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
-        LOGD ("%s key is pressed.\n", ev->keyname);
-        return ECORE_CALLBACK_CANCEL;
+    std::vector <String> hide_ise_keys;
+    scim_split_string_list (hide_ise_keys, _config->read (String (SCIM_CONFIG_HOTKEYS_FRONTEND_HIDE_ISE), String ("")), ',');
+
+    if (ecore_imf_context_input_panel_state_get (active_ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
+        for (int i = 0; i < hide_ise_keys.size (); ++i) {
+            if (!strcmp (ev->keyname, hide_ise_keys [i].c_str ())) {
+                LOGD ("%s key is pressed.\n", ev->keyname);
+                return ECORE_CALLBACK_DONE;
+            }
+        }
     }
 
-    return ECORE_CALLBACK_RENEW;
+    return ECORE_CALLBACK_PASS_ON;
 }
 
 static Eina_Bool
@@ -515,13 +521,20 @@ _key_up_cb (void *data, int type, void *event)
     Ecore_Event_Key *ev = (Ecore_Event_Key *)event;
     if (!ev || !ev->keyname || !active_ctx) return ECORE_CALLBACK_RENEW;
 
-    if ((!strcmp (ev->keyname, "Escape")  || !strcmp (ev->keyname, KEY_END)) &&
-        ecore_imf_context_input_panel_state_get (active_ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
-        LOGD ("%s key is released.\n", ev->keyname);
-        isf_imf_context_reset (active_ctx);
-        isf_imf_context_input_panel_instant_hide (active_ctx);
-        return ECORE_CALLBACK_CANCEL;
-    } else if (!strcmp (ev->keyname, "XF86MenuKB")) {
+    std::vector <String> hide_ise_keys;
+    scim_split_string_list (hide_ise_keys, _config->read (String (SCIM_CONFIG_HOTKEYS_FRONTEND_HIDE_ISE), String ("")), ',');
+
+    if (ecore_imf_context_input_panel_state_get (active_ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
+        for (int i = 0; i < hide_ise_keys.size (); ++i) {
+            if (!strcmp (ev->keyname, hide_ise_keys [i].c_str ())) {
+                LOGD ("%s key is released.\n", ev->keyname);
+                isf_imf_context_reset (active_ctx);
+                isf_imf_context_input_panel_instant_hide (active_ctx);
+                return ECORE_CALLBACK_DONE;
+            }
+        }
+    }
+    if (!strcmp (ev->keyname, "XF86MenuKB")) {
         if (ecore_imf_context_input_panel_state_get (active_ctx) == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
             ecore_imf_context_input_panel_hide (active_ctx);
         } else {
index 55bba22..ae5b2cc 100644 (file)
@@ -56,6 +56,7 @@ namespace scim {
 #define SCIM_CONFIG_HOTKEYS_FRONTEND_PREVIOUS_FACTORY               "/Hotkeys/FrontEnd/PreviousFactory"
 #define SCIM_CONFIG_HOTKEYS_FRONTEND_SHOW_FACTORY_MENU              "/Hotkeys/FrontEnd/ShowFactoryMenu"
 #define SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK                 "/Hotkeys/FrontEnd/ValidKeyMask"
+#define SCIM_CONFIG_HOTKEYS_FRONTEND_HIDE_ISE                       "/Hotkeys/FrontEnd/HideISE"
 
 #define SCIM_CONFIG_HOTKEYS_IMENGINE                                "/Hotkeys/IMEngine"
 #define SCIM_CONFIG_HOTKEYS_IMENGINE_LIST                           "/Hotkeys/IMEngine/List"