ibar - kill off ibar not in order icon if last window for exe goes away

@fix
This commit is contained in:
Carsten Haitzler 2022-12-12 19:52:46 +00:00
parent 6122bf24bb
commit 6cca3f77e8
1 changed files with 31 additions and 0 deletions

View File

@ -2702,6 +2702,35 @@ _ibar_cb_client_prop(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client_Prop
return ECORE_CALLBACK_RENEW;
}
static Eina_Bool
_ibar_cb_client_del(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client *ev)
{
IBar *b;
Eina_List *l, *ll;
E_Exec_Instance *exe;
int client_num = 0;
if (!ev->ec->desktop) return ECORE_CALLBACK_RENEW; //can't do anything here :(
EINA_LIST_FOREACH(ibars, l, b)
{
IBar_Icon *ic;
ic = eina_hash_find(b->icon_hash, _desktop_name_get(ev->ec->desktop));
if (ic)
{
if (ic->not_in_order)
{
EINA_LIST_FOREACH(ic->exes, ll, exe)
{
client_num += eina_list_count(exe->clients);
}
if (client_num == 0) _ibar_icon_free(ic);
}
}
}
return ECORE_CALLBACK_RENEW;
}
static Eina_Bool
_ibar_cb_exec_del(void *d EINA_UNUSED, int t EINA_UNUSED, E_Exec_Instance *exe)
{
@ -2891,6 +2920,8 @@ e_modapi_init(E_Module *m)
_ibar_cb_exec_del, NULL);
E_LIST_HANDLER_APPEND(ibar_config->handlers, E_EVENT_CLIENT_PROPERTY,
_ibar_cb_client_prop, NULL);
E_LIST_HANDLER_APPEND(ibar_config->handlers, E_EVENT_CLIENT_REMOVE,
_ibar_cb_client_del, NULL);
e_gadcon_provider_register(&_gadcon_class);
ibar_orders = eina_hash_string_superfast_new(NULL);