[gtk: 1/2] gdk/wayland: Take transform into account when setting physical size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] gdk/wayland: Take transform into account when setting physical size
- Date: Wed, 5 May 2021 15:23:27 +0000 (UTC)
commit e40c869d0dc9ba4037c3f3f256e0ef4544312cae
Author: Guido Günther <agx sigxcpu org>
Date: Wed May 5 13:59:26 2021 +0200
gdk/wayland: Take transform into account when setting physical size
Width and height of a GdkMonitor are derived via wl_output which
talks about physical dimensions of a device and compositors usually
implement this as the untransformed values (e.g. weston, wlroots).
Since the GTK client has no way to figure out if a monitor was rotated,
transform the physical dimensions according to the applied wayland
transform to have the physical dimensions match the logical ones.
Mutter flips the physical dimensions itself but doesn't announce the
transform so this shouldn't break anything there.
gdk/wayland/gdkdisplay-wayland.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 41b2069a77..34fbf234c4 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -2380,7 +2380,21 @@ output_handle_geometry (void *data,
monitor->x = x;
monitor->y = y;
- gdk_monitor_set_physical_size (GDK_MONITOR (monitor), physical_width, physical_height);
+
+ switch (transform)
+ {
+ case WL_OUTPUT_TRANSFORM_90:
+ case WL_OUTPUT_TRANSFORM_270:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+ case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+ gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
+ physical_height, physical_width);
+ break;
+ default:
+ gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
+ physical_width, physical_height);
+ }
+
gdk_monitor_set_subpixel_layout (GDK_MONITOR (monitor), subpixel);
gdk_monitor_set_manufacturer (GDK_MONITOR (monitor), make);
gdk_monitor_set_model (GDK_MONITOR (monitor), model);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]