systray - fix re-fill on gadcon re-create e.g. when changing shelf cfg

change shelf config like orientation and systray goes blank. this
fixes it - delays re-fill to after main loop return with 0 sec timer

fixes #53

@fix
This commit is contained in:
Carsten Haitzler 2023-12-27 13:57:34 +00:00
parent c0cf9176dc
commit aa5fbfb1d3
3 changed files with 32 additions and 5 deletions

View File

@ -128,8 +128,10 @@ _redo_sizing(Instance *inst)
evas_object_geometry_get(inst->ui.gadget, NULL, NULL, &w, &h);
EINA_LIST_FOREACH(inst->icons, l, o)
{
edje_object_part_box_remove(inst->ui.gadget, "box", o);
if (_is_horiz(inst)) evas_object_size_hint_min_set(o, h, 0);
else evas_object_size_hint_min_set(o, 0, w);
edje_object_part_box_append(inst->ui.gadget, "box", o);
}
}
@ -203,6 +205,15 @@ _systray_theme(Evas_Object *o, const char *shelf_style, const char *gc_style)
e_theme_edje_object_set(o, NULL, _group_gadget);
}
static Eina_Bool
_systray_delay_fill_timer_cb(void *data)
{
Instance *inst = data;
systray_notifier_host_fill(inst->notifier);
inst->fill_timer = NULL;
return EINA_FALSE;
}
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
@ -245,6 +256,8 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
inst->notifier = systray_notifier_host_new(inst, inst->gcc->gadcon);
inst->fill_timer = ecore_timer_add(0.0, _systray_delay_fill_timer_cb, inst);
return inst->gcc;
}
@ -265,6 +278,8 @@ _gc_shutdown(E_Gadcon_Client *gcc)
if (inst->job.size_apply)
ecore_job_del(inst->job.size_apply);
if (inst->fill_timer)
ecore_timer_del(inst->fill_timer);
inst->icons = eina_list_free(inst->icons);
E_FREE(inst);

View File

@ -33,6 +33,7 @@ struct _Instance
Evas *evas;
Instance_Notifier_Host *notifier;
Eina_List *icons;
Ecore_Timer *fill_timer;
struct {
Evas_Object *gadget;
} ui;
@ -60,6 +61,7 @@ void systray_edje_box_remove(Instance *inst, Evas_Object *child);
void systray_edje_box_prepend(Instance *inst, Evas_Object *child);
Instance_Notifier_Host *systray_notifier_host_new(Instance *inst, E_Gadcon *gadcon);
void systray_notifier_host_fill(Instance_Notifier_Host *host_inst);
void systray_notifier_host_free(Instance_Notifier_Host *notifier);
void systray_notifier_host_init(void);
void systray_notifier_host_shutdown(void);

View File

@ -420,20 +420,30 @@ systray_notifier_item_update(Notifier_Item *item)
_systray_notifier_inst_item_update(inst, item, EINA_TRUE);
}
void
systray_notifier_host_fill(Instance_Notifier_Host *host_inst)
{
Notifier_Item *item;
EINA_INLIST_FOREACH(ctx->item_list, item)
{
_systray_notifier_inst_item_update(host_inst, item, EINA_FALSE);
}
}
Instance_Notifier_Host *
systray_notifier_host_new(Instance *inst, E_Gadcon *gadcon)
{
Instance_Notifier_Host *host_inst = NULL;
Notifier_Item *item;
host_inst = calloc(1, sizeof(Instance_Notifier_Host));
Instance_Notifier_Host *host_inst = calloc(1, sizeof(Instance_Notifier_Host));
EINA_SAFETY_ON_NULL_RETURN_VAL(host_inst, NULL);
host_inst->inst = inst;
host_inst->edje = systray_edje_get(inst);
host_inst->gadcon = gadcon;
ctx->instances = eina_inlist_append(ctx->instances, EINA_INLIST_GET(host_inst));
EINA_INLIST_FOREACH(ctx->item_list, item)
_systray_notifier_inst_item_update(host_inst, item, EINA_FALSE);
// systray_notifier_host_fill(host_inst);
return host_inst;
}