Remove the filter_devices logic and use the device_subclass to distinguish the device... 67/145467/1
authorInHong Han <inhong1.han@samsung.com>
Tue, 22 Aug 2017 10:26:27 +0000 (19:26 +0900)
committerInHong Han <inhong1.han@samsung.com>
Tue, 22 Aug 2017 10:27:03 +0000 (19:27 +0900)
This reverts commit 2f0e37c78c4d0c0f0a2e33e690a32a2e9bdfb2de.

Change-Id: I65d8ccddcfe61c98d2c8d0c126a8c371628fc1e5

ism/extras/wayland_immodule/wayland_imcontext.c
ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp

index df8b3a7..ea5d7e2 100644 (file)
@@ -2481,38 +2481,6 @@ keyboard_mode_changed_cb (keynode_t *key, void* data)
         }
     }
 }
-
-static Eina_Bool read_devices = EINA_FALSE;
-char ** device_names = NULL;
-
-static Eina_Bool
-filter_devices (const char *dev_name)
-{
-    int i;
-
-    if (!dev_name)
-        return EINA_FALSE;
-
-    if (read_devices == EINA_FALSE) {
-        char *devices = getenv("ISF_REMOTE_CONTROL_DEVICES");
-        if (devices) {
-            device_names = eina_str_split(devices, ",", 0);
-        }
-        read_devices = EINA_TRUE;
-    }
-
-     if (device_names == NULL) {
-        return EINA_FALSE;
-    }
-
-    for (i = 0; device_names[i]; i++) {
-        if (!strcmp (dev_name, device_names[i])) {
-            return EINA_TRUE;
-        }
-    }
-
-    return EINA_FALSE;
-}
 #endif
 
 void wayland_im_initialize ()
@@ -2558,6 +2526,7 @@ void wayland_im_initialize ()
         ecore_device_description_set (_ime_device, IME_DEVICE_NAME);
         ecore_device_identifier_set (_ime_device, IME_DEVICE_NAME);
         ecore_device_class_set (_ime_device, ECORE_DEVICE_CLASS_KEYBOARD);
+        ecore_device_subclass_set (_ime_device, ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD);
     }
 }
 
@@ -2573,15 +2542,6 @@ void wayland_im_uninitialize ()
     vconf_ignore_key_changed (VCONFKEY_AUTOCAPITAL_ALLOW_BOOL, autocapital_allow_changed_cb);
     vconf_ignore_key_changed (VCONFKEY_ISF_INPUT_LANGUAGE, input_language_changed_cb);
     vconf_ignore_key_changed (VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, keyboard_mode_changed_cb);
-
-    if (_TV) {
-        if (device_names) {
-            if (device_names[0])
-                free (device_names[0]);
-            free (device_names);
-            device_names = NULL;
-        }
-    }
 #endif
 
     if (_ime_device) {
@@ -3048,7 +3008,7 @@ wayland_im_context_filter_event(Ecore_IMF_Context    *ctx,
         }
 
         if (_TV) {
-            if (strcmp (ecore_key_ev.keyname, "Return") == 0 && type == ECORE_IMF_EVENT_KEY_DOWN && filter_devices (key_dev_name) && hw_keyboard_mode == EINA_TRUE) {
+            if (strcmp (ecore_key_ev.keyname, "Return") == 0 && type == ECORE_IMF_EVENT_KEY_DOWN && key_dev_subclass == ECORE_DEVICE_SUBCLASS_REMOCON && hw_keyboard_mode == EINA_TRUE) {
                 LOGD ("Changed keyboard mode from H/W to S/W ");
                 hw_keyboard_mode = EINA_FALSE;
                 vconf_set_bool (VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, 0);
@@ -3061,7 +3021,8 @@ wayland_im_context_filter_event(Ecore_IMF_Context    *ctx,
         }
 
         do {
-            if (!ecore_key_ev.timestamp && (ecore_key_ev.modifiers & MOD_Mod5_MASK)) {
+            if (!ecore_key_ev.timestamp && (ecore_key_ev.modifiers & MOD_Mod5_MASK)
+                && key_dev_subclass == ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD) {
                 if (type == ECORE_IMF_EVENT_KEY_DOWN) {
                     if (strcmp (ecore_key_ev.key, "space") == 0 ||
                         strcmp (ecore_key_ev.key, "KP_Space") == 0 ) {
index f95e8cb..1886264 100644 (file)
@@ -206,8 +206,6 @@ static bool                                             _support_hw_keyboard_mod
 static bool                                             _x_key_event_is_valid       = false;
 
 static Ecore_Timer                                     *_resource_check_timer       = NULL;
-static std::vector <String>                             remote_control_devices;
-static bool                                             read_devices = false;
 
 static bool                                             _need_wl_im_init           = false;
 static struct _wl_im                                    *_wl_im_ctx                = NULL;
@@ -913,34 +911,6 @@ _wsc_setup (struct weescim *wsc)
 
 //////////////////////////////wayland_panel_agent_module end//////////////////////////////////////////////////
 
-static bool
-filter_devices (const char *dev_name)
-{
-    SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
-    LOGD("");
-    if (!dev_name)
-        return false;
-
-    if (read_devices == false) {
-        char *devices = getenv("ISF_REMOTE_CONTROL_DEVICES");
-        if (devices) {
-            scim_split_string_list(remote_control_devices, devices, ',');
-        }
-        read_devices = true;
-    }
-    else if (remote_control_devices.size () == 0) {
-        return false;
-    }
-
-    for (unsigned int i = 0; i < remote_control_devices.size (); ++i) {
-        if (!strcmp (dev_name, remote_control_devices [i].c_str ())) {
-            return true;
-        }
-    }
-
-    return false;
-}
-
 WSCContextISF *
 get_focused_ic ()
 {
@@ -1757,7 +1727,7 @@ isf_wsc_context_filter_key_event (WSCContextISF* wsc_ctx,
                         strcmp (keysym, "Return") &&
                         strcmp (keysym, "Pause") &&
                         strcmp (keysym, "NoSymbol") &&
-                        !filter_devices (dev_name)) {
+                        key.dev_subclass != ECORE_DEVICE_SUBCLASS_REMOCON) {
                         hw_key_detect = true;
                     }
                 } else {