1
0
Fork 0

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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2723>
This commit is contained in:
Sebastian Wick 2022-11-28 17:41:52 +01:00 committed by Marge Bot
parent 753c768578
commit a2ed0f97c3

View file

@ -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