diff options
author | Peter Korsgaard <peter.korsgaard@barco.com> | 2010-05-25 11:03:28 +0200 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-05-28 16:49:30 +1000 |
commit | 6cccf0131c8464d8838cae2200730873d7dd9e45 (patch) | |
tree | d4449acf7783aba498ea30894ebaefbe77b7f9ee /Xi | |
parent | e4582d9e5c8649347742a13eae68cf27005296fc (diff) |
dix: add 3x3 transformation matrix xinput property for multi-head handling
For absolute input devices (E.G. touchscreens) in multi-head setups,
we need a way to bind the device to an randr output. This adds the
infrastructure to the server to allow us to do so.
positionSprite() scales input coordinates to the dimensions of the shared
(total) screen frame buffer, so to restrict motion to an output we need to
scale/rotate/translate device coordinates to a subset of the frame buffer
before passing them on to positionSprite.
This is done here using a 3x3 transformation matrix, which is applied to
the device coordinates using homogeneous coordinates, E.G.:
[ c0 c1 c2 ] [ x ]
[ c3 c4 c5 ] * [ y ]
[ c6 c7 c8 ] [ 1 ]
Notice: As input devices have varying input ranges, the coordinates are
first scaled to the [0..1] range for generality, and afterwards scaled
back up.
E.G. for a dual head setup (using same resolution) next to each other, you
would want to scale the X coordinates of the touchscreen connected to the
both heads by 50%, and translate (offset) the coordinates of the rightmost
head by 50%, or in matrix form:
left: right:
[ 0.5 0 0 ] [ 0.5 0 0.5 ]
[ 0 1 0 ] [ 0 1 0 ]
[ 0 0 1 ] [ 0 0 0 ]
Which can be done using xinput:
xinput set-prop <left> --type=float "Coordinate Transformation Matrix" \
0.5 0 0 0 1 0 0 0 1
xinput set-prop <right> --type=float "Coordinate Transformation Matrix" \
0.5 0 0.5 0 1 0 0 0 1
Likewise more complication setups involving more heads, rotation or
different resolution can be handled.
Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/xiproperty.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index 8bb19624c..b4d939f99 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -177,7 +177,9 @@ static struct dev_properties {0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP}, {0, BTN_LABEL_PROP_BTN_GEAR_DOWN}, - {0, BTN_LABEL_PROP_BTN_GEAR_UP} + {0, BTN_LABEL_PROP_BTN_GEAR_UP}, + + {0, XI_PROP_TRANSFORM} }; static long XIPropHandlerID = 1; |