|
|
7cc7ff |
From 20fcc3e045287c1ca591f3e795b19e120479a89a Mon Sep 17 00:00:00 2001
|
|
|
7cc7ff |
From: Carlos Garnacho <carlosg@gnome.org>
|
|
|
7cc7ff |
Date: Wed, 12 Feb 2020 20:26:56 +0100
|
|
|
7cc7ff |
Subject: [PATCH 1/2] backends/x11: Implement is_grouped for X11
|
|
|
7cc7ff |
|
|
|
7cc7ff |
If the devices have a wacom description, compare those. Otherwise,
|
|
|
7cc7ff |
look up the devices' VID:PID, if they match they should also be
|
|
|
7cc7ff |
grouped.
|
|
|
7cc7ff |
|
|
|
7cc7ff |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/971
|
|
|
7cc7ff |
---
|
|
|
7cc7ff |
.../clutter/x11/clutter-input-device-xi2.c | 25 +++++++++++++++++++
|
|
|
7cc7ff |
1 file changed, 25 insertions(+)
|
|
|
7cc7ff |
|
|
|
7cc7ff |
diff --git a/clutter/clutter/x11/clutter-input-device-xi2.c b/clutter/clutter/x11/clutter-input-device-xi2.c
|
|
|
7cc7ff |
index ae2fa27..9eca34d 100644
|
|
|
7cc7ff |
--- a/clutter/clutter/x11/clutter-input-device-xi2.c
|
|
|
7cc7ff |
+++ b/clutter/clutter/x11/clutter-input-device-xi2.c
|
|
|
7cc7ff |
@@ -98,6 +98,31 @@ static gboolean
|
|
|
7cc7ff |
clutter_input_device_xi2_is_grouped (ClutterInputDevice *device,
|
|
|
7cc7ff |
ClutterInputDevice *other_device)
|
|
|
7cc7ff |
{
|
|
|
7cc7ff |
+#ifdef HAVE_LIBWACOM
|
|
|
7cc7ff |
+ ClutterInputDeviceXI2 *device_x11 = CLUTTER_INPUT_DEVICE_XI2 (device);
|
|
|
7cc7ff |
+ ClutterInputDeviceXI2 *other_device_x11 = CLUTTER_INPUT_DEVICE_XI2 (other_device);
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ if (device_x11->wacom_device &&
|
|
|
7cc7ff |
+ other_device_x11->wacom_device &&
|
|
|
7cc7ff |
+ libwacom_compare (device_x11->wacom_device,
|
|
|
7cc7ff |
+ other_device_x11->wacom_device,
|
|
|
7cc7ff |
+ WCOMPARE_NORMAL) == 0)
|
|
|
7cc7ff |
+ return TRUE;
|
|
|
7cc7ff |
+#endif
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ /* Devices with the same VID:PID get grouped together */
|
|
|
7cc7ff |
+ if (clutter_input_device_get_vendor_id (device) &&
|
|
|
7cc7ff |
+ clutter_input_device_get_product_id (device) &&
|
|
|
7cc7ff |
+ clutter_input_device_get_vendor_id (other_device) &&
|
|
|
7cc7ff |
+ clutter_input_device_get_product_id (other_device))
|
|
|
7cc7ff |
+ {
|
|
|
7cc7ff |
+ if (strcmp (clutter_input_device_get_vendor_id (device),
|
|
|
7cc7ff |
+ clutter_input_device_get_vendor_id (other_device)) == 0 &&
|
|
|
7cc7ff |
+ strcmp (clutter_input_device_get_product_id (device),
|
|
|
7cc7ff |
+ clutter_input_device_get_product_id (other_device)) == 0)
|
|
|
7cc7ff |
+ return TRUE;
|
|
|
7cc7ff |
+ }
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
return FALSE;
|
|
|
7cc7ff |
}
|
|
|
7cc7ff |
|
|
|
7cc7ff |
--
|
|
|
7cc7ff |
2.24.1
|
|
|
7cc7ff |
|
|
|
7cc7ff |
|
|
|
7cc7ff |
From 5914ab9ac79ce42da054036c4a8f118a3a868cc0 Mon Sep 17 00:00:00 2001
|
|
|
7cc7ff |
From: Carlos Garnacho <carlosg@gnome.org>
|
|
|
7cc7ff |
Date: Fri, 13 Dec 2019 15:26:05 +0100
|
|
|
7cc7ff |
Subject: [PATCH 2/2] backends: Check both input settings and mapper for tablet
|
|
|
7cc7ff |
monitors
|
|
|
7cc7ff |
|
|
|
7cc7ff |
The upper layers (OSDs basically) want to know the monitor that a
|
|
|
7cc7ff |
tablet is currently assigned to, not the monitor just as configured
|
|
|
7cc7ff |
through settings.
|
|
|
7cc7ff |
|
|
|
7cc7ff |
This broke proper OSD positioning for display-attached tablets since
|
|
|
7cc7ff |
commit 87858a4e01d9, as the MetaInputMapper kicks in precisely when
|
|
|
7cc7ff |
there is no configured monitor for the given device.
|
|
|
7cc7ff |
|
|
|
7cc7ff |
Consulting both about the assigned output will make OSDs pop up
|
|
|
7cc7ff |
again in the right place.
|
|
|
7cc7ff |
|
|
|
7cc7ff |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/971
|
|
|
7cc7ff |
---
|
|
|
7cc7ff |
src/backends/meta-input-mapper-private.h | 3 ++
|
|
|
7cc7ff |
src/backends/meta-input-mapper.c | 26 ++++++++++++
|
|
|
7cc7ff |
src/backends/meta-input-settings.c | 54 +++++++++++++++++++++++-
|
|
|
7cc7ff |
3 files changed, 81 insertions(+), 2 deletions(-)
|
|
|
7cc7ff |
|
|
|
7cc7ff |
diff --git a/src/backends/meta-input-mapper-private.h b/src/backends/meta-input-mapper-private.h
|
|
|
7cc7ff |
index 3431457..cdfdccd 100644
|
|
|
7cc7ff |
--- a/src/backends/meta-input-mapper-private.h
|
|
|
7cc7ff |
+++ b/src/backends/meta-input-mapper-private.h
|
|
|
7cc7ff |
@@ -42,5 +42,8 @@ ClutterInputDevice *
|
|
|
7cc7ff |
meta_input_mapper_get_logical_monitor_device (MetaInputMapper *mapper,
|
|
|
7cc7ff |
MetaLogicalMonitor *logical_monitor,
|
|
|
7cc7ff |
ClutterInputDeviceType device_type);
|
|
|
7cc7ff |
+MetaLogicalMonitor *
|
|
|
7cc7ff |
+meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper,
|
|
|
7cc7ff |
+ ClutterInputDevice *device);
|
|
|
7cc7ff |
|
|
|
7cc7ff |
#endif /* META_INPUT_MAPPER_H */
|
|
|
7cc7ff |
diff --git a/src/backends/meta-input-mapper.c b/src/backends/meta-input-mapper.c
|
|
|
7cc7ff |
index fc4f3bd..fe02ab8 100644
|
|
|
7cc7ff |
--- a/src/backends/meta-input-mapper.c
|
|
|
7cc7ff |
+++ b/src/backends/meta-input-mapper.c
|
|
|
7cc7ff |
@@ -675,3 +675,29 @@ meta_input_mapper_get_logical_monitor_device (MetaInputMapper *mapper,
|
|
|
7cc7ff |
|
|
|
7cc7ff |
return NULL;
|
|
|
7cc7ff |
}
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+MetaLogicalMonitor *
|
|
|
7cc7ff |
+meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper,
|
|
|
7cc7ff |
+ ClutterInputDevice *device)
|
|
|
7cc7ff |
+{
|
|
|
7cc7ff |
+ MetaMapperOutputInfo *output;
|
|
|
7cc7ff |
+ MetaLogicalMonitor *logical_monitor;
|
|
|
7cc7ff |
+ GHashTableIter iter;
|
|
|
7cc7ff |
+ GList *l;
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ g_hash_table_iter_init (&iter, mapper->output_devices);
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ while (g_hash_table_iter_next (&iter, (gpointer *) &logical_monitor,
|
|
|
7cc7ff |
+ (gpointer *) &output))
|
|
|
7cc7ff |
+ {
|
|
|
7cc7ff |
+ for (l = output->input_devices; l; l = l->next)
|
|
|
7cc7ff |
+ {
|
|
|
7cc7ff |
+ MetaMapperInputInfo *input = l->data;
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ if (input->device == device)
|
|
|
7cc7ff |
+ return logical_monitor;
|
|
|
7cc7ff |
+ }
|
|
|
7cc7ff |
+ }
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ return NULL;
|
|
|
7cc7ff |
+}
|
|
|
7cc7ff |
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
|
|
|
7cc7ff |
index b84595e..ab80bee 100644
|
|
|
7cc7ff |
--- a/src/backends/meta-input-settings.c
|
|
|
7cc7ff |
+++ b/src/backends/meta-input-settings.c
|
|
|
7cc7ff |
@@ -1937,6 +1937,42 @@ meta_input_settings_get_tablet_settings (MetaInputSettings *settings,
|
|
|
7cc7ff |
return info ? g_object_ref (info->settings) : NULL;
|
|
|
7cc7ff |
}
|
|
|
7cc7ff |
|
|
|
7cc7ff |
+static ClutterInputDevice *
|
|
|
7cc7ff |
+find_grouped_pen (MetaInputSettings *settings,
|
|
|
7cc7ff |
+ ClutterInputDevice *device)
|
|
|
7cc7ff |
+{
|
|
|
7cc7ff |
+ MetaInputSettingsPrivate *priv;
|
|
|
7cc7ff |
+ GSList *l, *devices;
|
|
|
7cc7ff |
+ ClutterInputDeviceType device_type;
|
|
|
7cc7ff |
+ ClutterInputDevice *pen = NULL;
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ device_type = clutter_input_device_get_device_type (device);
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ if (device_type == CLUTTER_TABLET_DEVICE ||
|
|
|
7cc7ff |
+ device_type == CLUTTER_PEN_DEVICE)
|
|
|
7cc7ff |
+ return device;
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ priv = meta_input_settings_get_instance_private (settings);
|
|
|
7cc7ff |
+ devices = clutter_device_manager_peek_devices (priv->device_manager);
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ for (l = devices; l; l = l->next)
|
|
|
7cc7ff |
+ {
|
|
|
7cc7ff |
+ ClutterInputDevice *device = l->data;
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ device_type = clutter_input_device_get_device_type (l->data);
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ if ((device_type == CLUTTER_TABLET_DEVICE ||
|
|
|
7cc7ff |
+ device_type == CLUTTER_PEN_DEVICE) &&
|
|
|
7cc7ff |
+ clutter_input_device_is_grouped (device, l->data))
|
|
|
7cc7ff |
+ {
|
|
|
7cc7ff |
+ pen = l->data;
|
|
|
7cc7ff |
+ break;
|
|
|
7cc7ff |
+ }
|
|
|
7cc7ff |
+ }
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ return pen;
|
|
|
7cc7ff |
+}
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
MetaLogicalMonitor *
|
|
|
7cc7ff |
meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings,
|
|
|
7cc7ff |
ClutterInputDevice *device)
|
|
|
7cc7ff |
@@ -1948,13 +1984,27 @@ meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings,
|
|
|
7cc7ff |
g_return_val_if_fail (META_IS_INPUT_SETTINGS (settings), NULL);
|
|
|
7cc7ff |
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
|
|
7cc7ff |
|
|
|
7cc7ff |
+ if (clutter_input_device_get_device_type (device) == CLUTTER_PAD_DEVICE)
|
|
|
7cc7ff |
+ {
|
|
|
7cc7ff |
+ device = find_grouped_pen (settings, device);
|
|
|
7cc7ff |
+ if (!device)
|
|
|
7cc7ff |
+ return NULL;
|
|
|
7cc7ff |
+ }
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
priv = meta_input_settings_get_instance_private (settings);
|
|
|
7cc7ff |
info = g_hash_table_lookup (priv->mappable_devices, device);
|
|
|
7cc7ff |
if (!info)
|
|
|
7cc7ff |
return NULL;
|
|
|
7cc7ff |
|
|
|
7cc7ff |
- meta_input_settings_find_monitor (settings, info->settings, device,
|
|
|
7cc7ff |
- NULL, &logical_monitor);
|
|
|
7cc7ff |
+ logical_monitor =
|
|
|
7cc7ff |
+ meta_input_mapper_get_device_logical_monitor (priv->input_mapper, device);
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
+ if (!logical_monitor)
|
|
|
7cc7ff |
+ {
|
|
|
7cc7ff |
+ meta_input_settings_find_monitor (settings, info->settings, device,
|
|
|
7cc7ff |
+ NULL, &logical_monitor);
|
|
|
7cc7ff |
+ }
|
|
|
7cc7ff |
+
|
|
|
7cc7ff |
return logical_monitor;
|
|
|
7cc7ff |
}
|
|
|
7cc7ff |
|
|
|
7cc7ff |
--
|
|
|
7cc7ff |
2.24.1
|
|
|
7cc7ff |
|