Search code examples
c++linuxqt5touchrhel

Qt5 Ignoring Native Touch Events


A couple years ago, I had to implement touch features in an application, but my company was still using Scientific Linux 6.4, which did not natively support touch, not to mention multi-touch. Fortunately, I was able to upgrade the kernel to 2.6.32-754, which gave me access to multi-touch events, and while they were not natively handled, I was able to write my own "driver" in the application that would read the /dev/input/event file and use the input_event class in the kernel to capture touch events and translate them to application behavior.

Now, two years later, we're finally moving on to RedHat 8, and obviously there's now native touch support. Pretty much all my code is still required as it's highly specific to this application, and I don't see much point in re-writing anything. However, because touch events are now natively recognized, I'm seeing some issues where touch press events will be registered twice -- once from the OS, and once from my driver. The touch press events from my driver are required because they're being tracked and handled by my driver.

Is there a way I can update my driver to ignore the OS native touch events that are interfering with my driver without affecting my driver's operation? This is especially prevalent with the on-screen keyboard which is causing it to type the same character twice when the button is pressed.


Solution

  • The simple answer to this problem seemed to be to use xinput to disable the touchscreen device input, which gave me the behavior I wanted. The reason I don't want to re-write the code handling it is because it would be a lot of effort and time for no difference in behavior or performance. I can't just use the native touch because the UI doesn't just use single touch actions, it uses custom gestures that are interpreted by my driver.