wayland: Create a cairo surface for the root window

Many parts of GTK+ assume that all windows have a cairo surface
assoicated with them. This change provides a logically 1x1 cairo surface
(respecting scale) for the root window.

https://bugzilla.gnome.org/show_bug.cgi?id=704554
This commit is contained in:
Rob Bradford 2013-07-24 18:30:19 +01:00
parent 977c6cf4c7
commit 16e43733b9
2 changed files with 18 additions and 3 deletions

View File

@ -805,12 +805,13 @@ _gdk_wayland_screen_new (GdkDisplay *display)
screen_wayland->visual = gdk_wayland_visual_new (screen);
init_multihead (screen);
screen_wayland->root_window =
_gdk_wayland_screen_create_root_window (screen,
screen_wayland->width,
screen_wayland->height);
screen_wayland->width,
screen_wayland->height);
init_multihead (screen);
init_settings (screen);
return screen;

View File

@ -237,6 +237,20 @@ _gdk_wayland_screen_create_root_window (GdkScreen *screen,
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
impl->wrapper = GDK_WINDOW (window);
if (gdk_screen_get_n_monitors(screen) > 0)
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
else
impl->scale = 1;
/* logical 1x1 fake buffer */
impl->cairo_surface =
cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
impl->scale,
impl->scale);
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
cairo_surface_set_device_scale (impl->cairo_surface, impl->scale, impl->scale);
#endif
window->window_type = GDK_WINDOW_ROOT;
window->depth = 32;