[gtk+] wayland: Create a cairo surface for the root window



commit 16e43733b96163c6365a6c04f5097722360ec5b2
Author: Rob Bradford <rob linux intel com>
Date:   Wed Jul 24 18:30:19 2013 +0100

    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

 gdk/wayland/gdkscreen-wayland.c |    7 ++++---
 gdk/wayland/gdkwindow-wayland.c |   14 ++++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 862b253..8144383 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -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;
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index f4db8da..acb29e3 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]