From 82e6e32c770ac42187dc8a58ebf9ac99b35dfdd4 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 29 Sep 2010 12:06:19 +0200 Subject: [PATCH] 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 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 6931c2b44c..df634b6b65 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; }