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
This commit is contained in:
Benjamin Otte 2010-09-29 12:06:19 +02:00
parent 72d48cbc61
commit 82e6e32c77

View 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;
}