From 69d42639b2c3bb6637402a82448c0db39f24d858 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sat, 16 Feb 2013 11:54:12 -0500 Subject: [PATCH] GdkWindowX11: the root window is not a toplevel The macros we had for checking for toplevel windows were passing through the root window, which was not intentional and meant that for the root window WINDOW_IS_TOPLEVEL() returned TRUE but window->impl->toplevel was NULL, causing gdk_window_create_cairo_surface() to crash. --- gdk/x11/gdkwindow-x11.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 4f30287b23..26eaf697a4 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -111,14 +111,14 @@ static void gdk_window_x11_set_background (GdkWindow *window, static void gdk_window_impl_x11_finalize (GObject *object); -#define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \ - (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \ - GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN) +#define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \ + (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL || \ + GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || \ + GDK_WINDOW_TYPE (window) == GDK_WINDOW_FOREIGN) -#define WINDOW_IS_TOPLEVEL(window) \ - (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \ - GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \ - GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN) +#define WINDOW_IS_TOPLEVEL(window) \ + (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL || \ + GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP) /* Return whether time1 is considered later than time2 as far as xserver * time is concerned. Accounts for wraparound.