From 27b403268092728e48a35befc513c0cc46972989 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sat, 3 Aug 2019 22:30:53 +0300 Subject: [PATCH 1/2] gdk/wayland: remove unused variable Signed-off-by: Lionel Landwerlin --- gdk/wayland/gdkmonitor-wayland.h | 1 - 1 file changed, 1 deletion(-) diff --git a/gdk/wayland/gdkmonitor-wayland.h b/gdk/wayland/gdkmonitor-wayland.h index 69592bd28a..8c65bbfc4a 100644 --- a/gdk/wayland/gdkmonitor-wayland.h +++ b/gdk/wayland/gdkmonitor-wayland.h @@ -29,7 +29,6 @@ struct _GdkWaylandMonitor { guint32 id; guint32 version; struct wl_output *output; - gboolean added; struct zxdg_output_v1 *xdg_output; /* Size and position, can be either from wl_output or xdg_output */ From 6d545b6d03caba8e7718a73c6e0abe35a4133fe0 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sat, 3 Aug 2019 22:31:53 +0300 Subject: [PATCH 2/2] gdk/wayland: go through monitor to compute scale factor The current code only goes through the output associated to the window's wayland surface enter/leave events. That means that to update the scale factor the window only looks at the outputs on which it received enter/leave events. That doesn't include a new monitor connected to the system on which the window might be display next. The spirit of the existing logic seems to be to go through all the scale factor available on the current monitors of the system and pick the highest. So fix the current behavior by looking at the monitor on the display. Fixes #1144. Signed-off-by: Lionel Landwerlin --- gdk/wayland/gdkwindow-wayland.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 1c62c8f65e..be0b9681d6 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -651,11 +651,10 @@ on_frame_clock_after_paint (GdkFrameClock *clock, static void window_update_scale (GdkWindow *window) { - GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); guint32 scale; - GSList *l; + int i; if (display_wayland->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE) { @@ -664,10 +663,10 @@ window_update_scale (GdkWindow *window) } scale = 1; - for (l = impl->display_server.outputs; l != NULL; l = l->next) + for (i = 0; i < display_wayland->monitors->len; i++) { - guint32 output_scale = - _gdk_wayland_screen_get_output_scale (display_wayland->screen, l->data); + GdkWaylandMonitor *monitor = display_wayland->monitors->pdata[i]; + int output_scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor)); scale = MAX (scale, output_scale); }