[PATCH] xfree86: expose Option "TransformationMatrix"
Peter Hutterer
peter.hutterer at who-t.net
Mon Sep 5 17:18:07 PDT 2011
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 at who-t.net>
---
hw/xfree86/common/xf86Xinput.c | 29 +++++++++++++++++++++++++++++
hw/xfree86/man/xorg.conf.man | 11 +++++++++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index a45ac93..560dfc9 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 6774dbc..6aae650 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 \*qa 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
--
1.7.6
More information about the xorg-devel
mailing list