[gtk/gtk-3-24: 2/3] gdk/wayland: go through monitor to compute scale factor



commit 6d545b6d03caba8e7718a73c6e0abe35a4133fe0
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Sat Aug 3 22:31:53 2019 +0300

    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 <llandwerlin gmail com>

 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);
     }
 


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