summaryrefslogtreecommitdiff
path: root/include/xserver-properties.h
diff options
context:
space:
mode:
authorPeter Korsgaard <peter.korsgaard@barco.com>2010-05-25 11:03:28 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2010-05-28 16:49:30 +1000
commit6cccf0131c8464d8838cae2200730873d7dd9e45 (patch)
treed4449acf7783aba498ea30894ebaefbe77b7f9ee /include/xserver-properties.h
parente4582d9e5c8649347742a13eae68cf27005296fc (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 'include/xserver-properties.h')
-rw-r--r--include/xserver-properties.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/xserver-properties.h b/include/xserver-properties.h
index 30e8efb68..c6259aee1 100644
--- a/include/xserver-properties.h
+++ b/include/xserver-properties.h
@@ -35,6 +35,13 @@
/* BOOL. If present, device is a virtual XTEST device */
#define XI_PROP_XTEST_DEVICE "XTEST Device"
+/* Coordinate transformation matrix for absolute input devices
+ * FLOAT, 9 values in row-major order, coordinates in 0..1 range:
+ * [c0 c1 c2] [x]
+ * [c3 c4 c5] * [y]
+ * [c6 c7 c8] [1] */
+#define XI_PROP_TRANSFORM "Coordinate Transformation Matrix"
+
/* Pointer acceleration properties */
/* INTEGER of any format */
#define ACCEL_PROP_PROFILE_NUMBER "Device Accel Profile"