systray
fix serialised image data to be premultiplied alpha... and add printf debug so peolpe can reports what they see in future.
This commit is contained in:
parent
bd97c74492
commit
4b47dab0a2
|
@ -74,6 +74,7 @@ image_load(const char *name, const char *path, uint32_t *imgdata, int w, int h,
|
||||||
".jpg",
|
".jpg",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
printf("SYSTRAY: load image name=[%s] path=[%s] imgdata=[%p] size=[%ix%i]\n", name, path, imgdata, w, h);
|
||||||
if (path && path[0] && name)
|
if (path && path[0] && name)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
|
@ -74,6 +74,7 @@ icon_pixmap_deserialize(Eldbus_Message_Iter *variant, uint32_t **data, int *w, i
|
||||||
uint32_t *img;
|
uint32_t *img;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
printf("SYSTRAY: serialized image data is %ix%i\n", tmpw, tmph);
|
||||||
//only take this img if it has a higher resolution
|
//only take this img if it has a higher resolution
|
||||||
if ((tmpw > *w) || (tmph > *h))
|
if ((tmpw > *w) || (tmph > *h))
|
||||||
{
|
{
|
||||||
|
@ -90,18 +91,30 @@ icon_pixmap_deserialize(Eldbus_Message_Iter *variant, uint32_t **data, int *w, i
|
||||||
if (tmp)
|
if (tmp)
|
||||||
{
|
{
|
||||||
uint32_t *s, *d, *e;
|
uint32_t *s, *d, *e;
|
||||||
|
int r, g, b, a;
|
||||||
|
|
||||||
if (*data) free(*data);
|
if (*data) free(*data);
|
||||||
*data = tmp;
|
*data = tmp;
|
||||||
*w = tmpw;
|
*w = tmpw;
|
||||||
*h = tmph;
|
*h = tmph;
|
||||||
|
printf("SYSTRAY: fetching/converting serialized data...\n");
|
||||||
for (s = img, e = img + sz, d = *data;
|
for (s = img, e = img + sz, d = *data;
|
||||||
s < e; s++, d++)
|
s < e; s++, d++)
|
||||||
|
{
|
||||||
#if (defined __BYTE_ORDER && __BYTE_ORDER == __LITTLE_ENDIAN) || (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
#if (defined __BYTE_ORDER && __BYTE_ORDER == __LITTLE_ENDIAN) || (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||||
*d = eina_swap32(*s);
|
*d = eina_swap32(*s);
|
||||||
#else
|
#else
|
||||||
*d = *s;
|
*d = *s;
|
||||||
#endif
|
#endif
|
||||||
|
a = ((d[0] >> 24) & 0xff);
|
||||||
|
r = ((d[0] >> 16) & 0xff);
|
||||||
|
g = ((d[0] >> 0) & 0xff);
|
||||||
|
b = ((d[0] ) & 0xff);
|
||||||
|
r = (r * a) / 255;
|
||||||
|
g = (g * a) / 255;
|
||||||
|
b = (b * a) / 255;
|
||||||
|
*d = (a << 24) | (r << 16) | (g << 8) | b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,21 +133,25 @@ item_prop_get(void *data, const void *key, Eldbus_Message_Iter *var)
|
||||||
const char *category;
|
const char *category;
|
||||||
eldbus_message_iter_arguments_get(var, "s", &category);
|
eldbus_message_iter_arguments_get(var, "s", &category);
|
||||||
item->category = id_find(category, Category_Names);
|
item->category = id_find(category, Category_Names);
|
||||||
|
printf("SYSTRAY: %s [%s]\n", (const char *)key, category);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "IconName"))
|
else if (!strcmp(key, "IconName"))
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
eldbus_message_iter_arguments_get(var, "s", &name);
|
eldbus_message_iter_arguments_get(var, "s", &name);
|
||||||
eina_stringshare_replace(&item->icon_name, name);
|
eina_stringshare_replace(&item->icon_name, name);
|
||||||
|
printf("SYSTRAY: %s [%s]\n", (const char *)key, name);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "IconPixmap"))
|
else if (!strcmp(key, "IconPixmap"))
|
||||||
{
|
{
|
||||||
free(item->imgdata);
|
free(item->imgdata);
|
||||||
|
printf("SYSTRAY: %s ...\n", (const char *)key);
|
||||||
icon_pixmap_deserialize(var, &item->imgdata, &item->imgw, &item->imgh);
|
icon_pixmap_deserialize(var, &item->imgdata, &item->imgw, &item->imgh);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "AttentionIconPixmap"))
|
else if (!strcmp(key, "AttentionIconPixmap"))
|
||||||
{
|
{
|
||||||
free(item->attnimgdata);
|
free(item->attnimgdata);
|
||||||
|
printf("SYSTRAY: %s ...\n", (const char *)key);
|
||||||
icon_pixmap_deserialize(var, &item->attnimgdata, &item->attnimgw, &item->attnimgh);
|
icon_pixmap_deserialize(var, &item->attnimgdata, &item->attnimgw, &item->attnimgh);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "AttentionIconName"))
|
else if (!strcmp(key, "AttentionIconName"))
|
||||||
|
@ -142,36 +159,42 @@ item_prop_get(void *data, const void *key, Eldbus_Message_Iter *var)
|
||||||
const char *name;
|
const char *name;
|
||||||
eldbus_message_iter_arguments_get(var, "s", &name);
|
eldbus_message_iter_arguments_get(var, "s", &name);
|
||||||
eina_stringshare_replace(&item->attention_icon_name, name);
|
eina_stringshare_replace(&item->attention_icon_name, name);
|
||||||
|
printf("SYSTRAY: %s [%s]\n", (const char *)key, name);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "IconThemePath"))
|
else if (!strcmp(key, "IconThemePath"))
|
||||||
{
|
{
|
||||||
const char *path;
|
const char *path;
|
||||||
eldbus_message_iter_arguments_get(var, "s", &path);
|
eldbus_message_iter_arguments_get(var, "s", &path);
|
||||||
eina_stringshare_replace(&item->icon_path, path);
|
eina_stringshare_replace(&item->icon_path, path);
|
||||||
|
printf("SYSTRAY: %s [%s]\n", (const char *)key, path);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "Menu"))
|
else if (!strcmp(key, "Menu"))
|
||||||
{
|
{
|
||||||
const char *path;
|
const char *path;
|
||||||
eldbus_message_iter_arguments_get(var, "o", &path);
|
eldbus_message_iter_arguments_get(var, "o", &path);
|
||||||
eina_stringshare_replace(&item->menu_path, path);
|
eina_stringshare_replace(&item->menu_path, path);
|
||||||
|
printf("SYSTRAY: %s [%s]\n", (const char *)key, path);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "Status"))
|
else if (!strcmp(key, "Status"))
|
||||||
{
|
{
|
||||||
const char *status;
|
const char *status;
|
||||||
eldbus_message_iter_arguments_get(var, "s", &status);
|
eldbus_message_iter_arguments_get(var, "s", &status);
|
||||||
item->status = id_find(status, Status_Names);
|
item->status = id_find(status, Status_Names);
|
||||||
|
printf("SYSTRAY: %s [%s]\n", (const char *)key, status);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "Id"))
|
else if (!strcmp(key, "Id"))
|
||||||
{
|
{
|
||||||
const char *id;
|
const char *id;
|
||||||
eldbus_message_iter_arguments_get(var, "s", &id);
|
eldbus_message_iter_arguments_get(var, "s", &id);
|
||||||
eina_stringshare_replace(&item->id, id);
|
eina_stringshare_replace(&item->id, id);
|
||||||
|
printf("SYSTRAY: %s [%s]\n", (const char *)key, id);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "Title"))
|
else if (!strcmp(key, "Title"))
|
||||||
{
|
{
|
||||||
const char *title;
|
const char *title;
|
||||||
eldbus_message_iter_arguments_get(var, "s", &title);
|
eldbus_message_iter_arguments_get(var, "s", &title);
|
||||||
eina_stringshare_replace(&item->title, title);
|
eina_stringshare_replace(&item->title, title);
|
||||||
|
printf("SYSTRAY: %s [%s]\n", (const char *)key, title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +285,7 @@ attention_icon_pixmap_get_cb(void *data, const Eldbus_Message *msg, Eldbus_Pendi
|
||||||
|
|
||||||
if (!eldbus_message_arguments_get(msg, "v", &variant)) return;
|
if (!eldbus_message_arguments_get(msg, "v", &variant)) return;
|
||||||
free(item->attnimgdata);
|
free(item->attnimgdata);
|
||||||
|
printf("SYSTRAY: %s ...\n", "AttentionIconPixmap");
|
||||||
icon_pixmap_deserialize(variant, &item->attnimgdata, &item->attnimgw, &item->attnimgh);
|
icon_pixmap_deserialize(variant, &item->attnimgdata, &item->attnimgw, &item->attnimgh);
|
||||||
systray_notifier_item_update(item);
|
systray_notifier_item_update(item);
|
||||||
}
|
}
|
||||||
|
@ -293,6 +317,7 @@ icon_pixmap_get_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pendin
|
||||||
|
|
||||||
if (!eldbus_message_arguments_get(msg, "v", &variant)) return;
|
if (!eldbus_message_arguments_get(msg, "v", &variant)) return;
|
||||||
free(item->imgdata);
|
free(item->imgdata);
|
||||||
|
printf("SYSTRAY: %s ...\n", "IconPixmap");
|
||||||
icon_pixmap_deserialize(variant, &item->imgdata, &item->imgw, &item->imgh);
|
icon_pixmap_deserialize(variant, &item->imgdata, &item->imgw, &item->imgh);
|
||||||
systray_notifier_item_update(item);
|
systray_notifier_item_update(item);
|
||||||
}
|
}
|
||||||
|
@ -342,6 +367,7 @@ new_icon_theme_path_cb(void *data, const Eldbus_Message *msg)
|
||||||
ERR("Error reading message.");
|
ERR("Error reading message.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
printf("SYSTRAY: new icon theme path [%s]\n", path);
|
||||||
eina_stringshare_replace(&item->icon_path, path);
|
eina_stringshare_replace(&item->icon_path, path);
|
||||||
systray_notifier_item_update(item);
|
systray_notifier_item_update(item);
|
||||||
}
|
}
|
||||||
|
@ -356,6 +382,7 @@ new_status_cb(void *data, const Eldbus_Message *msg)
|
||||||
ERR("Error reading message.");
|
ERR("Error reading message.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
printf("SYSTRAY: new status [%s]\n", status);
|
||||||
item->status = id_find(status, Status_Names);
|
item->status = id_find(status, Status_Names);
|
||||||
systray_notifier_item_update(item);
|
systray_notifier_item_update(item);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue