From 4d80185e6970aea7f8b7143722321743ca1bc234 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 10 Feb 2015 19:17:50 -0500 Subject: [PATCH] send wl keyboard enter during commit in some cases this was happening before the kbd resource was available; this guarantees that it will be --- src/bin/e_comp_wl.c | 47 +++++++++++++++++++++++---------------------- src/bin/e_comp_wl.h | 1 + 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 040480067..795991d99 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -507,11 +507,6 @@ static void _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { E_Client *ec, *focused; - E_Comp_Data *cdata; - struct wl_resource *res; - struct wl_client *wc; - uint32_t serial, *k; - Eina_List *l; if (!(ec = data)) return; if (e_object_is_del(E_OBJECT(ec))) return; @@ -525,24 +520,7 @@ _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj /* raise client priority */ _e_comp_wl_client_priority_raise(ec); - - cdata = ec->comp->wl_comp_data; - - /* update keyboard modifier state */ - wl_array_for_each(k, &cdata->kbd.keys) - e_comp_wl_input_keyboard_state_update(cdata, *k, EINA_TRUE); - - if (!ec->comp_data->surface) return; - - /* send keyboard_enter to all keyboard resources */ - wc = wl_resource_get_client(ec->comp_data->surface); - serial = wl_display_next_serial(cdata->wl.disp); - EINA_LIST_FOREACH(cdata->kbd.resources, l, res) - { - if (wl_resource_get_client(res) != wc) continue; - wl_keyboard_send_enter(res, serial, ec->comp_data->surface, - &cdata->kbd.keys); - } + ec->comp_data->focus_update = 1; } static void @@ -579,6 +557,7 @@ _e_comp_wl_evas_cb_focus_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob if (wl_resource_get_client(res) != wc) continue; wl_keyboard_send_leave(res, serial, ec->comp_data->surface); } + ec->comp_data->focus_update = 0; } static void @@ -2546,6 +2525,28 @@ e_comp_wl_surface_commit(E_Client *ec) if (!(ep = ec->pixmap)) return EINA_FALSE; _e_comp_wl_client_evas_init(ec); + if (ec->focused && ec->comp_data->focus_update) + { + struct wl_resource *res; + struct wl_client *wc; + uint32_t serial, *k; + Eina_List *l; + + /* update keyboard modifier state */ + wl_array_for_each(k, &e_comp->wl_comp_data->kbd.keys) + e_comp_wl_input_keyboard_state_update(e_comp->wl_comp_data, *k, EINA_TRUE); + + /* send keyboard_enter to all keyboard resources */ + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp); + EINA_LIST_FOREACH(e_comp->wl_comp_data->kbd.resources, l, res) + { + if (wl_resource_get_client(res) != wc) continue; + wl_keyboard_send_enter(res, serial, ec->comp_data->surface, + &e_comp->wl_comp_data->kbd.keys); + } + ec->comp_data->focus_update = 0; + } /* mark the pixmap as usable or not */ e_pixmap_usable_set(ep, (ec->comp_data->pending.buffer != NULL)); diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index 9d29c3b04..ba0713444 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -263,6 +263,7 @@ struct _E_Comp_Wl_Client_Data Eina_Bool first_damage : 1; Eina_Bool set_win_type : 1; Eina_Bool frame_update : 1; + Eina_Bool focus_update : 1; }; EAPI Eina_Bool e_comp_wl_init(void);