After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677161 - GTK checks for "wacom" in device name to assign GDK_SOURCE_PEN
GTK checks for "wacom" in device name to assign GDK_SOURCE_PEN
Status: RESOLVED DUPLICATE of bug 639830
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-05-31 05:50 UTC by Peter Hutterer
Modified: 2012-06-21 11:42 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Peter Hutterer 2012-05-31 05:50:19 UTC
In gtk/x11/gdkdevicemanager-xi2.c:create_device() gtk checks the device name for a couple of strings in the device name to assign different sources. These are aimed the wacom driver defaults, but the device string name is not ideal:
- devices statically set up in the xorg.conf may not have these strings, so GDK will misbehave
- some devices may not have any of these. I found this with the Intuos4 WL which announced itself as PTK-540WL, or non-wacom devices handled by the wacom driver (e.g. Waltop, N-trig devices)

The XI 1.x way of reliably checking this is the "type" field in XListInputDevices(). That atom describes one of "STYLUS", "CURSOR", "ERASER", "PAD", or "TOUCH". This works across drivers, though evdev & co will set "TOUCHPAD", "MOUSE", etc.

On XI2, you need to check the "Wacom Tool Type" property on the device. It's
set to the same Atom values but only exists for Wacom devices. This should
get us 90% there though, if we run into issues with non-wacom-driver tablets
I can add this property to the evdev driver.
Comment 1 Martin Renold 2012-05-31 17:56:36 UTC
For reference, below is the relevant (and very ugly) commented code from MyPaint, which tries to auto-enable pressure sensitive devices. The problem is, when enabling something that isn't actually a stylus, GTK tends to fail in the weirdest ways.

Kudos to anyone who makes this code obsolete.

for device in gdk.devices_list():

    #if device.source in [gdk.SOURCE_PEN, gdk.SOURCE_ERASER]:
    # The above contition is True sometimes for a normal USB
    # Mouse. https://gna.org/bugs/?11215
    # In fact, GTK also just guesses this value from device.name.
    
    name = device.name.lower()
    last_word = name.split()[-1]
    if last_word == 'pad':
        # Setting the intuos3 pad into "screen mode" causes
        # glitches when you press a pad-button in mid-stroke,
        # and it's not a pointer device anyway. But it reports
        # axes almost identical to the pen and eraser.
        #
        # device.name is usually something like "wacom intuos3 6x8 pad" or just "pad"
        print 'Ignoring "%s" (probably wacom keypad device)' % device.name
        continue
    if last_word == 'touchpad':
        # eg. "SynPS/2 Synaptics TouchPad"
        # Cannot paint at all, cannot select brushes, if we enable this one.
        print 'Ignoring "%s" (probably laptop touchpad which screws up gtk+ if enabled)' % device.name
        continue
    if last_word == 'cursor':
        # this is a "normal" mouse and does not work in screen mode
        print 'Ignoring "%s" (probably wacom mouse device)' % device.name
        continue
    if 'transceiver' in name:
        # eg. "Microsoft Microsoft 2.4GHz Transceiver V1.0"
        # Cannot paint after moving outside of painting area.
        print 'Ignoring "%s" (a transceiver is probably not a pressure sensitive tablet, known to screw up gtk+ when enabled)' % device.name
        continue
    
    for use, val_min, val_max in device.axes:
        # Some mice have a third "pressure" axis, but without
        # minimum or maximum. https://gna.org/bugs/?14029
        if use == gdk.AXIS_PRESSURE and val_min != val_max:
            if 'mouse' in device.name.lower():
                # Real fix for the above bug https://gna.org/bugs/?14029
                print 'Ignoring "%s" (probably a mouse, but it reports extra axes)' % device.name
                continue

            self.pressure_devices.append(device.name)
            ...
Comment 2 Matthias Clasen 2012-06-21 11:42:38 UTC

*** This bug has been marked as a duplicate of bug 639830 ***