Fix a bootstrapping problem without root windows

We create various windows during the initial creation of display
objects, which causes some bootstrapping issues when we try to
find the default screen to get its root window. To work around this,
pass the display object into gdk_window_new.

This is not an API change, since gdk_window_new is no longer public API.
This commit is contained in:
Matthias Clasen 2017-08-12 09:36:49 -04:00
parent d5e25be9bc
commit 124b790a77
3 changed files with 11 additions and 11 deletions

View File

@ -368,7 +368,8 @@ void gdk_cairo_set_drawing_context (cairo_t *cr,
cairo_surface_t *
_gdk_window_ref_cairo_surface (GdkWindow *window);
GdkWindow* gdk_window_new (GdkWindow *parent,
GdkWindow* gdk_window_new (GdkDisplay *display,
GdkWindow *parent,
GdkWindowAttr *attributes);
void _gdk_window_destroy (GdkWindow *window,
gboolean foreign_destroy);

View File

@ -976,12 +976,12 @@ get_native_event_mask (GdkWindow *private)
}
GdkWindow*
gdk_window_new (GdkWindow *parent,
gdk_window_new (GdkDisplay *display,
GdkWindow *parent,
GdkWindowAttr *attributes)
{
GdkWindow *window;
GdkScreen *screen;
GdkDisplay *display;
gboolean native;
GdkEventMask event_mask;
@ -989,7 +989,7 @@ gdk_window_new (GdkWindow *parent,
if (!parent)
{
screen = gdk_screen_get_default ();
screen = gdk_display_get_default_screen (display);
parent = gdk_screen_get_root_window (screen);
}
else
@ -1003,8 +1003,6 @@ gdk_window_new (GdkWindow *parent,
return NULL;
}
display = gdk_screen_get_display (screen);
window = _gdk_display_create_window (display);
window->parent = parent;
@ -1159,7 +1157,7 @@ gdk_window_new_toplevel (GdkDisplay *display,
attr.height = height;
attr.window_type = GDK_WINDOW_TOPLEVEL;
return gdk_window_new (NULL, &attr);
return gdk_window_new (display, NULL, &attr);
}
/**
@ -1193,7 +1191,7 @@ gdk_window_new_popup (GdkDisplay *display,
attr.height = position->height;
attr.window_type = GDK_WINDOW_TEMP;
return gdk_window_new (NULL, &attr);
return gdk_window_new (display, NULL, &attr);
}
/**
@ -1224,7 +1222,7 @@ gdk_window_new_temp (GdkDisplay *display)
attr.height = 10;
attr.window_type = GDK_WINDOW_TEMP;
return gdk_window_new (NULL, &attr);
return gdk_window_new (display, NULL, &attr);
}
/**
@ -1256,7 +1254,7 @@ gdk_window_new_child (GdkWindow *parent,
attr.height = position->height;
attr.window_type = GDK_WINDOW_CHILD;
return gdk_window_new (parent, &attr);
return gdk_window_new (gdk_window_get_display (parent), parent, &attr);
}
/**

View File

@ -3719,7 +3719,8 @@ gdk_wayland_window_new_subsurface (GdkDisplay *display,
attr.height = position->height;
attr.window_type = GDK_WINDOW_SUBSURFACE;
return gdk_window_new (gdk_screen_get_root_window (gdk_display_get_default_screen (display)),
return gdk_window_new (display,
gdk_screen_get_root_window (gdk_display_get_default_screen (display)),
&attr);
}