From: Duna Oh Date: Mon, 4 Apr 2016 08:33:07 +0000 (+0900) Subject: events: send event_device event along with key event X-Git-Tag: submit/tizen/20160405.063717~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d13e61caddc2e75637d93a4282db4525ae93a0df;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-keyrouter.git events: send event_device event along with key event Signed-off-by: Duna Oh Change-Id: I54a63dd822d9039d58d437ae35175dce9845f9b0 --- diff --git a/src/e_mod_keyrouter_events.c b/src/e_mod_keyrouter_events.c index 32bc265..8dd0b04 100644 --- a/src/e_mod_keyrouter_events.c +++ b/src/e_mod_keyrouter_events.c @@ -278,12 +278,44 @@ _e_keyrouter_check_top_visible_window(E_Client *ec_focus, int arr_idx) return EINA_FALSE; } +static void +_e_keyrouter_send_event_device(struct wl_client *wc, uint32_t timestamp, const char *dev_name, uint32_t serial) +{ + const char *last_dev_name; + E_Comp_Wl_Input_Device *input_dev; + struct wl_resource *dev_res; + Eina_List *l, *ll; + + last_dev_name = e_comp_wl->input_device_manager.last_device_name; + if (!last_dev_name || (last_dev_name && (strcmp(last_dev_name, dev_name)))) + { + if (last_dev_name) + eina_stringshare_del(last_dev_name); + last_dev_name = eina_stringshare_add(dev_name); + e_comp_wl->input_device_manager.last_device_name = last_dev_name; + + EINA_LIST_FOREACH(e_comp_wl->input_device_manager.device_list, l, input_dev) + { + if ((strcmp(input_dev->identifier, dev_name)) || + (input_dev->capability != ECORE_DEVICE_KEYBOARD)) + continue; + e_comp_wl->input_device_manager.last_device_cap = input_dev->capability; + EINA_LIST_FOREACH(input_dev->resources, ll, dev_res) + { + if (wl_resource_get_client(dev_res) != wc) continue; + tizen_input_device_send_event_device(dev_res, serial, input_dev->identifier, timestamp); + } + } + } +} + /* Function for sending key event to wl_client(s) */ static void _e_keyrouter_send_key_event(int type, struct wl_resource *surface, struct wl_client *wc, Ecore_Event_Key *ev) { struct wl_client *wc_send; struct wl_resource *res; + const char *dev_name; uint evtype; uint serial; @@ -321,6 +353,12 @@ _e_keyrouter_send_key_event(int type, struct wl_resource *surface, struct wl_cli { if (wl_resource_get_client(res) != wc_send) continue; + if (ev->dev) + { + dev_name = ecore_device_identifier_get(ev->dev); + if (dev_name) + _e_keyrouter_send_event_device(wc_send, ev->timestamp, dev_name, serial); + } KLDBG("[time: %d] res: %p, serial: %d send a key(%d):%d to wl_client:%p\n", ev->timestamp, res, serial, (ev->keycode)-8, evtype, wc_send); TRACE_INPUT_BEGIN(_e_keyrouter_send_key_event); wl_keyboard_send_key(res, serial, ev->timestamp, ev->keycode-8, evtype);