Blame SOURCES/0001-backends-Check-both-input-settings-and-mapper-for-ta.patch

1a3082
From f14730e7307679cb979aa521b20f246dfc5082da Mon Sep 17 00:00:00 2001
1a3082
From: Carlos Garnacho <carlosg@gnome.org>
1a3082
Date: Fri, 13 Dec 2019 15:26:05 +0100
1a3082
Subject: [PATCH] backends: Check both input settings and mapper for tablet
1a3082
 monitors
1a3082
1a3082
The upper layers (OSDs basically) want to know the monitor that a
1a3082
tablet is currently assigned to, not the monitor just as configured
1a3082
through settings.
1a3082
1a3082
This broke proper OSD positioning for display-attached tablets since
1a3082
commit 87858a4e01d9, as the MetaInputMapper kicks in precisely when
1a3082
there is no configured monitor for the given device.
1a3082
1a3082
Consulting both about the assigned output will make OSDs pop up
1a3082
again in the right place.
1a3082
1a3082
https://gitlab.gnome.org/GNOME/mutter/merge_requests/971
1a3082
---
1a3082
 src/backends/meta-input-mapper-private.h |  3 +++
1a3082
 src/backends/meta-input-mapper.c         | 26 ++++++++++++++++++++++++
1a3082
 src/backends/meta-input-settings.c       | 11 ++++++++--
1a3082
 3 files changed, 38 insertions(+), 2 deletions(-)
1a3082
1a3082
diff --git a/src/backends/meta-input-mapper-private.h b/src/backends/meta-input-mapper-private.h
1a3082
index 34314577f..cdfdccde9 100644
1a3082
--- a/src/backends/meta-input-mapper-private.h
1a3082
+++ b/src/backends/meta-input-mapper-private.h
1a3082
@@ -42,5 +42,8 @@ ClutterInputDevice *
1a3082
 meta_input_mapper_get_logical_monitor_device (MetaInputMapper        *mapper,
1a3082
                                               MetaLogicalMonitor     *logical_monitor,
1a3082
                                               ClutterInputDeviceType  device_type);
1a3082
+MetaLogicalMonitor *
1a3082
+meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper,
1a3082
+                                              ClutterInputDevice *device);
1a3082
 
1a3082
 #endif /* META_INPUT_MAPPER_H */
1a3082
diff --git a/src/backends/meta-input-mapper.c b/src/backends/meta-input-mapper.c
1a3082
index acc9b1618..571b3983c 100644
1a3082
--- a/src/backends/meta-input-mapper.c
1a3082
+++ b/src/backends/meta-input-mapper.c
1a3082
@@ -684,3 +684,29 @@ meta_input_mapper_get_logical_monitor_device (MetaInputMapper        *mapper,
1a3082
 
1a3082
   return NULL;
1a3082
 }
1a3082
+
1a3082
+MetaLogicalMonitor *
1a3082
+meta_input_mapper_get_device_logical_monitor (MetaInputMapper    *mapper,
1a3082
+                                              ClutterInputDevice *device)
1a3082
+{
1a3082
+  MetaMapperOutputInfo *output;
1a3082
+  MetaLogicalMonitor *logical_monitor;
1a3082
+  GHashTableIter iter;
1a3082
+  GList *l;
1a3082
+
1a3082
+  g_hash_table_iter_init (&iter, mapper->output_devices);
1a3082
+
1a3082
+  while (g_hash_table_iter_next (&iter, (gpointer *) &logical_monitor,
1a3082
+                                 (gpointer *) &output))
1a3082
+    {
1a3082
+      for (l = output->input_devices; l; l = l->next)
1a3082
+        {
1a3082
+          MetaMapperInputInfo *input = l->data;
1a3082
+
1a3082
+          if (input->device == device)
1a3082
+            return logical_monitor;
1a3082
+        }
1a3082
+    }
1a3082
+
1a3082
+  return NULL;
1a3082
+}
1a3082
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
1a3082
index b7aec8d6d..a923aa971 100644
1a3082
--- a/src/backends/meta-input-settings.c
1a3082
+++ b/src/backends/meta-input-settings.c
1a3082
@@ -1922,8 +1922,15 @@ meta_input_settings_get_tablet_logical_monitor (MetaInputSettings  *settings,
1a3082
   if (!info)
1a3082
     return NULL;
1a3082
 
1a3082
-  meta_input_settings_find_monitor (settings, info->settings, device,
1a3082
-                                    NULL, &logical_monitor);
1a3082
+  logical_monitor =
1a3082
+    meta_input_mapper_get_device_logical_monitor (priv->input_mapper, device);
1a3082
+
1a3082
+  if (!logical_monitor)
1a3082
+    {
1a3082
+      meta_input_settings_find_monitor (settings, info->settings, device,
1a3082
+                                        NULL, &logical_monitor);
1a3082
+    }
1a3082
+
1a3082
   return logical_monitor;
1a3082
 }
1a3082
 
1a3082
-- 
1a3082
2.23.0
1a3082