summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-09-06 09:33:43 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-09-27 11:57:25 +1000
commit4b4caecb7d2c8e0b7e4fedc95fba2a728bbc25e6 (patch)
tree46a294295ca292abb5ab8b4e0a47a14908fbe1c4
parentcf51424a34fb2b567a867338ab44f83b5c43251c (diff)
xfree86: expose Option "TransformationMatrix"
Recent changes to the server change the default absolute input device behaviour on zaphods to span the whole desktop too. Since these setups usually use an xorg.conf, allow the transformation matrix to be specified in the config as well. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Simon Thum <simon.thum@gmx.de>
-rw-r--r--hw/xfree86/common/xf86Xinput.c29
-rw-r--r--hw/xfree86/man/xorg.conf.man11
2 files changed, 40 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 526b92d3a..9fbcba9d5 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -266,6 +266,34 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
}
}
+static void
+ApplyTransformationMatrix(DeviceIntPtr dev)
+{
+ InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
+ char *str;
+ int rc;
+ float matrix[9] = {0};
+
+ if (!dev->valuator)
+ return;
+
+ str = xf86SetStrOption(pInfo->options, "TransformationMatrix", NULL);
+ if (!str)
+ return;
+
+ rc = sscanf(str, "%f %f %f %f %f %f %f %f %f", &matrix[0], &matrix[1], &matrix[2],
+ &matrix[3], &matrix[4], &matrix[5], &matrix[6], &matrix[7], &matrix[8]);
+ if (rc != 9) {
+ xf86Msg(X_ERROR, "%s: invalid format for transformation matrix. Ignoring configuration.\n",
+ pInfo->name);
+ return;
+ }
+
+ XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_TRANSFORM),
+ XIGetKnownProperty(XATOM_FLOAT), 32,
+ PropModeReplace, 9, matrix, FALSE);
+}
+
/***********************************************************************
*
* xf86ProcessCommonOptions --
@@ -755,6 +783,7 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
static int
xf86InputDevicePostInit(DeviceIntPtr dev) {
ApplyAccelerationSettings(dev);
+ ApplyTransformationMatrix(dev);
return Success;
}
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 6774dbc5e..df877b998 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -948,6 +948,17 @@ is equivalent to
This option controls the startup behavior only, a device
may be reattached or set floating at runtime.
+.TP 7
+.BI "Option \*qTransformationMatrix\*q \*q" a " " b " " c " " d " " e " " f " " g " " h " " i \*q
+Specifies the 3x3 transformation matrix for absolute input devices. The
+input device will be bound to the area given in the matrix. In most
+configurations, "a" and "e" specify the width and height of the area the
+device is bound to, and "c" and "f" specify the x and y offset of the area.
+The value range is 0 to 1, where 1 represents the width or height of all
+root windows together, 0.5 represents half the area, etc. The values
+represent a 3x3 matrix, with the first, second and third group of three
+values representing the first, second and third row of the matrix,
+respectively. The identity matrix is "1 0 0 0 1 0 0 0 1".
.SS POINTER ACCELERATION
For pointing devices, the following options control how the pointer
is accelerated or decelerated with respect to physical device motion. Most of