How to remove the 300ms tap delay in Kivy apps running on Ubuntu?

Question:

I have a Kivy app under development. When testing it on my touchscreen laptop (Ubuntu 20.04), I noticed a couple things.

  • Using the mouse, there are red dots appearing after right-clicks, which simulate multitouch points.

  • When touching buttons using the laptop touchscreen, there is a 300ms-ish delay before those buttons show the pressed state and register the press event. Similar to what happened initially with mobile web browsers. It makes the app feel sluggish and not practical for my use case.

I also tried running it on a Raspberry Pi using the official 7′ touchscreen. There is no touch delay at all, the UI feels snappy. How can I get the same result on my computer?

Documentation says that the input driver is responsible for those differences.
So far, I attempted the following:

Disabling multitouch from the config (mouse = mouse,disable_multitouch); the right-click simulation disappears but the delay is still there

Removing mouse from the config as I would have suspected a conflict: mouse inputs are no longer registered and touch still does not work.

Adding touch drivers in the config gave no improvements:

mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput

The startup log shows some warnings:

[WARNING] [MTD         ] Unable to open device "/dev/input/event7". Please ensure you have the appropriate permissions.
[WARNING] [MTD         ] Unable to open device "/dev/input/event13". Please ensure you have the appropriate permissions.

Looks like a permissions issue. How can I fix it?

Asked By: DavGin

||

Answers:

I actually found the culprit – it was Ubuntu 20.04 itself.
The delay did not appear in Ubuntu 22.04 after an upgrade.

Explanation:

The OS input system was delaying the delivery of touch start events to all of the applications.
To see if there is such a delay, it is possible to use xinput test-xi2 and interact with the little window using a touchscreen. The console output shows the events as they are received by the window.

Answered By: DavGin
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.