music control - dont flicker album art on multiple repeated prop changes

when u switch songs with popup the album art flickered on/off a few
times because mnpris props updated multilpe times. this ignores new
art url changes if they are the same file/url to avoid flickers.
This commit is contained in:
Carsten Haitzler 2021-01-08 14:04:31 +00:00
parent ff875f40a6
commit d5658d2190
4 changed files with 18 additions and 3 deletions

View File

@ -172,6 +172,7 @@ e_icon_file_set(Evas_Object *obj, const char *file)
return;
}
if ((sd->url) && (!strcmp(sd->url, file))) return;
/* smart code here */
_e_icon_obj_prepare(obj, sd);
/* FIXME: 64x64 - unhappy about this. use icon size */

View File

@ -625,6 +625,7 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
E_FREE_FUNC(ctxt->meta_album, eina_stringshare_del);
E_FREE_FUNC(ctxt->meta_artist, eina_stringshare_del);
E_FREE_FUNC(ctxt->meta_cover, eina_stringshare_del);
E_FREE_FUNC(ctxt->meta_cover_prev, eina_stringshare_del);
if (ctxt->poll_timer) ecore_timer_del(ctxt->poll_timer);
ctxt->poll_timer = NULL;

View File

@ -22,6 +22,7 @@ typedef struct _E_Music_Control_Module_Context
Eina_Stringshare *meta_album;
Eina_Stringshare *meta_title;
Eina_Stringshare *meta_cover;
Eina_Stringshare *meta_cover_prev;
Eldbus_Proxy *mrpis2;
Eldbus_Proxy *mpris2_player;
E_Config_DD *conf_edd;

View File

@ -50,11 +50,23 @@ _metadata_update(E_Music_Control_Instance *inst)
img = edje_object_part_swallow_get(inst->content_popup, "cover_swallow");
if (img)
{
e_comp_object_util_del_list_remove(inst->popup->comp_object, img);
evas_object_del(img);
if (inst->ctxt->meta_cover_prev != inst->ctxt->meta_cover)
{
e_comp_object_util_del_list_remove(inst->popup->comp_object, img);
evas_object_del(img);
img = NULL;
if (inst->ctxt->meta_cover_prev)
{
eina_stringshare_del(inst->ctxt->meta_cover_prev);
inst->ctxt->meta_cover_prev = NULL;
}
}
}
if (inst->ctxt->meta_cover)
if ((!img) && (inst->ctxt->meta_cover))
{
if (inst->ctxt->meta_cover)
inst->ctxt->meta_cover_prev = eina_stringshare_add(inst->ctxt->meta_cover);
img = e_icon_add(evas_object_evas_get(inst->content_popup));
e_icon_scale_size_set(img, 512);
e_icon_scale_up_set(img, EINA_TRUE);