diff --git a/src/bin/e_client.c b/src/bin/e_client.c index b27d2e2dc..45f824a29 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -3007,6 +3007,22 @@ e_client_focus_track_thaw(void) focus_track_frozen--; } +EAPI void +e_client_refocus(void) +{ + E_Client *ec; + const Eina_List *l; + + EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec) + if (ec->desk && ec->desk->visible && (!ec->iconic)) + { + if (ec->comp->input_key_grabs || ec->comp->input_mouse_grabs) break; + evas_object_focus_set(ec->frame, 1); + break; + } +} + + /* * Sets the focus to the given client if necessary * There are 3 cases of different focus_policy-configurations: diff --git a/src/bin/e_client.h b/src/bin/e_client.h index 06a8dece1..194f0f3fe 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -755,6 +755,7 @@ EAPI void e_client_raise_latest_set(E_Client *ec); EAPI Eina_Bool e_client_focus_track_enabled(void); EAPI void e_client_focus_track_freeze(void); EAPI void e_client_focus_track_thaw(void); +EAPI void e_client_refocus(void); EAPI void e_client_focus_set_with_pointer(E_Client *ec); EAPI void e_client_activate(E_Client *ec, Eina_Bool just_do_it); EAPI E_Client *e_client_focused_get(void); diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index a6b1d13d1..1d996a9b0 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -1748,8 +1748,6 @@ EAPI void e_comp_ungrab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd) { Ecore_Window mwin = 0, kwin = 0; - Eina_List *l; - E_Client *ec; mouse = !!mouse; kbd = !!kbd; @@ -1766,13 +1764,7 @@ e_comp_ungrab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd) evas_event_feed_mouse_out(c->evas, 0, NULL); evas_event_feed_mouse_in(c->evas, 0, NULL); if (e_client_focused_get()) return; - EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec) - if (ec->desk && ec->desk->visible && (!ec->iconic)) - { - if (ec->comp->input_key_grabs || ec->comp->input_mouse_grabs) break; - evas_object_focus_set(ec->frame, 1); - break; - } + e_client_refocus(); } EAPI void diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index 5c0d5077f..98f0ea21e 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -3493,19 +3493,10 @@ _e_comp_object_autoclose_show(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_ static void _e_comp_object_autoclose_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { - E_Client *ec; - Eina_List *l; - evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _e_comp_object_autoclose_show); _e_comp_object_autoclose_cleanup(data, 1); if (e_client_focused_get()) return; - EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec) - if (ec->desk && ec->desk->visible && (!ec->iconic)) - { - if (ec->comp->input_key_grabs || ec->comp->input_mouse_grabs) break; - evas_object_focus_set(ec->frame, 1); - break; - } + e_client_refocus(); } EAPI void