[gtk+] x11: Don't set ParentRealtive if the parent's visual is different



commit 82e6e32c770ac42187dc8a58ebf9ac99b35dfdd4
Author: Benjamin Otte <otte redhat com>
Date:   Wed Sep 29 12:06:19 2010 +0200

    x11: Don't set ParentRealtive if the parent's visual is different
    
    Causes a BadMatch otherwise, see code comments.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=630864

 gdk/x11/gdkwindow-x11.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 6931c2b..df634b6 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -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;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]