diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2016-07-13 16:01:51 -0500 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2016-07-15 09:59:55 -0400 |
commit | d9a660bff9e8fc0f1e163d1b3bd873658e4d8539 (patch) | |
tree | 7a0c79de07fd411a3c4663ea1eeed52cbe8fe4cb | |
parent | bc54ad58f7ff15493bbb767340d6c477383e5134 (diff) | |
download | enlightenment-d9a660bff9e8fc0f1e163d1b3bd873658e4d8539.tar.gz |
Make sure the same keyboard resource doesn't end up on the focus list twice
This stops recent xdg_popup focus tracking changes from causing multiple
key events to be sent to the focused client.
-rw-r--r-- | src/bin/e_comp_wl.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 61debb2b8c..7f2bef4313 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -486,6 +486,19 @@ _e_comp_wl_evas_cb_focus_in_timer(E_Client *ec) return EINA_FALSE; } +static Eina_Bool +_keyboard_resource_add(struct wl_resource *newres) +{ + Eina_List *l; + struct wl_resource *res; + + EINA_LIST_FOREACH(e_comp_wl->kbd.focused, l, res) + if (res == newres) return EINA_FALSE; + + e_comp_wl->kbd.focused = eina_list_append(e_comp_wl->kbd.focused, newres); + return EINA_TRUE; +} + static void _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { @@ -493,6 +506,7 @@ _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj struct wl_resource *res; struct wl_client *wc; Eina_List *l; + int added = 0; if (!(ec = data)) return; if (e_object_is_del(E_OBJECT(ec))) return; @@ -508,8 +522,9 @@ _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj wc = wl_resource_get_client(ec->comp_data->surface); EINA_LIST_FOREACH(e_comp_wl->kbd.resources, l, res) if (wl_resource_get_client(res) == wc) - e_comp_wl->kbd.focused = eina_list_append(e_comp_wl->kbd.focused, res); + added |= _keyboard_resource_add(res); if (!e_comp_wl->kbd.focused) return; + if (!added) return; e_comp_wl_input_keyboard_enter_send(ec); if (e_comp_util_kbd_grabbed()) return; e_comp_wl_data_device_keyboard_focus_set(); |