Added the device information in the filter_key event 42/89142/4
authorWonkeun Oh <wonkeun.oh@samsung.com>
Tue, 20 Sep 2016 09:44:41 +0000 (18:44 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 28 Sep 2016 05:01:22 +0000 (22:01 -0700)
Change-Id: I9ac893bdbde45e25f5ca7a04dc228008371db386

ism/extras/wayland_immodule/wayland_imcontext.c
ism/modules/panelagent/wayland/isf_wsc_context.h
ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp [changed mode: 0755->0644]

index 5c12f2f..ac0f425 100644 (file)
@@ -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();
index e6d8514..4a4ff19 100644 (file)
@@ -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,
old mode 100755 (executable)
new mode 100644 (file)
index 0f2a2f0..e9196e5
@@ -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);