summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2022-01-07 19:30:27 +0100
committerJonas Ådahl <jadahl@gmail.com>2022-01-07 19:33:33 +0100
commitb86e6bc38aaa56a8f443cafb09efbdb9e02d99b8 (patch)
treeb6471bb62837ea54c5ce2f63b900073c32409003 /gdk
parentc3b3f4711df7a554997cd58a12a41787459a554a (diff)
downloadgtk+-b86e6bc38aaa56a8f443cafb09efbdb9e02d99b8.tar.gz
wayland/window: Only update the scale if on any outputs
If we ended up on no output at all, keep the HiDPI scale as is, as it likely means we were on a workspace that was switched away from. By keeping the same scale, we avoid unnecessary scale changes that would otherwise take place if the scale when on monitors would end up being more than 1.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/wayland/gdkwindow-wayland.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index f73ef302e5..943a570e86 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -753,12 +753,23 @@ window_update_scale (GdkWindow *window)
return;
}
- scale = 1;
- for (l = impl->display_server.outputs; l != NULL; l = l->next)
+ if (!impl->display_server.outputs)
{
- guint32 output_scale =
- _gdk_wayland_screen_get_output_scale (display_wayland->screen, l->data);
- scale = MAX (scale, output_scale);
+ scale = impl->scale;
+ }
+ else
+ {
+ scale = 1;
+ for (l = impl->display_server.outputs; l != NULL; l = l->next)
+ {
+ struct wl_output *output = l->data;
+ uint32_t output_scale;
+
+ output_scale =
+ _gdk_wayland_screen_get_output_scale (display_wayland->screen,
+ output);
+ scale = MAX (scale, output_scale);
+ }
}
/* Notify app that scale changed */