x11: Correctly set icons
authorBenjamin Otte <otte@redhat.com>
Tue, 7 Nov 2017 11:22:48 +0000 (12:22 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 7 Nov 2017 11:24:43 +0000 (12:24 +0100)
X11 obviously doesn't use 4 bytes for a 4 bytes pixel. Rather, it uses
unsigned long, which happens to be 8 bytes these days.

gdk/x11/gdkwindow-x11.c

index d4be4efd4f409adaadcbfaef693df44be7e33a06..a9f31fd65a832e0ef7800bcaf92f948b35f7435c 100644 (file)
@@ -3241,7 +3241,7 @@ gdk_x11_window_set_icon_list (GdkWindow *window,
   gint width, height;
   GdkTexture *texture;
   GdkDisplay *display;
-  gint n;
+  gint i, n;
 
   if (GDK_WINDOW_DESTROYED (window) ||
       !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
@@ -3280,6 +3280,12 @@ gdk_x11_window_set_icon_list (GdkWindow *window,
       *p++ = height;
 
       gdk_texture_download (texture, (guchar *) p, width * 4);
+      if (sizeof (gulong) > 4)
+        {
+          i = width * height;
+          while (i-- > 0)
+            p[i] = ((guint32 *) p)[i];
+        }
 
       p += width * height;
       n--;