From 3f353753a7b155cfbe6e9ee227631cdcf6899ebd Mon Sep 17 00:00:00 2001 From: Wonkeun Oh Date: Tue, 20 Sep 2016 18:44:41 +0900 Subject: [PATCH] Added the device information in the filter_key event Change-Id: I9ac893bdbde45e25f5ca7a04dc228008371db386 --- ism/extras/wayland_immodule/wayland_imcontext.c | 11 ++++++++++- ism/modules/panelagent/wayland/isf_wsc_context.h | 3 ++- ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp | 8 +++++--- 3 files changed, 17 insertions(+), 5 deletions(-) mode change 100755 => 100644 ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 5c12f2f..ac0f425 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -2019,6 +2019,9 @@ wayland_im_context_filter_event(Ecore_IMF_Context *ctx, #if !(ENABLE_GRAB_KEYBOARD) Eina_Bool ret = EINA_FALSE; Ecore_Event_Key ecore_key_ev; + char *key_dev_name = NULL; + uint32_t key_dev_class = 0; + uint32_t key_dev_subclass = 0; #endif if (type == ECORE_IMF_EVENT_MOUSE_UP) { if (ecore_imf_context_input_panel_enabled_get(ctx)) { @@ -2040,6 +2043,9 @@ wayland_im_context_filter_event(Ecore_IMF_Context *ctx, ecore_key_ev.timestamp = key_ev->timestamp; ecore_key_ev.modifiers = _ecore_imf_modifier_to_ecore_key_modifier(key_ev->modifiers); ecore_key_ev.modifiers |= _ecore_imf_lock_to_ecore_key_modifier(key_ev->locks); + key_dev_name = (char *)key_ev->dev_name; + key_dev_class = key_ev->dev_class; + key_dev_subclass = key_ev->dev_subclass; } else if (type == ECORE_IMF_EVENT_KEY_DOWN) { Ecore_IMF_Event_Key_Down *key_ev = (Ecore_IMF_Event_Key_Down *)imf_event; @@ -2050,6 +2056,9 @@ wayland_im_context_filter_event(Ecore_IMF_Context *ctx, ecore_key_ev.timestamp = key_ev->timestamp; ecore_key_ev.modifiers = _ecore_imf_modifier_to_ecore_key_modifier(key_ev->modifiers); ecore_key_ev.modifiers |= _ecore_imf_lock_to_ecore_key_modifier(key_ev->locks); + key_dev_name = (char *)key_ev->dev_name; + key_dev_class = key_ev->dev_class; + key_dev_subclass = key_ev->dev_subclass; } if (type == ECORE_IMF_EVENT_KEY_UP || type == ECORE_IMF_EVENT_KEY_DOWN) { @@ -2088,7 +2097,7 @@ wayland_im_context_filter_event(Ecore_IMF_Context *ctx, //Send key event to IME. wl_text_input_filter_key_event(imcontext->text_input, serial, ecore_key_ev.timestamp, ecore_key_ev.key, type == ECORE_IMF_EVENT_KEY_UP? WL_KEYBOARD_KEY_STATE_RELEASED : WL_KEYBOARD_KEY_STATE_PRESSED, - modifiers); + modifiers, (key_dev_name ? key_dev_name : ""), key_dev_class, key_dev_subclass); //Waiting for filter_key_event_done from IME. //This function should return IME filtering result with boolean type. struct wl_display *display = ecore_wl_display_get(); diff --git a/ism/modules/panelagent/wayland/isf_wsc_context.h b/ism/modules/panelagent/wayland/isf_wsc_context.h index e6d8514..4a4ff19 100644 --- a/ism/modules/panelagent/wayland/isf_wsc_context.h +++ b/ism/modules/panelagent/wayland/isf_wsc_context.h @@ -151,7 +151,8 @@ void isf_wsc_context_send_entry_metadata (WSCContextISF* wsc_ctx, Ecore_IMF_Inpu void isf_wsc_context_filter_key_event (WSCContextISF* wsc_ctx, uint32_t serial, uint32_t timestamp, const char *keyname, - bool press, uint32_t modifiers); + bool press, uint32_t modifiers, + const char *dev_name, uint32_t dev_class, uint32_t dev_subclass); #else void isf_wsc_context_filter_key_event (WSCContextISF* wsc_ctx, uint32_t serial, diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp old mode 100755 new mode 100644 index 0f2a2f0..e9196e5 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -452,14 +452,14 @@ _wsc_im_ctx_process_input_device_event(void *data, struct wl_input_method_contex } static void -_wsc_im_ctx_filter_key_event(void *data, struct wl_input_method_context *im_ctx, uint32_t serial, uint32_t time, const char *keyname, uint32_t state, uint32_t modifiers) +_wsc_im_ctx_filter_key_event(void *data, struct wl_input_method_context *im_ctx, uint32_t serial, uint32_t time, const char *keyname, uint32_t state, uint32_t modifiers, const char *dev_name, uint32_t dev_class, uint32_t dev_subclass) { WSCContextISF *wsc_ctx = (WSCContextISF*)data; if (!wsc_ctx) return; #if !(ENABLE_GRAB_KEYBOARD) isf_wsc_context_filter_key_event(wsc_ctx, serial, time, keyname, - ((wl_keyboard_key_state)state) == WL_KEYBOARD_KEY_STATE_PRESSED, modifiers); + ((wl_keyboard_key_state)state) == WL_KEYBOARD_KEY_STATE_PRESSED, modifiers, dev_name, dev_class, dev_subclass); #endif } @@ -1859,7 +1859,8 @@ void isf_wsc_context_filter_key_event (WSCContextISF* wsc_ctx, uint32_t serial, uint32_t timestamp, const char *keysym, - bool press, uint32_t modifiers) + bool press, uint32_t modifiers, + const char *dev_name, uint32_t dev_class, uint32_t dev_subclass) { SCIM_DEBUG_FRONTEND (1) << __FUNCTION__ << "...\n"; LOGD (""); @@ -1875,6 +1876,7 @@ isf_wsc_context_filter_key_event (WSCContextISF* wsc_ctx, KeyEvent key; scim_string_to_key (key, _key); + scim_set_device_info (key, dev_name ? dev_name : "", dev_class, dev_subclass); bool ignore_key = filter_keys (keysym, SCIM_CONFIG_HOTKEYS_FRONTEND_IGNORE_KEY); -- 2.7.4