From adbb5719f0e0d00cac4743b0de4581703d883966 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Wed, 14 Oct 2015 12:18:41 +0200 Subject: [PATCH] systray: search for the best available resolution of a icon For example in telegram the first icon which was transmitted was in a pretty bad resolution, the new code searches the best res. --- .../systray/e_mod_notifier_host_dbus.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/modules/systray/e_mod_notifier_host_dbus.c b/src/modules/systray/e_mod_notifier_host_dbus.c index 7975bade3..75867dc3f 100644 --- a/src/modules/systray/e_mod_notifier_host_dbus.c +++ b/src/modules/systray/e_mod_notifier_host_dbus.c @@ -60,6 +60,7 @@ static void icon_pixmap_deserialize(Eldbus_Message_Iter *variant, uint32_t **data, int *w, int *h) { Eldbus_Message_Iter *iter, *struc; + int tmpw, tmph; *data = NULL; *w = *h = 0; @@ -68,19 +69,24 @@ icon_pixmap_deserialize(Eldbus_Message_Iter *variant, uint32_t **data, int *w, i { Eldbus_Message_Iter *imgdata; - if (eldbus_message_iter_arguments_get(struc, "iiay", w, h, &imgdata)) + if (eldbus_message_iter_arguments_get(struc, "iiay", &tmpw, &tmph, &imgdata)) { uint32_t *img; int len; - if (eldbus_message_iter_fixed_array_get(imgdata, 'y', &img, &len)) + //only take this img if it has a higher resolution + if (tmpw > *w || tmph > *h) { - unsigned int pos; + *w = tmpw; + *h = tmph; + if (eldbus_message_iter_fixed_array_get(imgdata, 'y', &img, &len)) + { + unsigned int pos; - *data = malloc(len * sizeof(int)); - for (pos = 0; pos < (unsigned int)len; pos++) - (*data)[pos] = eina_swap32(img[pos]); - return; + *data = malloc(len * sizeof(int)); + for (pos = 0; pos < (unsigned int)len; pos++) + (*data)[pos] = eina_swap32(img[pos]); + } } } }