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>
This commit is contained in:
parent
cf51424a34
commit
4b4caecb7d
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user