kurikaesu / userspace-tablet-driver-daemon

Linux device drivers for non-wacom (XP-Pen, Huion, Gaomon) graphics tablets and pen displays
GNU General Public License v3.0
65 stars 16 forks source link

Add initial Eraser support to xp_pen_unified_device.cpp #64

Closed rexy712 closed 2 years ago

rexy712 commented 2 years ago

I took inspiration from #62 and tried to rework it to only press a custom key when entering proximity. I also added the ability to add keybinds to the pen tip entering proximity so you can switch back and forth between tools when alternating ends of the pen.

kurikaesu/userspace-tablet-driver-gui#14 adds support for binding keybinds to eraser proximity entry and could be easily extended to add support for pen proximity as well.

This should close #60.

rexy712 commented 2 years ago

I should also note I've only tested this on the XP-Pen Artist Pro 16 and it seems to work fine.

In Krita, however, one hiccup it had was that Krita handles BTN_TOOL_RUBBER natively, so when running the custom keybinds it sticks to Krita's native behavior until you exit proximity and re-enter. I couldn't find any way to fix this. You can't remove the uinput_send(uinputPens[handle], EV_KEY, BTN_TOOL_RUBBER, 1) call or the cursor doesn't move. But removing this makes Krita obey the custom keybind and not default to its own behavior. That seems like a program specific problem though and you can just not use custom keybinds and it works perfectly fine in Krita.

kurikaesu commented 2 years ago

Beautifully done!

I recently got an XP-Pen Artist 10 (2nd Gen) with a eraser capable stylus. I can test it out on my side when I get the chance but I think this is fine.

Will merge, and if someone complains I'll look into it.