165 lines
5.8 KiB
Diff
165 lines
5.8 KiB
Diff
|
From 3b88af94e328ca3064b8d4582349cc1904619755 Mon Sep 17 00:00:00 2001
|
||
|
From: Carlos Garnacho <carlosg@gnome.org>
|
||
|
Date: Fri, 6 Mar 2020 14:37:01 +0100
|
||
|
Subject: [PATCH 46/48] backends/x11: Drop internal WacomDevice lookups
|
||
|
|
||
|
Just use the ones from MetaInputDevice.
|
||
|
|
||
|
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1109
|
||
|
---
|
||
|
src/backends/x11/meta-input-device-x11.c | 50 +++++++++---------------
|
||
|
src/backends/x11/meta-seat-x11.c | 17 --------
|
||
|
2 files changed, 19 insertions(+), 48 deletions(-)
|
||
|
|
||
|
diff --git a/src/backends/x11/meta-input-device-x11.c b/src/backends/x11/meta-input-device-x11.c
|
||
|
index 3d96c344e..dc3b94f49 100644
|
||
|
--- a/src/backends/x11/meta-input-device-x11.c
|
||
|
+++ b/src/backends/x11/meta-input-device-x11.c
|
||
|
@@ -101,14 +101,11 @@ meta_input_device_x11_finalize (GObject *object)
|
||
|
#ifdef HAVE_LIBWACOM
|
||
|
MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (object);
|
||
|
|
||
|
- if (device_xi2->wacom_device)
|
||
|
- libwacom_destroy (device_xi2->wacom_device);
|
||
|
-
|
||
|
if (device_xi2->group_modes)
|
||
|
g_array_unref (device_xi2->group_modes);
|
||
|
+#endif
|
||
|
|
||
|
g_clear_handle_id (&device_xi2->inhibit_pointer_query_timer, g_source_remove);
|
||
|
-#endif
|
||
|
|
||
|
G_OBJECT_CLASS (meta_input_device_x11_parent_class)->finalize (object);
|
||
|
}
|
||
|
@@ -118,23 +115,25 @@ meta_input_device_x11_get_group_n_modes (ClutterInputDevice *device,
|
||
|
int group)
|
||
|
{
|
||
|
#ifdef HAVE_LIBWACOM
|
||
|
- MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
|
||
|
+ WacomDevice *wacom_device;
|
||
|
+
|
||
|
+ wacom_device = meta_input_device_get_wacom_device (META_INPUT_DEVICE (device));
|
||
|
|
||
|
- if (device_xi2->wacom_device)
|
||
|
+ if (wacom_device)
|
||
|
{
|
||
|
if (group == 0)
|
||
|
{
|
||
|
- if (libwacom_has_ring (device_xi2->wacom_device))
|
||
|
- return libwacom_get_ring_num_modes (device_xi2->wacom_device);
|
||
|
- else if (libwacom_get_num_strips (device_xi2->wacom_device) >= 1)
|
||
|
- return libwacom_get_strips_num_modes (device_xi2->wacom_device);
|
||
|
+ if (libwacom_has_ring (wacom_device))
|
||
|
+ return libwacom_get_ring_num_modes (wacom_device);
|
||
|
+ else if (libwacom_get_num_strips (wacom_device) >= 1)
|
||
|
+ return libwacom_get_strips_num_modes (wacom_device);
|
||
|
}
|
||
|
else if (group == 1)
|
||
|
{
|
||
|
- if (libwacom_has_ring2 (device_xi2->wacom_device))
|
||
|
- return libwacom_get_ring2_num_modes (device_xi2->wacom_device);
|
||
|
- else if (libwacom_get_num_strips (device_xi2->wacom_device) >= 2)
|
||
|
- return libwacom_get_strips_num_modes (device_xi2->wacom_device);
|
||
|
+ if (libwacom_has_ring2 (wacom_device))
|
||
|
+ return libwacom_get_ring2_num_modes (wacom_device);
|
||
|
+ else if (libwacom_get_num_strips (wacom_device) >= 2)
|
||
|
+ return libwacom_get_strips_num_modes (wacom_device);
|
||
|
}
|
||
|
}
|
||
|
#endif
|
||
|
@@ -147,17 +146,18 @@ static int
|
||
|
meta_input_device_x11_get_button_group (ClutterInputDevice *device,
|
||
|
uint32_t button)
|
||
|
{
|
||
|
- MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
|
||
|
+ WacomDevice *wacom_device;
|
||
|
|
||
|
- if (device_xi2->wacom_device)
|
||
|
+ wacom_device = meta_input_device_get_wacom_device (META_INPUT_DEVICE (device));
|
||
|
+
|
||
|
+ if (wacom_device)
|
||
|
{
|
||
|
WacomButtonFlags flags;
|
||
|
|
||
|
- if (button >= libwacom_get_num_buttons (device_xi2->wacom_device))
|
||
|
+ if (button >= libwacom_get_num_buttons (wacom_device))
|
||
|
return -1;
|
||
|
|
||
|
- flags = libwacom_get_button_flag (device_xi2->wacom_device,
|
||
|
- 'A' + button);
|
||
|
+ flags = libwacom_get_button_flag (wacom_device, 'A' + button);
|
||
|
|
||
|
if (flags &
|
||
|
(WACOM_BUTTON_RING_MODESWITCH |
|
||
|
@@ -369,18 +369,6 @@ meta_input_device_x11_get_pointer_location (ClutterInputDevice *device,
|
||
|
}
|
||
|
|
||
|
#ifdef HAVE_LIBWACOM
|
||
|
-void
|
||
|
-meta_input_device_x11_ensure_wacom_info (ClutterInputDevice *device,
|
||
|
- WacomDeviceDatabase *wacom_db)
|
||
|
-{
|
||
|
- MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
|
||
|
- const gchar *node_path;
|
||
|
-
|
||
|
- node_path = clutter_input_device_get_device_node (device);
|
||
|
- device_xi2->wacom_device = libwacom_new_from_path (wacom_db, node_path,
|
||
|
- WFALLBACK_NONE, NULL);
|
||
|
-}
|
||
|
-
|
||
|
uint32_t
|
||
|
meta_input_device_x11_get_pad_group_mode (ClutterInputDevice *device,
|
||
|
uint32_t group)
|
||
|
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
|
||
|
index 8849cd3d8..e6e996803 100644
|
||
|
--- a/src/backends/x11/meta-seat-x11.c
|
||
|
+++ b/src/backends/x11/meta-seat-x11.c
|
||
|
@@ -54,10 +54,6 @@ struct _MetaSeatX11
|
||
|
int pointer_id;
|
||
|
int keyboard_id;
|
||
|
int opcode;
|
||
|
-
|
||
|
-#ifdef HAVE_LIBWACOM
|
||
|
- WacomDeviceDatabase *wacom_db;
|
||
|
-#endif
|
||
|
};
|
||
|
|
||
|
static GParamSpec *props[N_PROPS] = { 0 };
|
||
|
@@ -557,11 +553,6 @@ create_device (MetaSeatX11 *seat_x11,
|
||
|
info->classes,
|
||
|
info->num_classes);
|
||
|
|
||
|
-#ifdef HAVE_LIBWACOM
|
||
|
- if (source == CLUTTER_PAD_DEVICE)
|
||
|
- meta_input_device_x11_ensure_wacom_info (retval, seat_x11->wacom_db);
|
||
|
-#endif
|
||
|
-
|
||
|
g_free (vendor_id);
|
||
|
g_free (product_id);
|
||
|
g_free (node_path);
|
||
|
@@ -1410,10 +1401,6 @@ meta_seat_x11_finalize (GObject *object)
|
||
|
g_hash_table_unref (seat_x11->tools_by_serial);
|
||
|
g_list_free (seat_x11->devices);
|
||
|
|
||
|
-#ifdef HAVE_LIBWACOM
|
||
|
- libwacom_database_destroy (seat_x11->wacom_db);
|
||
|
-#endif
|
||
|
-
|
||
|
G_OBJECT_CLASS (meta_seat_x11_parent_class)->finalize (object);
|
||
|
}
|
||
|
|
||
|
@@ -1570,10 +1557,6 @@ meta_seat_x11_init (MetaSeatX11 *seat)
|
||
|
(GDestroyNotify) g_object_unref);
|
||
|
seat->tools_by_serial = g_hash_table_new_full (NULL, NULL, NULL,
|
||
|
(GDestroyNotify) g_object_unref);
|
||
|
-
|
||
|
-#ifdef HAVE_LIBWACOM
|
||
|
- seat->wacom_db = libwacom_database_new ();
|
||
|
-#endif
|
||
|
}
|
||
|
|
||
|
MetaSeatX11 *
|
||
|
--
|
||
|
2.26.0.rc2
|
||
|
|