diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2016-03-10 15:18:47 -0500 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2016-03-10 15:18:47 -0500 |
commit | 57f62675cc07e7040cc8a96b7e76a2beb40659e2 (patch) | |
tree | 81f148ecfdd48a793d63019df57ee4e9fb0fdb01 | |
parent | b742baff5be4cb03ff19577841cff5cc4a2ee4f1 (diff) | |
download | enlightenment-57f62675cc07e7040cc8a96b7e76a2beb40659e2.tar.gz |
make wayland client keyboard focus list pruning more robust
this should handle all possible cases where focused keyboard resources
need to be removed from the global list
-rw-r--r-- | src/bin/e_comp_wl.c | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index f17a2e068f..7098b4381a 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -515,40 +515,52 @@ _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj } static void -_e_comp_wl_evas_cb_focus_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) +_e_comp_wl_keyboard_leave(E_Client *ec) { - E_Client *ec = data; struct wl_resource *res; + struct wl_client *wc; + Eina_List *l, *ll; uint32_t serial, *k; double t; - E_FREE_FUNC(ec->comp_data->on_focus_timer, ecore_timer_del); - - /* lower client priority */ - if (!e_object_is_del(data)) - _e_comp_wl_client_priority_normal(ec); - - if (!ec->comp_data->surface) return; - if (!eina_list_count(e_comp_wl->kbd.resources)) return; + if (!ec->comp_data) return; + if (!ec->comp_data->surface) return; - /* send keyboard_leave to all keyboard resources */ - if (!e_object_is_del(data)) + wc = wl_resource_get_client(ec->comp_data->surface); + if (!e_object_is_del(E_OBJECT(ec))) { serial = wl_display_next_serial(e_comp_wl->wl.disp); t = ecore_time_unix_get(); } - EINA_LIST_FREE(e_comp_wl->kbd.focused, res) + EINA_LIST_FOREACH_SAFE(e_comp_wl->kbd.focused, l, ll, res) { - if (e_object_is_del(data)) continue; - wl_array_for_each(k, &e_comp_wl->kbd.keys) - wl_keyboard_send_key(res, serial, t, - *k, WL_KEYBOARD_KEY_STATE_RELEASED); - wl_keyboard_send_leave(res, serial, ec->comp_data->surface); + if (wl_resource_get_client(res) != wc) continue; + if (!e_object_is_del(E_OBJECT(ec))) + { + wl_array_for_each(k, &e_comp_wl->kbd.keys) + wl_keyboard_send_key(res, serial, t, + *k, WL_KEYBOARD_KEY_STATE_RELEASED); + wl_keyboard_send_leave(res, serial, ec->comp_data->surface); + } + e_comp_wl->kbd.focused = eina_list_remove_list(e_comp_wl->kbd.focused, l); } } static void +_e_comp_wl_evas_cb_focus_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) +{ + E_Client *ec = data; + + E_FREE_FUNC(ec->comp_data->on_focus_timer, ecore_timer_del); + + /* lower client priority */ + if (!e_object_is_del(data)) + _e_comp_wl_client_priority_normal(ec); + _e_comp_wl_keyboard_leave(ec); +} + +static void _e_comp_wl_evas_cb_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { E_Client *sec, *ec = data; @@ -2140,6 +2152,7 @@ _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec) ec->parent->lock_close = EINA_FALSE; ec->parent->modal = NULL; } + _e_comp_wl_keyboard_leave(ec); wl_signal_emit(&ec->comp_data->destroy_signal, &ec->comp_data->surface); |