diff options
author | Andreas Nüßlein <nutz@unfoog.de> | 2010-01-17 19:37:43 +0100 |
---|---|---|
committer | Henrik Rydberg <rydberg@alnilam.(none)> | 2010-01-28 21:03:46 +0100 |
commit | 508628ac685dba1051f024d8c09eeb8921fd3517 (patch) | |
tree | 2fd665e11b255ef334c2498fa2a8d584e809d87b | |
parent | ccca3d1dffd79392d204815e5ce60aa5ded20973 (diff) |
ABI_XINPUT_VERSION >= 7 support
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/gestures.h | 1 | ||||
-rw-r--r-- | src/multitouch.c | 68 |
3 files changed, 70 insertions, 1 deletions
@@ -29,7 +29,7 @@ DLIB = usr/lib/xorg/modules/input DFDI = usr/share/hal/fdi/policy/20thirdparty INCLUDE = -I. -I/usr/include/xorg -I/usr/include/pixman-1 -OPTS = -O3 +OPTS = -O3 -fPIC .PHONY: all clean .PRECIOUS: obj/%.o diff --git a/src/gestures.h b/src/gestures.h index de029b7..5f3923e 100644 --- a/src/gestures.h +++ b/src/gestures.h @@ -9,6 +9,7 @@ #define GS_MOVE 1 #define GS_VSCROLL 2 #define GS_HSCROLL 3 +#define SYN_MAX_BUTTONS 12 /* Max number of mouse buttons */ //////////////////////////////////////////////////////// diff --git a/src/multitouch.c b/src/multitouch.c index 4fb1e4b..e2309bd 100644 --- a/src/multitouch.c +++ b/src/multitouch.c @@ -21,6 +21,12 @@ #include "gestures.h" +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 +#include <X11/Xatom.h> +#include <xserver-properties.h> +#endif + + //////////////////////////////////////////////////////////////////////////// static void pointer_control(DeviceIntPtr dev, PtrCtrl *ctrl) @@ -41,10 +47,60 @@ static int pointer_property(DeviceIntPtr dev, //////////////////////////////////////////////////////////////////////////// + + +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 +static void InitAxesLabels(Atom *labels, int nlabels) +{ + memset(labels, 0, nlabels * sizeof(Atom)); + switch(nlabels) + { + default: + case 2: + labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); + case 1: + labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); + break; + } +} + +static void InitButtonLabels(Atom *labels, int nlabels) +{ + memset(labels, 0, nlabels * sizeof(Atom)); + switch(nlabels) + { + default: + case 7: + labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); + case 6: + labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); + case 5: + labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); + case 4: + labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); + case 3: + labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); + case 2: + labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); + case 1: + labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); + break; + } +} +#endif + static int device_init(DeviceIntPtr dev, LocalDevicePtr local) { struct MTouch *mt = local->private; unsigned char btmap[DIM_BUTTON + 1]={0,1,2,3}; +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + Atom btn_labels[SYN_MAX_BUTTONS] = { 0 }; + Atom axes_labels[2] = { 0 }; + + InitAxesLabels(axes_labels, 2); + InitButtonLabels(btn_labels, SYN_MAX_BUTTONS); +#endif + local->fd = xf86OpenSerial(local->options); if (local->fd < 0) { @@ -70,16 +126,28 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local) pointer_control, GetMotionHistorySize(), 2); +#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 7 + InitPointerDeviceStruct((DevicePtr)dev, + btmap, DIM_BUTTON, btn_labels, + pointer_control, + GetMotionHistorySize(), + 2, axes_labels); #else #error "Unsupported ABI_XINPUT_VERSION" #endif xf86InitValuatorAxisStruct(dev, 0, +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + axes_labels[0], +#endif mt->caps.abs_position_x.minimum, mt->caps.abs_position_x.maximum, 1, 0, 1); xf86InitValuatorDefaults(dev, 0); xf86InitValuatorAxisStruct(dev, 1, +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 + axes_labels[1], +#endif mt->caps.abs_position_y.minimum, mt->caps.abs_position_y.maximum, 1, 0, 1); |