Backport upstream MR3299 to fix disabling scale-monitor-framebuffer

https://bugzilla.redhat.com/show_bug.cgi?id=2242061
This commit is contained in:
Kalev Lember 2023-10-04 10:51:44 +02:00
parent c47a34687d
commit 20a16a1f8a
2 changed files with 61 additions and 0 deletions

58
3299.patch Normal file
View File

@ -0,0 +1,58 @@
From 4008ed2f55d4621a4ed2230799c1ab2d012b3545 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 27 Sep 2023 22:59:13 +0800
Subject: [PATCH] monitor-config-store: Discard config with fractional scale
when unusable
When a configuration has a fractional scale, but we're using a physical
monitor layout, we can't use the scale, but if we do, we end up with
wierd issues down the line. Just discard the config if we run into this.
Eventually we probably want to store the layout mode in the
configuration so we can handle more seamless switching between physical
and logical layout mode, but first do this.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3057
---
src/backends/meta-monitor-config-store.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/backends/meta-monitor-config-store.c b/src/backends/meta-monitor-config-store.c
index fe9406fd3f7..53a32cd2aaf 100644
--- a/src/backends/meta-monitor-config-store.c
+++ b/src/backends/meta-monitor-config-store.c
@@ -653,6 +653,7 @@ derive_logical_monitor_layout (MetaLogicalMonitorConfig *logical_monitor_conf
MetaMonitorConfig *monitor_config;
int mode_width, mode_height;
int width = 0, height = 0;
+ float scale;
GList *l;
monitor_config = logical_monitor_config->monitor_configs->data;
@@ -683,13 +684,21 @@ derive_logical_monitor_layout (MetaLogicalMonitorConfig *logical_monitor_conf
height = mode_height;
}
+ scale = logical_monitor_config->scale;
+
switch (layout_mode)
{
case META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL:
- width = roundf (width / logical_monitor_config->scale);
- height = roundf (height / logical_monitor_config->scale);
+ width = roundf (width / scale);
+ height = roundf (height / scale);
break;
case META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL:
+ if (!G_APPROX_VALUE (scale, roundf (scale), FLT_EPSILON))
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "A fractional scale with physical layout mode not allowed");
+ return FALSE;
+ }
break;
}
--
GitLab

View File

@ -36,6 +36,9 @@ Patch5: 0001-util-Add-way-to-print-backtraces.patch
Patch6: 0002-clutter-Add-ms2ns-helper.patch
Patch7: 0003-native-Stop-using-real-time-thread-if-it-stalls.patch
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3299
Patch8: 3299.patch
BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.41.0
BuildRequires: pkgconfig(polkit-gobject-1)
BuildRequires: pkgconfig(sm)