Detect active touchscreen on Linux (and if multitouch)

1.2k views Asked by At

I need the Linux equivalent for the following Windows code:

auto touchCap(GetSystemMetrics(SM_DIGITIZER));
if (!(touchCap & NID_READY)) LOG("WARNING: No active digitizer detected")
if (!(touchCap & NID_MULTI_INPUT)) LOG("WARNING: No multi-touch digitizer detected")

Note that it's not checking if a touchscreen driver is simply present, but if there is a currently active touch device. I also need to know if it's multitouch or not.

1

There are 1 answers

0
Jonathan Walton On

There might not be an exact equivalent, as I have seen differences in the way Windows and Linux event libraries are designed, but have you taken a look at the SDL Library? This is the event library that I have seen used for some recent Linux projects.

https://wiki.libsdl.org/

I've also heard that SFML is pretty nice.

http://www.sfml-dev.org/