summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2019-05-22 12:29:37 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2019-05-22 12:34:11 +0200
commit034ed1756c916f83a1a1bfe322e71a2c366c9ec1 (patch)
treeb5c29dd66876668f82a35d18a7d25c2384715c1c
parent4ba89714049992eed5c9e196dedad5c84343d32f (diff)
downloadgtk+-034ed1756c916f83a1a1bfe322e71a2c366c9ec1.tar.gz
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>
-rw-r--r--gdk/wayland/gdkscreen-wayland.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 2457ecea2a..6aff3a5a1a 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -1591,16 +1591,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;