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.
This commit is contained in:
parent
432d1e3776
commit
adbb5719f0
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue