break out client focus reset into separate function

This commit is contained in:
Mike Blumenkrantz 2014-02-20 11:47:44 -05:00
parent 4bf4fb69ed
commit f75a923ab0
4 changed files with 19 additions and 19 deletions

View File

@ -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:

View File

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

View File

@ -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

View File

@ -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