From: JengHyun Kang Date: Tue, 27 Oct 2015 01:31:38 +0000 (+0900) Subject: Put events process functions to new source file. X-Git-Tag: submit/tizen/20151027.063927~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94505cd6bf54ec5510be08c2a6f2b1c97bd22d58;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-keyrouter.git Put events process functions to new source file. Change-Id: Ifedcb8d0c4acf8f1d1a4d22529d692eeea7fbad1 --- diff --git a/src/Makefile.am b/src/Makefile.am index 826a037..72fddb7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,7 +8,8 @@ pkg_LTLIBRARIES = module.la if WAYLAND_ONLY module_la_SOURCES = e_mod_main_wl.c \ e_mod_main_wl.h \ - e_mod_keyrouter_list.c + e_mod_keyrouter_list.c \ + e_mod_keyrouter_events.c module_la_CFLAGS = @ENLIGHTENMENT_CFLAGS@ @WAYLAND_CFLAGS@ -DHAVE_WAYLAND_ONLY module_la_LDFLAGS = -module -avoid-version @WAYLAND_LIBS@ @ENLIGHTENMENT_LIBS@ else diff --git a/src/e_mod_keyrouter_events.c b/src/e_mod_keyrouter_events.c new file mode 100644 index 0000000..5e29ec1 --- /dev/null +++ b/src/e_mod_keyrouter_events.c @@ -0,0 +1,320 @@ +#define E_COMP_WL +#include "e.h" +#include "e_mod_main_wl.h" +#include + +static Eina_Bool _e_keyrouter_send_key_events(int type, Ecore_Event_Key *ev); +static Eina_Bool _e_keyrouter_send_key_events_press(int type, Ecore_Event_Key *ev); +static Eina_Bool _e_keyrouter_send_key_events_release(int type, Ecore_Event_Key *ev); +static void _e_keyrouter_send_key_event(int type, struct wl_resource *surface, struct wl_client *wc, Ecore_Event_Key *ev); + +static Eina_Bool _e_keyrouter_is_key_grabbed(int key); +static Eina_Bool _e_keyrouter_check_top_visible_window(E_Comp *c, E_Client *ec_focus, int arr_idx); +static struct wl_resource *_e_keyrouter_util_get_surface_from_eclient(E_Client *client); + +static Eina_Bool +_e_keyrouter_is_key_grabbed(int key) +{ + if (!krt->HardKeys[key].keycode) + { + return EINA_FALSE; + } + if (!krt->HardKeys[key].excl_ptr && + !krt->HardKeys[key].or_excl_ptr && + !krt->HardKeys[key].top_ptr && + !krt->HardKeys[key].shared_ptr) + { + return EINA_FALSE; + } + + return EINA_TRUE; +} + +/* Function for checking the existing grab for a key and sending key event(s) */ +Eina_Bool +e_keyrouter_process_key_event(void *event, int type) +{ + Eina_Bool res = EINA_TRUE; + Ecore_Event_Key *ev = event; + + if (!ev) return res; + + KLDBG("type=%s\n", (type == ECORE_EVENT_KEY_DOWN) ? "ECORE_EVENT_KEY_DOWN" : "ECORE_EVENT_KEY_UP"); + + if (MAX_HWKEYS <= ev->keycode) + { + KLDBG("The key(%d) is too larger to process keyrouting: Invalid keycode\n", ev->keycode); + return res; + } + + if ( (ECORE_EVENT_KEY_DOWN == type) && (!_e_keyrouter_is_key_grabbed(ev->keycode)) ) + { + KLDBG("The press key(%d) isn't a grabbable key or has not been grabbed yet !\n", ev->keycode); + return res; + } + + if ( (ECORE_EVENT_KEY_UP == type) && (!krt->HardKeys[ev->keycode].press_ptr) ) + { + KLDBG("The release key(%d) isn't a grabbable key or has not been grabbed yet !\n", ev->keycode); + return res; + } + + //KLDBG("The key(%d) is going to be sent to the proper wl client(s) !\n", ev->keycode); + + if (_e_keyrouter_send_key_events(type, ev)) + { + res = EINA_FALSE; + KLDBG("Key event(s) has/have been sent to wl client(s) !\n"); + } + + return res; +} + +/* Function for sending key events to wl_client(s) */ +static Eina_Bool +_e_keyrouter_send_key_events(int type, Ecore_Event_Key *ev) +{ + Eina_Bool res; + if (ECORE_EVENT_KEY_DOWN == type) + { + res = _e_keyrouter_send_key_events_press(type, ev); + } + else + { + res = _e_keyrouter_send_key_events_release(type, ev); + } + return res; +} + +static Eina_Bool +_e_keyrouter_send_key_events_release(int type, Ecore_Event_Key *ev) +{ + E_Keyrouter_Key_List_NodePtr key_node_data; + + /* Deliver release clean up pressed key list */ + EINA_LIST_FREE(krt->HardKeys[ev->keycode].press_ptr, key_node_data) + { + if (key_node_data) + { + _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); + KLDBG("Release Pair : Key %s(%d) ===> E_Client (%p) WL_Client (%p)\n", + ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); + E_FREE(key_node_data); + } + } + krt->HardKeys[ev->keycode].press_ptr = NULL; + + return EINA_TRUE; +} + +static Eina_Bool +_e_keyrouter_send_key_events_press(int type, Ecore_Event_Key *ev) +{ + unsigned int keycode = ev->keycode; + struct wl_resource *surface_focus = NULL; + E_Client *ec_focus = NULL; + E_Comp *c = NULL; + + E_Keyrouter_Key_List_NodePtr key_node_data; + Eina_List *l = NULL; + + EINA_LIST_FOREACH(krt->HardKeys[keycode].excl_ptr, l, key_node_data) + { + if (key_node_data) + { + _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); + KLDBG("EXCLUSIVE Mode : Key %s(%d) ===> Surface (%p) WL_Client (%p)\n", + ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); + + return EINA_TRUE; + } + } + + EINA_LIST_FOREACH(krt->HardKeys[keycode].or_excl_ptr, l, key_node_data) + { + if (key_node_data) + { + _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); + KLDBG("OVERRIDABLE_EXCLUSIVE Mode : Key %s(%d) ===> Surface (%p) WL_Client (%p)\n", + ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); + + return EINA_TRUE; + } + } + + ec_focus = e_client_focused_get(); + surface_focus = _e_keyrouter_util_get_surface_from_eclient(ec_focus); + + // Top position grab must need a focus surface. + if (surface_focus) + { + EINA_LIST_FOREACH(krt->HardKeys[keycode].top_ptr, l, key_node_data) + { + if (key_node_data) + { + if ((EINA_FALSE == krt->isWindowStackChanged) && (surface_focus == key_node_data->surface)) + { + _e_keyrouter_send_key_event(type, key_node_data->surface, NULL, ev); + KLDBG("TOPMOST (TOP_POSITION) Mode : Key %s (%d) ===> Surface (%p)\n", + ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface); + + return EINA_TRUE; + } + krt->isWindowStackChanged = EINA_FALSE; + + c = e_comp_find_by_window(ev->window); + if (_e_keyrouter_check_top_visible_window(c, ec_focus, keycode)) + { + _e_keyrouter_send_key_event(type, key_node_data->surface, NULL, ev); + KLDBG("TOPMOST (TOP_POSITION) Mode : Key %s (%d) ===> Surface (%p)\n", + ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode,key_node_data->surface); + + return EINA_TRUE; + } + break; + } + } + } + + if (krt->HardKeys[keycode].shared_ptr) + { + _e_keyrouter_send_key_event(type, surface_focus, NULL, ev); + KLDBG("SHARED [Focus client] : Key %s (%d) ===> Surface (%p)\n", + ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up "), ev->keycode, surface_focus); + + EINA_LIST_FOREACH(krt->HardKeys[keycode].shared_ptr, l, key_node_data) + { + if (key_node_data) + { + if (key_node_data->surface) + { + if (key_node_data->surface != surface_focus) + { + _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); + KLDBG("SHARED Mode : Key %s(%d) ===> Surface (%p) WL_Client (%p)\n", + ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); + } + } + else + { + if ((surface_focus) && (key_node_data->wc != wl_resource_get_client(surface_focus))) + { + _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); + KLDBG("SHARED Mode : Key %s(%d) ===> Surface (%p) WL_Client (%p)\n", + ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); + } + } + } + } + + return EINA_TRUE; + } + + return EINA_FALSE; +} + +static Eina_Bool +_e_keyrouter_check_top_visible_window(E_Comp *c, E_Client *ec_focus, int arr_idx) +{ + E_Client *ec_top = NULL; + Eina_List *l = NULL, *l_next = NULL; + E_Keyrouter_Key_List_NodePtr key_node_data = NULL; + + ec_top = e_client_top_get(c); + KLDBG("Top Client: %p\n", ec_top); + + while (ec_top) + { + if (!ec_top->visible && ec_top == ec_focus) + { + KLDBG("Top Client(%p) is invisible(%d) but focus client\n", ec_top, ec_top->visible); + return EINA_FALSE; + } + + /* TODO: Check this client is located inside a display boundary */ + + EINA_LIST_FOREACH_SAFE(krt->HardKeys[arr_idx].top_ptr, l, l_next, key_node_data) + { + if (key_node_data) + { + if (ec_top == e_pixmap_client_get(wl_resource_get_user_data(key_node_data->surface))) + { + krt->HardKeys[arr_idx].top_ptr = eina_list_promote_list(krt->HardKeys[arr_idx].top_ptr, l); + KLDBG("Move a client(%p) to first index of list(key: %d)\n", + ec_top, arr_idx); + return EINA_TRUE; + } + } + } + + if (ec_top == ec_focus) + { + KLDBG("The Client(%p) is a focus client\n", ec_top); + return EINA_FALSE; + } + + ec_top = e_client_below_get(ec_top); + KLDBG("Next client: %p\n", ec_top); + } + return EINA_FALSE; +} + +/* 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; + + uint evtype; + uint serial; + Eina_List *l; + + if (surface == NULL) + { + wc_send = wc; + } + else + { + wc_send = wl_resource_get_client(surface); + } + + if (!wc_send) + { + KLDBG("surface: %p or wc: %p returns null wayland client\n", surface, wc); + return; + } + + if (ECORE_EVENT_KEY_DOWN == type) + { + e_keyrouter_prepend_to_keylist(surface, wc, ev->keycode, TIZEN_KEYROUTER_MODE_PRESSED); + evtype = WL_KEYBOARD_KEY_STATE_PRESSED; + } + else + { + evtype = WL_KEYBOARD_KEY_STATE_RELEASED; + } + + serial = wl_display_next_serial(krt->cdata->wl.disp); + EINA_LIST_FOREACH(krt->cdata->kbd.resources, l, res) + { + if (res) + { + if (wl_resource_get_client(res) != wc_send) continue; + + 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); + wl_keyboard_send_key(res, serial, ev->timestamp, ev->keycode-8, evtype); + } + } +} + +static struct wl_resource * +_e_keyrouter_util_get_surface_from_eclient(E_Client *client) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL + (client, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL + (client->comp_data, NULL); + + return client->comp_data->wl_surface; +} diff --git a/src/e_mod_main_wl.c b/src/e_mod_main_wl.c index 1e79748..1ac1691 100644 --- a/src/e_mod_main_wl.c +++ b/src/e_mod_main_wl.c @@ -9,16 +9,9 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Keyrouter Module of Window static Eina_Bool _e_keyrouter_init(); static void _e_keyrouter_init_handlers(void); static void _e_keyrouter_deinit_handlers(void); -static Eina_Bool _e_keyrouter_process_key_event(void *event, int type); -static Eina_Bool _e_keyrouter_send_key_events(int type, Ecore_Event_Key *ev); -static Eina_Bool _e_keyrouter_send_key_events_press(int type, Ecore_Event_Key *ev); -static Eina_Bool _e_keyrouter_send_key_events_release(int type, Ecore_Event_Key *ev); -static void _e_keyrouter_send_key_event(int type, struct wl_resource *surface, struct wl_client *wc, Ecore_Event_Key *ev); -static Eina_Bool _e_keyrouter_is_key_grabbed(int key); -static Eina_Bool _e_keyrouter_check_top_visible_window(E_Comp *c, E_Client *ec_focus, int arr_idx); + static void _e_keyrouter_query_tizen_key_table(void); static int _e_keyrouter_wl_array_length(const struct wl_array *array); -static struct wl_resource *_e_keyrouter_util_get_surface_from_eclient(E_Client *client); static Eina_Bool _e_keyrouter_client_cb_stack(void *data, int type, void *event); static Eina_Bool _e_keyrouter_client_cb_remove(void *data, int type, void *event); @@ -354,303 +347,6 @@ _e_keyrouter_cb_bind(struct wl_client *client, void *data, uint32_t version, uin KLDBG("wl_resource_set_implementation(..., _e_keyrouter_implementation, ...)\n"); } -static Eina_Bool -_e_keyrouter_is_key_grabbed(int key) -{ - if (!krt->HardKeys[key].keycode) - { - return EINA_FALSE; - } - if (!krt->HardKeys[key].excl_ptr && - !krt->HardKeys[key].or_excl_ptr && - !krt->HardKeys[key].top_ptr && - !krt->HardKeys[key].shared_ptr) - { - return EINA_FALSE; - } - - return EINA_TRUE; -} - -/* Function for checking the existing grab for a key and sending key event(s) */ -static Eina_Bool -_e_keyrouter_process_key_event(void *event, int type) -{ - Eina_Bool res = EINA_TRUE; - Ecore_Event_Key *ev = event; - - if (!ev) return res; - - KLDBG("type=%s\n", (type == ECORE_EVENT_KEY_DOWN) ? "ECORE_EVENT_KEY_DOWN" : "ECORE_EVENT_KEY_UP"); - - if (MAX_HWKEYS <= ev->keycode) - { - KLDBG("The key(%d) is too larger to process keyrouting: Invalid keycode\n", ev->keycode); - return res; - } - - if ( (ECORE_EVENT_KEY_DOWN == type) && (!_e_keyrouter_is_key_grabbed(ev->keycode)) ) - { - KLDBG("The press key(%d) isn't a grabbable key or has not been grabbed yet !\n", ev->keycode); - return res; - } - - if ( (ECORE_EVENT_KEY_UP == type) && (!krt->HardKeys[ev->keycode].press_ptr) ) - { - KLDBG("The release key(%d) isn't a grabbable key or has not been grabbed yet !\n", ev->keycode); - return res; - } - - //KLDBG("The key(%d) is going to be sent to the proper wl client(s) !\n", ev->keycode); - - if (_e_keyrouter_send_key_events(type, ev)) - { - res = EINA_FALSE; - KLDBG("Key event(s) has/have been sent to wl client(s) !\n"); - } - - return res; -} - -/* Function for sending key events to wl_client(s) */ -static Eina_Bool -_e_keyrouter_send_key_events(int type, Ecore_Event_Key *ev) -{ - Eina_Bool res; - if (ECORE_EVENT_KEY_DOWN == type) - { - res = _e_keyrouter_send_key_events_press(type, ev); - } - else - { - res = _e_keyrouter_send_key_events_release(type, ev); - } - return res; -} - -static Eina_Bool -_e_keyrouter_send_key_events_release(int type, Ecore_Event_Key *ev) -{ - E_Keyrouter_Key_List_NodePtr key_node_data; - - /* Deliver release clean up pressed key list */ - EINA_LIST_FREE(krt->HardKeys[ev->keycode].press_ptr, key_node_data) - { - if (key_node_data) - { - _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); - KLDBG("Release Pair : Key %s(%d) ===> E_Client (%p) WL_Client (%p)\n", - ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); - E_FREE(key_node_data); - } - } - krt->HardKeys[ev->keycode].press_ptr = NULL; - - return EINA_TRUE; -} - -static Eina_Bool -_e_keyrouter_send_key_events_press(int type, Ecore_Event_Key *ev) -{ - unsigned int keycode = ev->keycode; - struct wl_resource *surface_focus = NULL; - E_Client *ec_focus = NULL; - E_Comp *c = NULL; - - E_Keyrouter_Key_List_NodePtr key_node_data; - Eina_List *l = NULL; - - EINA_LIST_FOREACH(krt->HardKeys[keycode].excl_ptr, l, key_node_data) - { - if (key_node_data) - { - _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); - KLDBG("EXCLUSIVE Mode : Key %s(%d) ===> Surface (%p) WL_Client (%p)\n", - ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); - - return EINA_TRUE; - } - } - - EINA_LIST_FOREACH(krt->HardKeys[keycode].or_excl_ptr, l, key_node_data) - { - if (key_node_data) - { - _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); - KLDBG("OVERRIDABLE_EXCLUSIVE Mode : Key %s(%d) ===> Surface (%p) WL_Client (%p)\n", - ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); - - return EINA_TRUE; - } - } - - ec_focus = e_client_focused_get(); - surface_focus = _e_keyrouter_util_get_surface_from_eclient(ec_focus); - - // Top position grab must need a focus surface. - if (surface_focus) - { - EINA_LIST_FOREACH(krt->HardKeys[keycode].top_ptr, l, key_node_data) - { - if (key_node_data) - { - if ((EINA_FALSE == krt->isWindowStackChanged) && (surface_focus == key_node_data->surface)) - { - _e_keyrouter_send_key_event(type, key_node_data->surface, NULL, ev); - KLDBG("TOPMOST (TOP_POSITION) Mode : Key %s (%d) ===> Surface (%p)\n", - ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface); - - return EINA_TRUE; - } - krt->isWindowStackChanged = EINA_FALSE; - - c = e_comp_find_by_window(ev->window); - if (_e_keyrouter_check_top_visible_window(c, ec_focus, keycode)) - { - _e_keyrouter_send_key_event(type, key_node_data->surface, NULL, ev); - KLDBG("TOPMOST (TOP_POSITION) Mode : Key %s (%d) ===> Surface (%p)\n", - ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode,key_node_data->surface); - - return EINA_TRUE; - } - break; - } - } - } - - if (krt->HardKeys[keycode].shared_ptr) - { - _e_keyrouter_send_key_event(type, surface_focus, NULL, ev); - KLDBG("SHARED [Focus client] : Key %s (%d) ===> Surface (%p)\n", - ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up "), ev->keycode, surface_focus); - - EINA_LIST_FOREACH(krt->HardKeys[keycode].shared_ptr, l, key_node_data) - { - if (key_node_data) - { - if (key_node_data->surface) - { - if (key_node_data->surface != surface_focus) - { - _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); - KLDBG("SHARED Mode : Key %s(%d) ===> Surface (%p) WL_Client (%p)\n", - ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); - } - } - else - { - if ((surface_focus) && (key_node_data->wc != wl_resource_get_client(surface_focus))) - { - _e_keyrouter_send_key_event(type, key_node_data->surface, key_node_data->wc, ev); - KLDBG("SHARED Mode : Key %s(%d) ===> Surface (%p) WL_Client (%p)\n", - ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keycode, key_node_data->surface, key_node_data->wc); - } - } - } - } - - return EINA_TRUE; - } - - return EINA_FALSE; -} - -static Eina_Bool -_e_keyrouter_check_top_visible_window(E_Comp *c, E_Client *ec_focus, int arr_idx) -{ - E_Client *ec_top = NULL; - Eina_List *l = NULL, *l_next = NULL; - E_Keyrouter_Key_List_NodePtr key_node_data = NULL; - - ec_top = e_client_top_get(c); - KLDBG("Top Client: %p\n", ec_top); - - while (ec_top) - { - if (!ec_top->visible && ec_top == ec_focus) - { - KLDBG("Top Client(%p) is invisible(%d) but focus client\n", ec_top, ec_top->visible); - return EINA_FALSE; - } - - /* TODO: Check this client is located inside a display boundary */ - - EINA_LIST_FOREACH_SAFE(krt->HardKeys[arr_idx].top_ptr, l, l_next, key_node_data) - { - if (key_node_data) - { - if (ec_top == e_pixmap_client_get(wl_resource_get_user_data(key_node_data->surface))) - { - krt->HardKeys[arr_idx].top_ptr = eina_list_promote_list(krt->HardKeys[arr_idx].top_ptr, l); - KLDBG("Move a client(%p) to first index of list(key: %d)\n", - ec_top, arr_idx); - return EINA_TRUE; - } - } - } - - if (ec_top == ec_focus) - { - KLDBG("The Client(%p) is a focus client\n", ec_top); - return EINA_FALSE; - } - - ec_top = e_client_below_get(ec_top); - KLDBG("Next client: %p\n", ec_top); - } - return EINA_FALSE; -} - -/* 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; - - uint evtype; - uint serial; - Eina_List *l; - - if (surface == NULL) - { - wc_send = wc; - } - else - { - wc_send = wl_resource_get_client(surface); - } - - if (!wc_send) - { - KLDBG("surface: %p or wc: %p returns null wayland client\n", surface, wc); - return; - } - - if (ECORE_EVENT_KEY_DOWN == type) - { - e_keyrouter_prepend_to_keylist(surface, wc, ev->keycode, TIZEN_KEYROUTER_MODE_PRESSED); - evtype = WL_KEYBOARD_KEY_STATE_PRESSED; - } - else - { - evtype = WL_KEYBOARD_KEY_STATE_RELEASED; - } - - serial = wl_display_next_serial(krt->cdata->wl.disp); - EINA_LIST_FOREACH(krt->cdata->kbd.resources, l, res) - { - if (res) - { - if (wl_resource_get_client(res) != wc_send) continue; - - 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); - wl_keyboard_send_key(res, serial, ev->timestamp, ev->keycode-8, evtype); - } - } -} - - static Eina_Bool _event_filter(void *data, void *loop_data EINA_UNUSED, int type, void *event) { @@ -661,7 +357,7 @@ _event_filter(void *data, void *loop_data EINA_UNUSED, int type, void *event) /* Filter only for key down/up event */ if (ECORE_EVENT_KEY_DOWN == type || ECORE_EVENT_KEY_UP == type) { - return _e_keyrouter_process_key_event(event, type); + return e_keyrouter_process_key_event(event, type); } return EINA_TRUE; @@ -834,17 +530,6 @@ _e_keyrouter_wl_array_length(const struct wl_array *array) return count; } -static struct wl_resource * -_e_keyrouter_util_get_surface_from_eclient(E_Client *client) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL - (client, NULL); - EINA_SAFETY_ON_NULL_RETURN_VAL - (client->comp_data, NULL); - - return client->comp_data->wl_surface; -} - static void _e_keyrouter_deinit_handlers(void) { diff --git a/src/e_mod_main_wl.h b/src/e_mod_main_wl.h index 4930738..37a88f7 100644 --- a/src/e_mod_main_wl.h +++ b/src/e_mod_main_wl.h @@ -91,4 +91,6 @@ void e_keyrouter_remove_client_from_list(struct wl_resource *surface, struct wl_ int e_keyrouter_add_client_destroy_listener(struct wl_client *client); int e_keyrouter_add_surface_destroy_listener(struct wl_resource *surface); +Eina_Bool e_keyrouter_process_key_event(void *event, int type); + #endif