From a2ed0f97c37c552d4e288933529a0a4f9936d1d9 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Mon, 28 Nov 2022 17:41:52 +0100 Subject: [PATCH] wayland/outputs: Make wl_output mode independent of the orientation wl_output describes the physical attributes and the mode of an output is such a physical attribute. Swapping the width and height creates another, incorrect mode. Other compositors also report the physical mode and don't try to transform it based on the orientation of buffers. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2519 Part-of: --- src/wayland/meta-wayland-outputs.c | 31 ++++++------------------------ 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c index c2ed5986b..dfd21a37f 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -144,23 +144,6 @@ calculate_wayland_output_scale (MetaMonitor *monitor) return ceilf (scale); } -static void -get_native_output_mode_resolution (MetaMonitor *monitor, - MetaMonitorMode *mode, - int *mode_width, - int *mode_height) -{ - MetaLogicalMonitor *logical_monitor; - MetaMonitorTransform transform; - - logical_monitor = meta_monitor_get_logical_monitor (monitor); - transform = meta_logical_monitor_get_transform (logical_monitor); - if (meta_monitor_transform_is_rotated (transform)) - meta_monitor_mode_get_resolution (mode, mode_height, mode_width); - else - meta_monitor_mode_get_resolution (mode, mode_width, mode_height); -} - static enum wl_output_transform wl_output_transform_from_transform (MetaMonitorTransform transform) { @@ -259,10 +242,9 @@ send_output_events (struct wl_resource *resource, if (current_mode == preferred_mode) mode_flags |= WL_OUTPUT_MODE_PREFERRED; - get_native_output_mode_resolution (monitor, - current_mode, - &new_width, - &new_height); + meta_monitor_mode_get_resolution (current_mode, + &new_width, + &new_height); if (need_all_events || wayland_output->mode_width != new_width || wayland_output->mode_height != new_height || @@ -383,10 +365,9 @@ meta_wayland_output_set_monitor (MetaWaylandOutput *wayland_output, wayland_output->transform = meta_logical_monitor_get_transform (logical_monitor); - get_native_output_mode_resolution (monitor, - current_mode, - &wayland_output->mode_width, - &wayland_output->mode_height); + meta_monitor_mode_get_resolution (current_mode, + &wayland_output->mode_width, + &wayland_output->mode_height); } static void