e winlist/at tab - understand stacks and filter accordingly

This commit is contained in:
Carsten Haitzler 2016-12-19 17:58:23 +09:00
parent 8b6ba41a66
commit fbb514e009
1 changed files with 88 additions and 4 deletions

View File

@ -92,9 +92,10 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter)
{
int x, y, w, h;
Evas_Object *o;
Eina_List *l;
Eina_List *l, *ll;
E_Desk *desk;
E_Client *ec;
E_Winlist_Win *ww;
Eina_List *wmclasses = NULL;
E_OBJECT_CHECK_RETURN(zone, 0);
@ -169,6 +170,15 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter)
EINA_LIST_FOREACH(e_client_focus_stack_get(), l, ec)
{
Eina_Bool pick;
// adjust to toplevel client
ec = e_client_stack_active_adjust(ec);
// skip if we already have it in winlist
EINA_LIST_FOREACH(_wins, ll, ww)
{
if (ww->client == ec) break;
}
if (ll) continue;
switch (filter)
{
case E_WINLIST_FILTER_CLASS_WINDOWS:
@ -712,6 +722,67 @@ _e_winlist_client_del(E_Client *ec)
}
}
static void
_e_winlist_client_replace(E_Client *ec, E_Client *ec_new)
{
E_Winlist_Win *ww;
Eina_List *l;
E_Desk *desk;
Eina_Bool replace_last = EINA_FALSE;
desk = e_desk_current_get(_winlist_zone);
if (ec == _last_client)
{
_last_client = NULL;
replace_last = EINA_TRUE;
}
EINA_LIST_FOREACH(_wins, l, ww)
{
if (ww->client == ec)
{
Evas_Object *o;
Evas_Coord mw, mh;
e_object_unref(E_OBJECT(ww->client));
ww->client = ec_new;
edje_object_part_text_set(ww->bg_object, "e.text.label",
e_client_util_name_get(ww->client));
if (ww->icon_object)
{
e_comp_object_util_del_list_remove(_winlist, ww->icon_object);
evas_object_del(ww->icon_object);
ww->icon_object = NULL;
}
if (edje_object_part_exists(ww->bg_object, "e.swallow.icon"))
{
o = e_client_icon_add(ww->client, e_comp->evas);
ww->icon_object = o;
e_comp_object_util_del_list_append(_winlist, o);
edje_object_part_swallow(ww->bg_object, "e.swallow.icon", o);
evas_object_show(o);
}
if (ww->client->shaded)
edje_object_signal_emit(ww->bg_object, "e,state,shaded", "e");
else if (ww->client)
edje_object_signal_emit(ww->bg_object, "e,state,iconified", "e");
else if (ww->client->desk != desk)
{
if (!((ww->client->sticky) &&
(ww->client->zone == _winlist_zone)))
edje_object_signal_emit(ww->bg_object, "e,state,invisible", "e");
}
edje_object_size_min_calc(ww->bg_object, &mw, &mh);
E_WEIGHT(ww->bg_object, 1, 0);
E_FILL(ww->bg_object);
evas_object_size_hint_min_set(ww->bg_object, mw, mh);
evas_object_size_hint_max_set(ww->bg_object, 9999, mh);
e_object_ref(E_OBJECT(ww->client));
if (replace_last) _last_client = ec_new;
return;
}
}
}
static void
_e_winlist_activate_nth(int n)
{
@ -895,10 +966,21 @@ _e_winlist_cb_event_border_add(void *data EINA_UNUSED, int type EINA_UNUSED,
void *event)
{
E_Event_Client *ev = event;
E_Client *ec = ev->ec;
Eina_List *l;
E_Winlist_Win *ww;
if (_e_winlist_client_add(ev->ec, _winlist_zone,
e_desk_current_get(_winlist_zone)))
// adjust to toplevel client
ec = e_client_stack_active_adjust(ec);
// skip if we already have it in winlist
EINA_LIST_FOREACH(_wins, l, ww)
{
if (ww->client == ec) goto done;
}
if (_e_winlist_client_add(ec, _winlist_zone,
e_desk_current_get(_winlist_zone)))
_e_winlist_size_adjust();
done:
return ECORE_CALLBACK_PASS_ON;
}
@ -907,8 +989,10 @@ _e_winlist_cb_event_border_remove(void *data EINA_UNUSED, int type EINA_UNUSED,
void *event)
{
E_Event_Client *ev = event;
E_Client *ec = ev->ec;
_e_winlist_client_del(ev->ec);
if (!ec->stack.prev) _e_winlist_client_del(ec);
else _e_winlist_client_replace(ec, e_client_stack_active_adjust(ec));
_e_winlist_size_adjust();
return ECORE_CALLBACK_PASS_ON;
}