GNOME Bugzilla – Bug 639830
Use Wacom Tool Type XI property to guess device source type
Last modified: 2018-02-10 03:42:24 UTC
The Wacom Tool Type XI property exposes the type of device for Wacom devices. This information can be used to determine the type of device more reliably than matching the device name. Patches follow.
Created attachment 178607 [details] [review] Added TOUCH and PAD source device types
Created attachment 178608 [details] [review] Use XIGetProperty to guess source device type for Wacom devices This uses the Wacom Tool Type XI property if available and falls back on the existing code to determine the type from the device name.
I'm not really sure about the additions TOUCH and PAD to GdkInputSource. At least the Wacom device I have here to test (Bamboo Fun SE) exposes four devices with the latest drivers: Wacom Bamboo 2FG 4x5 SE Pen stylus id: 12 type: STYLUS Wacom Bamboo 2FG 4x5 SE Pen eraser id: 11 type: ERASER Wacom Bamboo 2FG 4x5 SE Finger touch id: 14 type: TOUCH Wacom Bamboo 2FG 4x5 SE Finger pad id: 13 type: PAD It would be nice to support them. I'd appreciate any feedback.
Review of attachment 178608 [details] [review]: Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> as an advanced warning, we'll be adding a few tool types to the wacom driver in the forseeable future (e.g. AIRBRUSH). certainly easy to add with this code
Review of attachment 178607 [details] [review]: with the upcoming touch device support I'd be careful about naming it TOUCH vs TOUCHPAD, they're not always the same. wacom devices are special in that some of them are more like a touchpad (bamboo) and some of them more like a direct-input touch device (tablet PC mounted serial devices). given that a touchpad is usually a simple pointer device though, i recommend changing the comment to "device is a touch device"
I'm a bit fuzzy on the naming of the device myself. I don't really know what a PAD device is for example (or the exact difference between a TOUCH_PAD, PAD and TOUCH devices).
We've now added GDK_SOURCE_TOUCHSCREEN and GDK_SOURCE_TOUCHPAD for direct and indirect touch devices - does that cover the Wacom cases ?
I suppose, although I wonder if it would be interesting to also add things like ERASER?
Created attachment 216908 [details] [review] updated patch Here is an updated patch (untested).
*** Bug 677161 has been marked as a duplicate of this bug. ***
Unfortunately, I don't have any wacom (or other) touch devices around to test this with. Peter, would it be possible for you to test this ?
<mclasen> ofourdan: are the touch devices correctly classified wrt to direct vs indirect touch ? <ofourdan> what does "indirect/direct" touch means in this context? <ajax> touchscreen vs touchpad. <ofourdan> well if that's the case then it's not correct <ajax> iirc. direct is "warp pointer to here first", indirect is just rel motion. <ofourdan> the pad is said to be "indirect touch" whereas it's just buttons <ofourdan> the finger touch is said to be direct, but it's atablet, not atouch screen <ofourdan> the finger touch on the tablet would be indirect, unless this is a screentablet (which is not the case here)
maybe direct vs indirect should be set depending on the device having absolute or relative mode? (although that could change at runtime, and ::input-source is construct-only, hrm...)
Peter, do you have a table mapping 'Wacom Tool Type' values to devices types (keyboard/mouse/pen/eraser/direct touch/indirect touch) ?
Code for setting type is here: http://linuxwacom.git.sourceforge.net/git/gitweb.cgi?p=linuxwacom/xf86-input-wacom;a=blob;f=src/wcmConfig.c;h=e7fea5b4243f8618b8a1305faa137dd340c57436;hb=HEAD#l135 Parameter passed in is the Option "Type" value from the config (automatically filled in default configuration). Values for the type name/property are: "STYLUS" - for type stylus, i.e. any pen tool "ERASER" - for the eraser device (if available). X device may sometimes be there even if the physical stylus doesn't have one "CURSOR" - for the puck device (wacom mouse) "PAD" - for the physical tablet, i.e. the buttons and scrollwheels/rings only "TOUCH" - for touch devices. in some configurations, mainly Bamboos. the touch device is actually driven by synaptics so you may not see this tool type these are the only values currently used by the driver, you won't see the XI_MOUSE, XI_TOUCHPAD, etc. values. mapping direct/indirect is harder, but we do switch the valuator mode of the device when the mode changes in the driver. so XIQueryDevice's XIValuatorClassInfo contains that bit. but that may (and will) change, it depends on gsettings. the only way to really get whether it's a direct input device is querying libwacom_device_is_builtin() and ignoring those users that set the device to relative mode despite being a built-in one :)
Created attachment 220507 [details] [review] another update Here is another iteration. This patch looks at the valuator mode to decide direct vs indirect touch. Am I right that a 'pad' should be considered a keyboard here ? Does it give me key or button events ? Olivier, if you could test this patch one more time, that would be fantastic.
Review of attachment 220507 [details] [review]: untested, but it looks correct. I would change the commit message though, this patch adds a valuator mode check, not much related to tool type property checking.
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue for it.