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
This commit is contained in:
Alberts Muktupāvels 2019-11-25 15:28:20 +02:00
parent a1a99bef83
commit 489fb1783b

View File

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