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