From a12ed738095819beab0b42c6c8a1566c063bb79e Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sun, 13 Feb 2011 09:54:06 +0100 Subject: Support XINPUT 12 The version 12 input ABI brings substantial changes to driver handling. This patch makes the driver compile and run under the upcoming X server 1.10. Signed-off-by: Henrik Rydberg --- driver/multitouch.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/driver/multitouch.c b/driver/multitouch.c index c9b8bce..99f1484 100644 --- a/driver/multitouch.c +++ b/driver/multitouch.c @@ -26,6 +26,10 @@ #include #endif +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 +typedef InputInfoPtr LocalDevicePtr; +#endif + /* these should be user-configurable at some point */ static const float vscroll_fraction = 0.025; static const float hscroll_fraction = 0.05; @@ -134,7 +138,11 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local) #endif mt->caps.abs[MTDEV_POSITION_X].minimum, mt->caps.abs[MTDEV_POSITION_X].maximum, +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 + 1, 0, 1, Absolute); +#else 1, 0, 1); +#endif xf86InitValuatorDefaults(dev, 0); xf86InitValuatorAxisStruct(dev, 1, #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 @@ -142,7 +150,11 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local) #endif mt->caps.abs[MTDEV_POSITION_Y].minimum, mt->caps.abs[MTDEV_POSITION_Y].maximum, +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 + 1, 0, 1, Absolute); +#else 1, 0, 1); +#endif xf86InitValuatorDefaults(dev, 1); XIRegisterPropertyHandler(dev, pointer_property, NULL, NULL); @@ -289,6 +301,26 @@ static Bool device_control(DeviceIntPtr dev, int mode) } +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 +static int preinit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) +{ + struct MTouch *mt; + + mt = calloc(1, sizeof(*mt)); + if (!mt) + return BadAlloc; + + pInfo->private = mt; + pInfo->type_name = XI_TOUCHPAD; + pInfo->device_control = device_control; + pInfo->read_input = read_input; + pInfo->switch_mode = 0; + //xf86CollectInputOptions(local, NULL); + //xf86ProcessCommonOptions(local, local->options); + + return Success; +} +#else static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags) { struct MTouch *mt; @@ -315,6 +347,7 @@ static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags) error: return local; } +#endif static void uninit(InputDriverPtr drv, InputInfoPtr local, int flags) { -- cgit v1.2.3