summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-10-14 12:18:41 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-10-14 22:40:47 +0200
commitadbb5719f0e0d00cac4743b0de4581703d883966 (patch)
tree3a840140935506d3b3e2d19f157bad4a920b9adb
parent432d1e37768a8218764ca8176a041f120f1c9253 (diff)
downloadenlightenment-adbb5719f0e0d00cac4743b0de4581703d883966.tar.gz
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.
-rw-r--r--src/modules/systray/e_mod_notifier_host_dbus.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/modules/systray/e_mod_notifier_host_dbus.c b/src/modules/systray/e_mod_notifier_host_dbus.c
index 7975bade3e..75867dc3f3 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;
-
- *data = malloc(len * sizeof(int));
- for (pos = 0; pos < (unsigned int)len; pos++)
- (*data)[pos] = eina_swap32(img[pos]);
- return;
+ *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]);
+ }
}
}
}