diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2018-12-13 14:32:33 +1000 |
---|---|---|
committer | Carlos Garnacho <mrgarnacho@gmail.com> | 2018-12-18 20:46:02 +0000 |
commit | d925ea3c6c260423a70412863cb6ee806e3cf815 (patch) | |
tree | be47391567a8fd8dc276d5c1e24b377cb3626a60 /panels/wacom | |
parent | 63603b75df6d84982dd2c8a9d057ec2ab68baf12 (diff) | |
download | gnome-control-center-d925ea3c6c260423a70412863cb6ee806e3cf815.tar.gz |
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.
Diffstat (limited to 'panels/wacom')
-rw-r--r-- | panels/wacom/cc-wacom-panel.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/panels/wacom/cc-wacom-panel.c b/panels/wacom/cc-wacom-panel.c index 0cb2f424e..51662c4dc 100644 --- a/panels/wacom/cc-wacom-panel.c +++ b/panels/wacom/cc-wacom-panel.c @@ -363,6 +363,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 (panel->tablet_tool_map, wacom_device, serial); @@ -370,6 +378,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; |