Disambiguate output mapped to tablet with connector name

This commit is contained in:
Carlos Garnacho 2024-02-07 21:31:59 +01:00 committed by root
parent 5ee7781b49
commit 31f3a1b0d5
3 changed files with 114 additions and 1 deletions

1
.mutter.metadata Normal file
View File

@ -0,0 +1 @@
f9b20f8330ecdb76fc887c4a99c03b406e26fd66 mutter-40.9.tar.xz

View File

@ -0,0 +1,106 @@
From 8d340beb368b3b59637c91e2e6e4adbc81ce7caf Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 7 Feb 2024 21:27:32 +0100
Subject: [PATCH] backends: Disambiguate output mapped to tablet with connector
name
In some circumstances, we may end up with outputs with the same
vendor/product/serial, in which case we have a hard time finding the
right one to map tablets to, since configuration only has these 3
pieces of data.
Add the handling of a 4th argument containing the output name
based on the connector (e.g. HDMI-1), so that it can be used to
disambiguate the output if necessary.
This only kicks in if there actually are multiple outputs with the
same EDID data. A goal of the configuration as it was stored was to
remain useful if the user changed how the device is physically
connected to the computer, this remains true for the vast majority
of users having a single thing of each.
---
src/backends/meta-input-mapper.c | 43 +++++++++++++++++++++++++++++---
1 file changed, 39 insertions(+), 4 deletions(-)
diff --git a/src/backends/meta-input-mapper.c b/src/backends/meta-input-mapper.c
index ae4cd05..a0a4b8a 100644
--- a/src/backends/meta-input-mapper.c
+++ b/src/backends/meta-input-mapper.c
@@ -395,9 +395,33 @@ match_builtin (MetaInputMapper *mapper,
return monitor == meta_monitor_manager_get_laptop_panel (mapper->monitor_manager);
}
+static gboolean
+monitor_has_twin (MetaMonitor *monitor,
+ GList *monitors)
+{
+ GList *l;
+
+ for (l = monitors; l; l = l->next)
+ {
+ if (l->data == monitor)
+ continue;
+
+ if (g_strcmp0 (meta_monitor_get_vendor (monitor),
+ meta_monitor_get_vendor (l->data)) == 0 &&
+ g_strcmp0 (meta_monitor_get_product (monitor),
+ meta_monitor_get_product (l->data)) == 0 &&
+ g_strcmp0 (meta_monitor_get_serial (monitor),
+ meta_monitor_get_serial (l->data)) == 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static gboolean
match_config (MetaMapperInputInfo *info,
- MetaMonitor *monitor)
+ MetaMonitor *monitor,
+ GList *monitors)
{
gboolean match = FALSE;
char **edid;
@@ -406,10 +430,10 @@ match_config (MetaMapperInputInfo *info,
edid = g_settings_get_strv (info->settings, "output");
n_values = g_strv_length (edid);
- if (n_values != 3)
+ if (n_values < 3)
{
g_warning ("EDID configuration for device '%s' "
- "is incorrect, must have 3 values",
+ "is incorrect, must have at least 3 values",
clutter_input_device_get_device_name (info->device));
goto out;
}
@@ -421,6 +445,17 @@ match_config (MetaMapperInputInfo *info,
g_strcmp0 (meta_monitor_get_product (monitor), edid[1]) == 0 &&
g_strcmp0 (meta_monitor_get_serial (monitor), edid[2]) == 0);
+ if (match && n_values >= 4 && monitor_has_twin (monitor, monitors))
+ {
+ /* The 4th value if set contains the ID (e.g. HDMI-1), use it
+ * for disambiguation if multiple monitors with the same
+ * EDID data are found.
+ */
+ MetaOutput *output;
+ output = meta_monitor_get_main_output (monitor);
+ match = g_strcmp0 (meta_output_get_name (output), edid[3]) == 0;
+ }
+
out:
g_strfreev (edid);
@@ -481,7 +516,7 @@ guess_candidates (MetaInputMapper *mapper,
if (builtin && match_builtin (mapper, l->data))
match.score |= 1 << META_MATCH_IS_BUILTIN;
- if (match_config (input, l->data))
+ if (match_config (input, l->data, monitors))
match.score |= 1 << META_MATCH_CONFIG;
if (match.score > 0)
--
2.43.0

View File

@ -10,7 +10,7 @@
Name: mutter
Version: 40.9
Release: 15%{?dist}
Release: 16%{?dist}
Summary: Window and compositing manager based on Clutter
License: GPLv2+
@ -113,6 +113,8 @@ Patch46: 0001-clutter-text-Don-t-query-preferred-size-without-allo.patch
Patch47: 0001-core-Change-MetaWaylandTextInput-event-forwarding-to.patch
Patch48: 0001-backends-Disambiguate-output-mapped-to-tablet-with-c.patch
BuildRequires: chrpath
BuildRequires: pango-devel
BuildRequires: startup-notification-devel
@ -260,6 +262,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%{_datadir}/mutter-%{mutter_api_version}/tests
%changelog
* Tue Feb 06 2024 Carlos Garnacho <cgarnach@redhat.com> - 40.9-16
- Disambiguate output mapped to tablet with connector name
Resolves: RHEL-28535
* Mon Jul 10 2023 Carlos Garnacho <cgarnach@redhat.com> - 40.9-15
- Fix ordering of keyboard modifiers relative to other keyboard events
Resolves: #2218146