diff options
Diffstat (limited to 'driver')
| -rw-r--r-- | driver/multitouch.c | 33 |
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 | ||
| 30 | typedef InputInfoPtr LocalDevicePtr; | ||
| 31 | #endif | ||
| 32 | |||
| 29 | /* these should be user-configurable at some point */ | 33 | /* these should be user-configurable at some point */ |
| 30 | static const float vscroll_fraction = 0.025; | 34 | static const float vscroll_fraction = 0.025; |
| 31 | static const float hscroll_fraction = 0.05; | 35 | static 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 | ||
| 305 | static 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 | ||
| 292 | static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags) | 324 | static 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 | ||
| 319 | static void uninit(InputDriverPtr drv, InputInfoPtr local, int flags) | 352 | static void uninit(InputDriverPtr drv, InputInfoPtr local, int flags) |
| 320 | { | 353 | { |
