From 76f197f9554adaeffcb38dcf7c10822df4c6e060 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Tue, 19 Sep 2017 15:22:33 +0900 Subject: [PATCH] Revert "Remove the filter_devices logic and use the device_subclass to distinguish the device information" This reverts commit 96ad09eefa376687416e0b575464487b76b088cc. Change-Id: Iee563fbe160efbe59b1b33dc5a8a8a58473a92c6 (cherry picked from commit 1e1ed7481d8f6d8af33dcc47510e4cece7371be0) --- 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 57d5d9a..9c54748 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -2499,6 +2499,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 () @@ -2544,7 +2576,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); } } @@ -2560,6 +2591,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) { @@ -3025,7 +3065,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); @@ -3038,8 +3078,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 676c12f..b832afa 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -205,6 +205,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; @@ -914,6 +916,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 () { @@ -1730,7 +1760,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