bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=adbb5719f0e0d00cac4743b0de4581703d883966

commit adbb5719f0e0d00cac4743b0de4581703d883966
Author: Marcel Hollerbach <marcel-hollerb...@t-online.de>
Date:   Wed Oct 14 12:18:41 2015 +0200

    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.
---
 src/modules/systray/e_mod_notifier_host_dbus.c | 22 ++++++++++++++--------
 1 file 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 7975bad..75867dc 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]);
+                    }
                }
           }
      }

-- 


Reply via email to