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.
This commit is contained in:
Owen W. Taylor 2013-02-16 11:54:12 -05:00
parent bae84bdf23
commit 69d42639b2

View File

@ -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.