Touchevent mapping to screen

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 10 23:03:25 PDT 2015


On Tue, Mar 10, 2015 at 03:15:44PM -0400, Amirhossein Simjour wrote:
> Hi,
> 
>    I was working on a Linux system with two monitors attached to it, where
> one of the monitors was  a touchscreen. I had problem to find the exact
> mapping between the touch events and the screens.
> 
>   I know that I can set the mapping with xinput command, but I was
> wondering if there is any way to get the mapping inside of the chromium
> code.
> 
>   The main problem here is that, although I can do the mapping with xinput
> command, I cannot retrieve the mapping in my code. In my case, I have to
> scale the touchevents that come from a Dell S2340t touchscreen, however, I
> need to know about the exact size of the screen that this touchevent has
> came from.
>   In general the same problem can be seen in case that we have more than
> one touchscreen.

All xinput does is set the "Coordinate Transformation Matrix" for the
device (the server provides this for all absolute devices). The actual
values are desktop-size related, so you'll need to calculate it based on the 
randr settings.

Have a look at the xinput code (map_output_xrandr), that should be fairly
self-explanatory.

Cheers,
   Peter


More information about the xorg-devel mailing list