From 2f0e37c78c4d0c0f0a2e33e690a32a2e9bdfb2de Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 10 Aug 2017 05:26:12 +0000 Subject: [PATCH] Revert "Remove the filter_devices logic and use the device_subclass to distinguish the device information" This reverts commit 89dc38d4ddb8269d35906e39b3cddbc6734a48da. Change-Id: Ia73925a5cc88091801abd97fd087349f750b34fa --- ism/extras/wayland_immodule/wayland_imcontext.c | 47 ++++++++++++++++++++-- .../wayland/wayland_panel_agent_module.cpp | 32 ++++++++++++++- 2 files changed, 74 insertions(+), 5 deletions(-) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index ea5d7e2..df8b3a7 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -2481,6 +2481,38 @@ 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 () @@ -2526,7 +2558,6 @@ 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); } } @@ -2542,6 +2573,15 @@ 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) { @@ -3008,7 +3048,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 && key_dev_subclass == ECORE_DEVICE_SUBCLASS_REMOCON && hw_keyboard_mode == EINA_TRUE) { + if (strcmp (ecore_key_ev.keyname, "Return") == 0 && type == ECORE_IMF_EVENT_KEY_DOWN && filter_devices (key_dev_name) && 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); @@ -3021,8 +3061,7 @@ wayland_im_context_filter_event(Ecore_IMF_Context *ctx, } do { - if (!ecore_key_ev.timestamp && (ecore_key_ev.modifiers & MOD_Mod5_MASK) - && key_dev_subclass == ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD) { + if (!ecore_key_ev.timestamp && (ecore_key_ev.modifiers & MOD_Mod5_MASK)) { if (type == ECORE_IMF_EVENT_KEY_DOWN) { if (strcmp (ecore_key_ev.key, "space") == 0 || strcmp (ecore_key_ev.key, "KP_Space") == 0 ) { diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index 1886264..f95e8cb 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -206,6 +206,8 @@ static bool _support_hw_keyboard_mod static bool _x_key_event_is_valid = false; static Ecore_Timer *_resource_check_timer = NULL; +static std::vector remote_control_devices; +static bool read_devices = false; static bool _need_wl_im_init = false; static struct _wl_im *_wl_im_ctx = NULL; @@ -911,6 +913,34 @@ _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 () { @@ -1727,7 +1757,7 @@ isf_wsc_context_filter_key_event (WSCContextISF* wsc_ctx, strcmp (keysym, "Return") && strcmp (keysym, "Pause") && strcmp (keysym, "NoSymbol") && - key.dev_subclass != ECORE_DEVICE_SUBCLASS_REMOCON) { + !filter_devices (dev_name)) { hw_key_detect = true; } } else { -- 2.7.4