Pager: Remember to remove deleted desks.

This commit is contained in:
Stephen 'Okra' Houston 2017-08-30 13:22:23 -05:00
parent 18ce3e4d93
commit 03ea4bfe39
1 changed files with 12 additions and 29 deletions

View File

@ -536,7 +536,7 @@ _pager_fill(Pager *p)
{ {
if ((p->plain) || (pager_config->permanent_plain)) if ((p->plain) || (pager_config->permanent_plain))
{ {
if (!eina_list_count(phandlers)) if (!phandlers)
{ {
E_LIST_HANDLER_APPEND(phandlers, E_EVENT_CLIENT_RESIZE, _pager_cb_event_client_resize, NULL); E_LIST_HANDLER_APPEND(phandlers, E_EVENT_CLIENT_RESIZE, _pager_cb_event_client_resize, NULL);
E_LIST_HANDLER_APPEND(phandlers, E_EVENT_CLIENT_MOVE, _pager_cb_event_client_move, NULL); E_LIST_HANDLER_APPEND(phandlers, E_EVENT_CLIENT_MOVE, _pager_cb_event_client_move, NULL);
@ -580,7 +580,7 @@ _pager_empty(Pager *p)
p->active_pd = NULL; p->active_pd = NULL;
if (!(p->plain) && !(pager_config->permanent_plain)) if (!(p->plain) && !(pager_config->permanent_plain))
{ {
if (eina_list_count(phandlers)) if (!phandlers)
{ {
Ecore_Event_Handler *handler; Ecore_Event_Handler *handler;
EINA_LIST_FREE(phandlers, handler) EINA_LIST_FREE(phandlers, handler)
@ -713,12 +713,9 @@ _pager_desk_free(Pager_Desk *pd)
evas_object_del(pd->drop_handler); evas_object_del(pd->drop_handler);
pd->drop_handler = NULL; pd->drop_handler = NULL;
evas_object_del(pd->o_desk); evas_object_del(pd->o_desk);
evas_object_del(pd->o_layout); evas_object_del(pd->o_layout);
if (pd->wins) EINA_LIST_FREE(pd->wins, w)
{ _pager_window_free(w);
EINA_LIST_FREE(pd->wins, w)
_pager_window_free(w);
}
e_object_unref(E_OBJECT(pd->desk)); e_object_unref(E_OBJECT(pd->desk));
free(pd); free(pd);
} }
@ -1775,7 +1772,7 @@ static Eina_Bool
_pager_cb_event_zone_desk_count_set(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Zone_Desk_Count_Set *ev) _pager_cb_event_zone_desk_count_set(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Zone_Desk_Count_Set *ev)
{ {
E_Desk *desk; E_Desk *desk;
Eina_List *l; Eina_List *l, *ll;
Pager *p; Pager *p;
Pager_Desk *pd = NULL; Pager_Desk *pd = NULL;
int x, y, xx, yy; int x, y, xx, yy;
@ -1800,26 +1797,12 @@ _pager_cb_event_zone_desk_count_set(void *data EINA_UNUSED, int type EINA_UNUSED
} }
} }
} }
if (xx < p->xnum) EINA_LIST_FOREACH(p->desks, ll, pd)
{ {
for (y = 0; y < yy; y++) if (!e_desk_at_xy_get(p->zone, pd->xpos, pd->ypos))
{ {
for (x = xx; x < p->xnum; x++) p->desks = eina_list_remove(p->desks, pd);
{ _pager_desk_free(pd);
pd = eina_list_nth(p->desks, x + (y * p->xnum));
_pager_desk_free(pd);
}
}
}
if (yy < p->ynum)
{
for (x = 0; x < xx; x++)
{
for (y = yy; y < p->ynum; y++)
{
pd = eina_list_nth(p->desks, x + (y * p->xnum));
_pager_desk_free(pd);
}
} }
} }
e_zone_desk_count_get(p->zone, &(p->xnum), &(p->ynum)); e_zone_desk_count_get(p->zone, &(p->xnum), &(p->ynum));
@ -1837,7 +1820,7 @@ _pager_cb_event_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev
Pager_Popup *pp; Pager_Popup *pp;
Pager_Desk *pd; Pager_Desk *pd;
if (!eina_list_count(pagers)) if (!pagers)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
EINA_LIST_FOREACH(pagers, l, p) EINA_LIST_FOREACH(pagers, l, p)
@ -1904,7 +1887,7 @@ _pager_cb_event_client_urgent_change(void *data EINA_UNUSED, int type EINA_UNUSE
Pager_Win *pw; Pager_Win *pw;
if (!(ev->property & E_CLIENT_PROPERTY_URGENCY)) return ECORE_CALLBACK_RENEW; if (!(ev->property & E_CLIENT_PROPERTY_URGENCY)) return ECORE_CALLBACK_RENEW;
if (!eina_list_count(pagers)) return ECORE_CALLBACK_RENEW; if (!pagers) return ECORE_CALLBACK_RENEW;
if (pager_config->popup_urgent && (!e_client_util_desk_visible(ev->ec, e_desk_current_get(ev->ec->zone))) && if (pager_config->popup_urgent && (!e_client_util_desk_visible(ev->ec, e_desk_current_get(ev->ec->zone))) &&
(pager_config->popup_urgent_focus || (pager_config->popup_urgent_focus ||