summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@openbsd.org>2009-11-23 16:21:50 +0000
committerMatthieu Herrb <matthieu@openbsd.org>2009-11-23 16:21:50 +0000
commitbc3a428df118bd6bb4bcfcd6d0f22bf9ead5795b (patch)
treed9e68f11a76c2dd6a07935ab1a4f5a9586c651e4
parent352ed8302074a5b7186653deaadd7543d03e4ce5 (diff)
Set buttons and axis labels for XInput 2.
-rw-r--r--src/ws.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/ws.c b/src/ws.c
index 1db9ab6..b61e99c 100644
--- a/src/ws.c
+++ b/src/ws.c
@@ -35,6 +35,11 @@
#include <mipointer.h>
#include <extinit.h>
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+#include <X11/Xatom.h>
+#include <xserver-properties.h>
+#endif
+
#define NAXES 2 /* X and Y axes only */
#define NBUTTONS 32 /* max theoretical buttons */
#define DFLTBUTTONS 3 /* default number of buttons */
@@ -367,7 +372,12 @@ wsDeviceInit(DeviceIntPtr pWS)
#endif
DBG(1, ErrorF("WS DEVICE_INIT\n"));
-
+
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ 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);
+#endif
priv->screen_width = screenInfo.screens[priv->screen_no]->width;
priv->screen_height = screenInfo.screens[priv->screen_no]->height;
@@ -381,6 +391,15 @@ wsDeviceInit(DeviceIntPtr pWS)
map))
return !Success;
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+ if ((priv->type == WSMOUSE_TYPE_TPANEL)) {
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+ } else {
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ }
+#endif
if (!InitValuatorClassDeviceStruct(pWS,
NAXES,
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7