Remove the filter_devices logic and use the device_subclass to distinguish the device... 76/156176/1
authorInHong Han <inhong1.han@samsung.com>
Tue, 17 Oct 2017 06:21:10 +0000 (15:21 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 17 Oct 2017 10:29:48 +0000 (10:29 +0000)
Change-Id: I179b6138d8827e4f2e460aaf280dd1828f9717d7
(cherry picked from commit 26a9b9bc04f24f1f0e0612986c9db8febc978692)

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

index 4b289fa..11c9959 100644 (file)
@@ -287,6 +287,7 @@ _device_info_send (unsigned int window, Eina_Bool flag)
     e->identifier = eina_stringshare_ref (IME_DEVICE_NAME);
     e->seatname = eina_stringshare_ref (IME_DEVICE_NAME);
     e->clas = ECORE_DEVICE_CLASS_KEYBOARD;
+    e->subclas = EVAS_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD;
     e->window = window;
 
     if (flag)
@@ -2501,38 +2502,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 ()
@@ -2578,6 +2547,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);
     }
 }
 
@@ -2593,15 +2563,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) {
@@ -3067,7 +3028,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);
@@ -3080,7 +3041,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 b832afa..676c12f 100644 (file)
@@ -205,8 +205,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;
@@ -916,34 +914,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 ()
 {
@@ -1760,7 +1730,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 {