How does mouse event synthesis work on touchscreen?

Grósz Dániel groszdanielpub at
Fri Nov 20 07:14:44 UTC 2020

Thank you! So it looks like with modern toolkits it's impossible to 
distinguish whether a touch event is interpreted as an application-specific 
gesture or a boring old mouse click, as the mouse event synthesis happens in 
the toolkit when the toolkit is touch-aware.

Actually I think it will be possible to mostly do what I want: I'll create a 
fake touchscreen and a fake mouse or touchpad using uinput, and I'll disable 
the real touchsceen in I'll forward one-finger drags and short taps to 
the fake touchscreen, and use everything else to generate fake mouse or 
touchpad events. I'll only forward short one-finger taps to the fake 
touchscreen after they are released, and only if don't start a tap-and-drag. 
Or perhaps I'll send long one-finger taps to the fake touchscreen as well, and 
use three-finger tap for right-click instead.

This way I lose application-specific multitouch gestures, and I lose 
simultaneous touch interaction with different windows, but I retain the 
context-specific interpretation of one-finger drags.

It would probably be more elegant to do this by patching libinput (it wouldn't 
require disabling the real touchscreen in etc.), but more difficult (is 
it?). At the moment I'm mostly trying to do this for myself, but if I come up 
with something useful I'll release it.

> A side note here: if a touchscreen isn't precise enough to interact with a
> specific UI, that's something you can really only fix by adjusting the UI.
> Things like relative pointer movement on a touchscreen is more effort than
> you'll get out of it.

Well, I find a touchpad more convenient than a touchscreen as an input device 
in pretty much every way, it's just not convenient to hold an open laptop in 
some situations.

In fact another thing I'm looking to do is to create a virtual touchpad, 
analogous to a virtual keyboard. (Actually this seems to exist for Windows, so 
I'm not the only one who feels like this.) However, this will also require 
uinput fakery (or patching libinput), as I need to split touch events 
depending on their location.

More information about the xorg mailing list