From 97f0e2e69101e8c90ae88a5c5958273b664a7939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timotej=20=C5=A0ul=C3=ADk?= Date: Mon, 12 Jun 2023 00:06:34 +0200 Subject: [PATCH] monitor: Ensure the preferred mode is always included If there are two display modes present with the same flags, and one of them is the preferred mode, it could have been excluded from the resulting list of display modes. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2858 Part-of: --- src/backends/meta-monitor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index 00502bb35..084048406 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -781,7 +781,10 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal) * otherwise take the first one in the list. This guarantees that the * preferred mode is always added. */ - replace = crtc_mode_info->flags == preferred_mode_flags; + replace = (crtc_mode_info->flags == preferred_mode_flags && + (!monitor_priv->preferred_mode || + g_strcmp0 (meta_monitor_mode_get_id (monitor_priv->preferred_mode), + mode->id) != 0)); if (!meta_monitor_add_mode (monitor, mode, replace)) {