summaryrefslogtreecommitdiff
path: root/driver/multitouch.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2011-02-13 09:54:06 +0100
committerHenrik Rydberg <rydberg@euromail.se>2011-02-13 09:54:39 +0100
commita12ed738095819beab0b42c6c8a1566c063bb79e (patch)
tree27220019fadf6e4e782f67f5030435d1caee5d88 /driver/multitouch.c
parentfc4d145455bec7f3899db992a48ce26b7798b928 (diff)
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 <rydberg@euromail.se>
Diffstat (limited to 'driver/multitouch.c')
-rw-r--r--driver/multitouch.c33
1 files changed, 33 insertions, 0 deletions
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 @@
26#include <xserver-properties.h> 26#include <xserver-properties.h>
27#endif 27#endif
28 28
29#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
30typedef InputInfoPtr LocalDevicePtr;
31#endif
32
29/* these should be user-configurable at some point */ 33/* these should be user-configurable at some point */
30static const float vscroll_fraction = 0.025; 34static const float vscroll_fraction = 0.025;
31static const float hscroll_fraction = 0.05; 35static const float hscroll_fraction = 0.05;
@@ -134,7 +138,11 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local)
134#endif 138#endif
135 mt->caps.abs[MTDEV_POSITION_X].minimum, 139 mt->caps.abs[MTDEV_POSITION_X].minimum,
136 mt->caps.abs[MTDEV_POSITION_X].maximum, 140 mt->caps.abs[MTDEV_POSITION_X].maximum,
141#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
142 1, 0, 1, Absolute);
143#else
137 1, 0, 1); 144 1, 0, 1);
145#endif
138 xf86InitValuatorDefaults(dev, 0); 146 xf86InitValuatorDefaults(dev, 0);
139 xf86InitValuatorAxisStruct(dev, 1, 147 xf86InitValuatorAxisStruct(dev, 1,
140#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 148#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
@@ -142,7 +150,11 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local)
142#endif 150#endif
143 mt->caps.abs[MTDEV_POSITION_Y].minimum, 151 mt->caps.abs[MTDEV_POSITION_Y].minimum,
144 mt->caps.abs[MTDEV_POSITION_Y].maximum, 152 mt->caps.abs[MTDEV_POSITION_Y].maximum,
153#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
154 1, 0, 1, Absolute);
155#else
145 1, 0, 1); 156 1, 0, 1);
157#endif
146 xf86InitValuatorDefaults(dev, 1); 158 xf86InitValuatorDefaults(dev, 1);
147 159
148 XIRegisterPropertyHandler(dev, pointer_property, NULL, NULL); 160 XIRegisterPropertyHandler(dev, pointer_property, NULL, NULL);
@@ -289,6 +301,26 @@ static Bool device_control(DeviceIntPtr dev, int mode)
289} 301}
290 302
291 303
304#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
305static int preinit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
306{
307 struct MTouch *mt;
308
309 mt = calloc(1, sizeof(*mt));
310 if (!mt)
311 return BadAlloc;
312
313 pInfo->private = mt;
314 pInfo->type_name = XI_TOUCHPAD;
315 pInfo->device_control = device_control;
316 pInfo->read_input = read_input;
317 pInfo->switch_mode = 0;
318 //xf86CollectInputOptions(local, NULL);
319 //xf86ProcessCommonOptions(local, local->options);
320
321 return Success;
322}
323#else
292static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags) 324static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags)
293{ 325{
294 struct MTouch *mt; 326 struct MTouch *mt;
@@ -315,6 +347,7 @@ static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags)
315 error: 347 error:
316 return local; 348 return local;
317} 349}
350#endif
318 351
319static void uninit(InputDriverPtr drv, InputInfoPtr local, int flags) 352static void uninit(InputDriverPtr drv, InputInfoPtr local, int flags)
320{ 353{