nedelja, 01. junij 2014

Touchscreen with multiple monitors

I'm using Xubuntu 12.04.4 and have two monitors (one touch and one regular).
I'm using arandr to set the extended desktop (regular monitor is right of touch monitor).
This also messes up touch input, since the system thinks the whole extended desktop is touch.

Recent servers have a property for setting how input device events are translated to screen coordinates. The property is called "Coordinate Transformation Matrix". More on setting it can be found here.

In my case both montiors have resolution of 1366x768 so the transformation matrix looks like: 0.5 0 0 0 1 0 0 0 1 (touch has to work only on half of the extended desktop). You can set the matrix like this:

xinput set-prop TOUCH_DEVICE_ID "Coordinate Transformation Matrix" 0.5 0 0 0 1 0 0 0 1

You can get TOUCH_DEVICE_ID from "xinput --list".