summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-22 13:36:54 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-22 13:43:36 +1000
commita87f59f431c86272e45fdc3ed328fd30be1db2ae (patch)
tree73010d1c4742d9d7159d9c36fd8018082ce1a75f /src
parent8da028291921a3948486c60ad8c7a52c4f431a56 (diff)
Cope with ABI_XINPUT_VERSION 7 - requires button/axes labels.
We don't have an atom for relative pressure, so if the device is set to relative, we export the axis as REL_Z instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/acecad.c46
1 files changed, 43 insertions, 3 deletions
diff --git a/src/acecad.c b/src/acecad.c
index 63c5aaf..1dac489 100644
--- a/src/acecad.c
+++ b/src/acecad.c
@@ -78,6 +78,11 @@
#endif
#endif
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+#include <X11/Xatom.h>
+#include <xserver-properties.h>
+#endif
+
/* Previously found in xf86Xinput.h */
#ifdef DBG
#undef DBG
@@ -627,13 +632,36 @@ DeviceInit (DeviceIntPtr dev)
int rx, ry;
LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate;
AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private);
- unsigned char map[] =
- {0, 1, 2, 3};
+ unsigned char map[] = {0, 1, 2, 3};
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ Atom btn_labels[3];
+ Atom axes_labels[3];
+
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+
+ if ((priv->flags & ABSOLUTE_FLAG))
+ {
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+ axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE);
+ } else
+ {
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Z);
+ }
+#endif
xf86MsgVerb(X_INFO, 4, "%s Init\n", local->name);
/* 3 boutons */
- if (InitButtonClassDeviceStruct (dev, 3, map) == FALSE)
+ if (InitButtonClassDeviceStruct (dev, 3,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ btn_labels,
+#endif
+ map) == FALSE)
{
xf86Msg(X_ERROR, "%s: unable to allocate ButtonClassDeviceStruct\n", local->name);
return !Success;
@@ -653,6 +681,9 @@ DeviceInit (DeviceIntPtr dev)
/* 3 axes */
if (InitValuatorClassDeviceStruct (dev, 3,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ axes_labels,
+#endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
xf86GetMotionEvents,
#endif
@@ -668,6 +699,9 @@ DeviceInit (DeviceIntPtr dev)
InitValuatorAxisStruct(dev,
0,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ axes_labels[0],
+#endif
0, /* min val */
#if XORG_BOTCHED_INPUT
screenInfo.screens[0]->width,
@@ -679,6 +713,9 @@ DeviceInit (DeviceIntPtr dev)
1000); /* max_res */
InitValuatorAxisStruct(dev,
1,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ axes_labels[1],
+#endif
0, /* min val */
#if XORG_BOTCHED_INPUT
screenInfo.screens[0]->height,
@@ -690,6 +727,9 @@ DeviceInit (DeviceIntPtr dev)
1000); /* max_res */
InitValuatorAxisStruct(dev,
2,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ axes_labels[2],
+#endif
0, /* min val */
priv->acecadMaxZ, /* max val */
1000, /* resolution */