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.
This commit is contained in:
Derek Foreman 2016-07-13 16:01:51 -05:00 committed by Mike Blumenkrantz
parent bc54ad58f7
commit d9a660bff9
1 changed files with 16 additions and 1 deletions

View File

@ -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();