From: duna.oh Date: Wed, 7 May 2025 05:56:06 +0000 (+0900) Subject: keyrouter: add a check if focus client is changed while processing key events X-Git-Tag: accepted/tizen/9.0/unified/20250512.171609~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F51%2F323751%2F1;p=platform%2Fupstream%2Fenlightenment.git keyrouter: add a check if focus client is changed while processing key events Change-Id: Ibd7b30fe9fe83d0263f8a864efc0dcb70a1bd9a7 --- diff --git a/src/bin/inputmgr/e_keyrouter.c b/src/bin/inputmgr/e_keyrouter.c index 95fe4a9f1c..64135b4627 100644 --- a/src/bin/inputmgr/e_keyrouter.c +++ b/src/bin/inputmgr/e_keyrouter.c @@ -187,7 +187,7 @@ _e_keyrouter_input_thread_keygrab_print(void *data) fprintf(log_fl, " ----- Focus Window Info -----\n"); if (ec_focus) { - surface_focus = e_keyrouter_util_get_surface_from_eclient(ec_focus); + surface_focus = e_comp_wl_client_surface_get(ec_focus); if (surface_focus) { wc_focus = wl_resource_get_client(surface_focus); diff --git a/src/bin/inputmgr/e_keyrouter_events.c b/src/bin/inputmgr/e_keyrouter_events.c index c93adc9718..ceb0d71aee 100644 --- a/src/bin/inputmgr/e_keyrouter_events.c +++ b/src/bin/inputmgr/e_keyrouter_events.c @@ -667,7 +667,7 @@ _e_keyrouter_send_key_events_press(int type, Ecore_Event_Key *ev, E_Device *dev) Eina_List *shared_ptr_list = NULL; ec_focus = e_client_focused_get(); - surface_focus = e_keyrouter_util_get_surface_from_eclient(ec_focus); + surface_focus = e_comp_wl_client_surface_get(ec_focus); if (!_e_keyrouter_is_key_grabbed(ev->keycode)) { @@ -782,6 +782,11 @@ _e_keyrouter_send_key_events_press(int type, Ecore_Event_Key *ev, E_Device *dev) if (shared_ptr_list) { need_shared: + if (ec_focus != e_client_focused_get()) + { + KLWRN("focused ec is changed from (%p). no key events to focus client and shared", ec_focus); + surface_focus = NULL; + } res = _e_keyrouter_send_key_events_focus(type, surface_focus, ev, dev, &delivered_surface); if (delivered_surface) { @@ -865,6 +870,8 @@ _e_keyrouter_send_key_events_focus(int type, struct wl_resource *surface_focus, return EINA_FALSE; } + if (!surface_focus) return res; + pid = e_keyrouter_util_get_pid(NULL, surface_focus); cmd = e_keyrouter_util_cmd_get_from_pid(pid); pname = e_keyrouter_util_process_name_get_from_cmd(cmd); @@ -970,14 +977,6 @@ _e_keyrouter_send_key_event(int type, struct wl_resource *surface, struct wl_cli return; } -struct wl_resource * -e_keyrouter_util_get_surface_from_eclient(E_Client *client) -{ - if (!client || !client->comp_data) return NULL; - - return client->comp_data->wl_surface; -} - int e_keyrouter_util_get_pid(struct wl_client *client, struct wl_resource *surface) { diff --git a/src/bin/inputmgr/e_keyrouter_intern.h b/src/bin/inputmgr/e_keyrouter_intern.h index 478b0adc91..2f0e05dc25 100644 --- a/src/bin/inputmgr/e_keyrouter_intern.h +++ b/src/bin/inputmgr/e_keyrouter_intern.h @@ -163,7 +163,6 @@ EINTERN void e_keyrouter_remove_client_from_list(struct wl_resource *surface, st EINTERN int e_keyrouter_find_key_in_list(struct wl_resource *surface, struct wl_client *wc, uint32_t key); EINTERN Eina_Bool e_keyrouter_process_key_event(void *event, int type); -EINTERN struct wl_resource *e_keyrouter_util_get_surface_from_eclient(E_Client *client); EINTERN int e_keyrouter_util_get_pid(struct wl_client *client, struct wl_resource *surface); EINTERN char *e_keyrouter_util_cmd_get_from_pid(int pid); EINTERN char *e_keyrouter_util_process_name_get_from_cmd(char *cmd);