Inkscape.org
Beyond the Basics tablet switching between calligraphy tool and eraser
  1. #1
    celane celane @celane

    I use a Wacom Bamboo tablet on a Dell laptop running Fedora 33, for doing lectures. Sofware installed from distribution RPMs.

    With Inkscape 0.92, it worked great: the stylus end of the pen gave the calligraphy tool, and the eraser end of the pen auto-selected the eraser tool.

    (Preferences:Input/Output:Input Devices:Switch tool based on tablet device  selected)

    As of Inkscape 1.0, the tool switching stopped working: both ends of the pen acted like a generic "mouse".  The upgrade also occured with the change from linking with GTK2 to GTK3.

    Well, I found out what was causing the problem, and I have a fix. I hope some developers take a look, because when using inkscape, being able to easily switch tools is a big help.

    I'm uploading the patch, but here's what's going on with it: first, there's a lot of "diagnostic print statements" (commented out) that led me to understanding the problem.

    For some reason on FC33, when you see what input devices are available you get something like:

    $ xinput

     Virtual core pointer                        id=2    [master pointer  (3)]
    ⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
    ⎜   ↳ Contour Design Contour Mouse                id=9    [slave  pointer  (2)]
    ⎜   ↳ Wacom Bamboo 16FG 6x8 Pen stylus            id=12    [slave  pointer  (2)]
    ⎜   ↳ Wacom Bamboo 16FG 6x8 Pen eraser            id=13    [slave  pointer  (2)]
    ⎜   ↳ Wacom Bamboo 16FG 6x8 Pad pad               id=14    [slave  pointer  (2)]
    ⎜   ↳ Wacom Bamboo 16FG 6x8 Finger                id=15    [slave  pointer  (2)]

    ...plus keyboard stuff...

    Inkscape sees sthe Wacom devices, maybe the XTEST pointer is a problem; xinput refuses to delete it.

    The problem is in file desktop-events.cpp , snoop_extended  routine

    wherever there's a

    {

      GdkEventMotion* event2 = reinterpret_cast<GdkEventMotion*>(event);
        if ( event2->device ) {
            source = gdk_device_get_source(event2->device);
            name = gdk_device_get_name(event2->device);
        }

    }

    the event2->device is not getting the correct tablet pen device, and the 'name' is typically blank.

     

    The fix is to change to:

      {
          
    GdkDevice * source_device = gdk_event_get_source_device (event);
           if ( source_device ) {
                source = gdk_device_get_source(source_device);
                name = gdk_device_get_name(source_device);
           }
     }

     

    i'm not sure if this causes problems with GTK2, but as I understand it Inkscape > 1.0 is really supposed to be on GTK3. 

    Made RPM package, installed, tested works as it should (for me) on Fedora 33/Wacom Bamboo with patched inkscape 1.10-10.

Inkscape Inkscape.org Inkscape Forum Beyond the Basics tablet switching between calligraphy tool and eraser