[gtk: 1/2] wayland: Use scale from core wl_output protocol



commit 713fceb1bdadb1a036bf9a8ea8c0288ef2bdc13a
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Wed May 22 12:11:36 2019 +0200

    wayland: Use scale from core wl_output protocol
    
    The “xdg-output” protocol provides clients with the outputs size and
    position in compositor coordinates, and does not provide the output
    scale which is already provided by the core “wl_output” protocol.
    
    So when receiving the wl_output scale event, we should update the scale
    regardless of “xdg-output” support, otherwise the scale will remain to
    its default value of 1 and the surface will be scaled up by the
    compositor to match the actual output scale, which causes blurry fonts
    and widgets.
    
    Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1901
    Signed-off-by: Olivier Fourdan <ofourdan redhat com>

 gdk/wayland/gdkdisplay-wayland.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index b4e51d6c63..d721026d54 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -2357,16 +2357,18 @@ output_handle_scale (void             *data,
   GDK_NOTE (MISC,
             g_message ("handle scale output %d, scale %d", monitor->id, scale));
 
-  if (monitor_has_xdg_output (monitor))
-    return;
-
   gdk_monitor_get_geometry (GDK_MONITOR (monitor), &previous_geometry);
   previous_scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
 
+  /* Set the scale from wl_output protocol, regardless of xdg-output support */
+  gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), scale);
+
+  if (monitor_has_xdg_output (monitor))
+    return;
+
   width = previous_geometry.width * previous_scale;
   height = previous_geometry.height * previous_scale;
 
-  gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), scale);
   monitor->width = width / scale;
   monitor->height = height / scale;
 


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