103 lines
3.6 KiB
Diff
103 lines
3.6 KiB
Diff
|
From 6d01e7277f8589a1f0076acbf9e08b45a5a96d0d Mon Sep 17 00:00:00 2001
|
||
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||
|
Date: Thu, 13 Dec 2018 14:32:33 +1000
|
||
|
Subject: [PATCH 1/2] wacom: Map wacom-driver-specific generic IDs to 0
|
||
|
|
||
|
The xf86-input-wacom driver doesn't use 0 for tools that do not have an id or
|
||
|
serials. Serials default to 1, and the tool id is either 0x2 for stylus or 0xa
|
||
|
for eraser, see xf86WacomDefs.h, the defines for STYLUS_DEVICE_ID and
|
||
|
ERASER_DEVICE_ID.
|
||
|
|
||
|
libwacom uses 0xfffff and 0xffffe for the generic pens and all the lookup code
|
||
|
we have in the panel is designed for a serial/tool id of 0. So let's just map
|
||
|
the wacom driver IDs to 0 at the only transition point between Gdk and our
|
||
|
panel.
|
||
|
|
||
|
No devices with serials 0 or hw ids 2/10 exist, so this shouldn't have side
|
||
|
effects. This only affects X + xf86-input-wacom.
|
||
|
---
|
||
|
panels/wacom/cc-wacom-panel.c | 17 +++++++++++++++++
|
||
|
1 file changed, 17 insertions(+)
|
||
|
|
||
|
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
|
||
|
index e4f3ca7..8748876 100644
|
||
|
--- a/panels/wacom/cc-wacom-panel.c
|
||
|
+++ b/panels/wacom/cc-wacom-panel.c
|
||
|
@@ -354,6 +354,14 @@ update_current_tool (CcWacomPanel *panel,
|
||
|
|
||
|
/* Check whether we already know this tool, nothing to do then */
|
||
|
serial = gdk_device_tool_get_serial (tool);
|
||
|
+
|
||
|
+ /* The wacom driver sends serial-less tools with a serial of
|
||
|
+ * 1, libinput uses 0. No device exists with serial 1, let's reset
|
||
|
+ * it here so everything else works as expected.
|
||
|
+ */
|
||
|
+ if (serial == 1)
|
||
|
+ serial = 0;
|
||
|
+
|
||
|
stylus = cc_tablet_tool_map_lookup_tool (priv->tablet_tool_map,
|
||
|
wacom_device, serial);
|
||
|
|
||
|
@@ -361,6 +369,15 @@ update_current_tool (CcWacomPanel *panel,
|
||
|
gboolean added;
|
||
|
|
||
|
id = gdk_device_tool_get_hardware_id (tool);
|
||
|
+
|
||
|
+ /* The wacom driver sends a hw id of 0x2 for stylus and 0xa
|
||
|
+ * for eraser for devices that don't have a true HW id.
|
||
|
+ * Reset those to 0 so we can use the same code-paths
|
||
|
+ * libinput uses.
|
||
|
+ */
|
||
|
+ if (id == 0x2 || id == 0xa)
|
||
|
+ id = 0;
|
||
|
+
|
||
|
stylus = cc_wacom_tool_new (serial, id, wacom_device);
|
||
|
if (!stylus)
|
||
|
return;
|
||
|
--
|
||
|
2.24.1
|
||
|
|
||
|
|
||
|
From 6974aaeb20a5146f95de9c40cd0b3b5967b317a6 Mon Sep 17 00:00:00 2001
|
||
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||
|
Date: Fri, 14 Dec 2018 16:14:30 +1000
|
||
|
Subject: [PATCH 2/2] wacom: ignore the wacom driver's touch tool type
|
||
|
|
||
|
When the wacom driver handles the touch device, we get a tool id of 0x3. Let's
|
||
|
ignore that because we don't need a tool for the touch node.
|
||
|
|
||
|
Ideally we should be able to rely on the GDK tool type but that one is always
|
||
|
GDK_DEVICE_TOOL_TYPE_UNKNOWN see
|
||
|
https://gitlab.gnome.org/GNOME/gtk/merge_requests/453
|
||
|
|
||
|
A GTK bug (also fixed in that MR) prevents the tool id from updating.
|
||
|
Until that GTK bug is fixed the pen will only be detected if it is the first
|
||
|
event from this physical device. If the touch node sends an event before the
|
||
|
pen, the pen won't be detected.
|
||
|
---
|
||
|
panels/wacom/cc-wacom-panel.c | 5 +++++
|
||
|
1 file changed, 5 insertions(+)
|
||
|
|
||
|
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c
|
||
|
index 8748876..985ddf5 100644
|
||
|
--- a/panels/wacom/cc-wacom-panel.c
|
||
|
+++ b/panels/wacom/cc-wacom-panel.c
|
||
|
@@ -374,9 +374,14 @@ update_current_tool (CcWacomPanel *panel,
|
||
|
* for eraser for devices that don't have a true HW id.
|
||
|
* Reset those to 0 so we can use the same code-paths
|
||
|
* libinput uses.
|
||
|
+ * The touch ID is 0x3, let's ignore that because we don't
|
||
|
+ * have a touch tool and it only happens when the wacom
|
||
|
+ * driver handles the touch device.
|
||
|
*/
|
||
|
if (id == 0x2 || id == 0xa)
|
||
|
id = 0;
|
||
|
+ else if (id == 0x3)
|
||
|
+ return;
|
||
|
|
||
|
stylus = cc_wacom_tool_new (serial, id, wacom_device);
|
||
|
if (!stylus)
|
||
|
--
|
||
|
2.24.1
|
||
|
|