[gtk/wip/muktupavels/root-surface-scale: 62/62] gdkscreen-x11: update device scale also for root window



commit 489fb1783b8e3544db36eeb8d14e31ac1afaa0f1
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Nov 25 15:28:20 2019 +0200

    gdkscreen-x11: update device scale also for root window
    
    Window scale can change at runtime. If cairo_surface is already
    created for root window gdk_pixbuf_get_from_window will return
    wrong image.
    
    _gdk_x11_screen_set_window_scale already updates window_scale for
    root window, update also cairo_surface device scale.
    
    https://gitlab.gnome.org/GNOME/gtk/merge_requests/1208

 gdk/x11/gdkscreen-x11.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 8939ae9fac..a4b2ebc18a 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -1007,6 +1007,10 @@ _gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen,
   root = x11_screen->root_window;
   GDK_WINDOW_IMPL_X11 (root->impl)->window_scale = scale;
 
+  if (GDK_WINDOW_IMPL_X11 (root->impl)->cairo_surface)
+    cairo_surface_set_device_scale (GDK_WINDOW_IMPL_X11 (root->impl)->cairo_surface,
+                                    scale, scale);
+
   toplevels = gdk_screen_get_toplevel_windows (GDK_SCREEN (x11_screen));
 
   for (l = toplevels; l != NULL; l = l->next)


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