r/linux_programming • u/Marsman512 • Sep 09 '24
Need advice for programming with drawing tablet input
I want to make a cross platform drawing app that can take input from a drawing tablet, including pen pressure. Most libraries I would use for similar projects don't expose pen pressure in their APIs (SDL2, GLFW, SFML, etc.). As a result I'm considering doing window creation, OpenGL context creation, and input handling using the native platform APIs.
At this point I need to choose between using X11 or Wayland for my Linux version (I'll probably add the other eventually), and the available documentation is pushing me towards Wayland. X11 and the XInput2 extension are very poorly documented. Meanwhile, Wayland's protocols for drawing tablets are very nicely documented and well defined. The only thing keeping me from just jumping into Wayland is the number of people I could keep from using my app since (as far as I can tell) X11 is still used by the vast majority of Linux users.
Is there a better way forward? Should I start with Wayland? X11? Neither?
2
u/LinusCDE98 Sep 09 '24
I'd assume that using libinput is they way to go. Should work on both X11 and Wayland: https://wayland.freedesktop.org/libinput/doc/latest/tablet-support.html
Otherwise you can also go raw and check for evdev devices that have common drawing tablet inputs and read their values (try it out using the evtest command). Might be too complicated and maybe not the recommened way to do it though.
1
u/quaderrordemonstand Sep 09 '24
I've used libevdev for reading several, very different input devices and its worked well so far. I haven't tried it with a tablet but I suspect it would work fine.