]> Pileus Git - ~andy/gtk/commitdiff
x11: Don't set ParentRealtive if the parent's visual is different
authorBenjamin Otte <otte@redhat.com>
Wed, 29 Sep 2010 10:06:19 +0000 (12:06 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 29 Sep 2010 10:18:17 +0000 (12:18 +0200)
Causes a BadMatch otherwise, see code comments.

https://bugzilla.gnome.org/show_bug.cgi?id=630864

gdk/x11/gdkwindow-x11.c

index 6931c2b44cf57383ee468caeca27c4a6b68c763f..df634b6b6563c6ca3374303d9f6bfdc1968b6522 100644 (file)
@@ -2639,8 +2639,17 @@ gdk_window_x11_set_background (GdkWindow      *window,
 
   if (pattern == NULL)
     {
-      XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
-                                  GDK_WINDOW_XID (window), ParentRelative);
+      GdkWindow *parent;
+
+      /* X throws BadMatch if the parent has a different visual when
+       * using ParentRelative */
+      parent = gdk_window_get_parent (window);
+      if (parent && gdk_window_get_visual (parent) == gdk_window_get_visual (window))
+        XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
+                                    GDK_WINDOW_XID (window), ParentRelative);
+      else
+        XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
+                                    GDK_WINDOW_XID (window), None);
       return;
     }