diff options
author | Ian Fan <ianfan0@gmail.com> | 2019-02-28 12:02:14 +0000 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-04 12:50:47 -0500 |
commit | 7b5862d08c79483c0ed86329408256ab4676f52e (patch) | |
tree | b705cfbe8894a26981997d3375036bea53a77ba7 | |
parent | ecb646e12b3d395e729b9a6c4aef4eba9c6a726a (diff) | |
download | sway-7b5862d08c79483c0ed86329408256ab4676f52e.zip sway-7b5862d08c79483c0ed86329408256ab4676f52e.tar.gz sway-7b5862d08c79483c0ed86329408256ab4676f52e.tar.bz2 |
tray: fix pixmap colors
by converting from network byte order to host byte order
-rw-r--r-- | swaybar/tray/item.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c index 4fa6c97..027b300 100644 --- a/swaybar/tray/item.c +++ b/swaybar/tray/item.c @@ -1,4 +1,5 @@ #define _POSIX_C_SOURCE 200809L +#include <arpa/inet.h> #include <cairo.h> #include <stdbool.h> #include <stdlib.h> @@ -76,7 +77,12 @@ static int read_pixmap(sd_bus_message *msg, struct swaybar_sni *sni, struct swaybar_pixmap *pixmap = malloc(sizeof(struct swaybar_pixmap) + npixels); pixmap->size = height; - memcpy(pixmap->pixels, pixels, npixels); + + // convert from network byte order to host byte order + for (int i = 0; i < height * width; ++i) { + ((uint32_t *)pixmap->pixels)[i] = ntohl(((uint32_t *)pixels)[i]); + } + list_add(pixmaps, pixmap); } else { sway_log(SWAY_DEBUG, "%s %s: discard invalid icon w:%d h:%d", sni->watcher_id, prop, width, height); |