forked from enlightenment/enlightenment
add a timer for wl client focus to delay held key input
this prevents keys from immediately being sent to newly-focused clients and avoids the case of reverting focus from one app to another on keybind close, only to have the second app also close immediately using the same keybind
This commit is contained in:
parent
738622b068
commit
5cbbe261d7
|
@ -482,11 +482,27 @@ _e_comp_wl_client_priority_normal(E_Client *ec)
|
|||
EINA_FALSE, EINA_TRUE, EINA_FALSE);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_comp_wl_evas_cb_focus_in_timer(E_Client *ec)
|
||||
{
|
||||
uint32_t serial, *k;
|
||||
struct wl_resource *res;
|
||||
Eina_List *l;
|
||||
|
||||
ec->comp_data->on_focus_timer = NULL;
|
||||
|
||||
serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp);
|
||||
EINA_LIST_FOREACH(e_comp->wl_comp_data->kbd.focused, l, res)
|
||||
wl_array_for_each(k, &e_comp->wl_comp_data->kbd.keys)
|
||||
wl_keyboard_send_key(res, serial, ecore_time_unix_get(),
|
||||
*k, WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
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;
|
||||
uint32_t serial, *k;
|
||||
struct wl_resource *res;
|
||||
struct wl_client *wc;
|
||||
Eina_List *l;
|
||||
|
@ -508,11 +524,7 @@ _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
|
|||
e_comp->wl_comp_data->kbd.focused = eina_list_append(e_comp->wl_comp_data->kbd.focused, res);
|
||||
if (!e_comp->wl_comp_data->kbd.focused) return;
|
||||
e_comp_wl_input_keyboard_enter_send(ec);
|
||||
serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp);
|
||||
EINA_LIST_FOREACH(e_comp->wl_comp_data->kbd.focused, l, res)
|
||||
wl_array_for_each(k, &e_comp->wl_comp_data->kbd.keys)
|
||||
wl_keyboard_send_key(res, serial, ecore_time_unix_get(),
|
||||
*k, WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||
ec->comp_data->on_focus_timer = ecore_timer_add(0.8, (Ecore_Task_Cb)_e_comp_wl_evas_cb_focus_in_timer, ec);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -530,6 +542,8 @@ _e_comp_wl_evas_cb_focus_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
|
|||
|
||||
if (!ec->comp_data) return;
|
||||
|
||||
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);
|
||||
|
|
|
@ -237,7 +237,7 @@ struct _E_Comp_Wl_Data
|
|||
|
||||
struct _E_Comp_Wl_Client_Data
|
||||
{
|
||||
Ecore_Timer *first_draw_tmr;
|
||||
Ecore_Timer *on_focus_timer;
|
||||
|
||||
struct
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue