summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xi/exevents.c3
-rw-r--r--dix/devices.c43
-rw-r--r--dix/getevents.c4
-rw-r--r--hw/kdrive/src/kinput.c45
-rw-r--r--hw/vfb/InitInput.c24
-rw-r--r--hw/xfree86/common/xf86Module.h2
-rw-r--r--hw/xfree86/common/xf86Xinput.c4
-rw-r--r--hw/xfree86/common/xf86Xinput.h2
-rw-r--r--hw/xnest/Pointer.c20
-rw-r--r--hw/xquartz/darwin.c67
-rw-r--r--hw/xwin/winmouse.c20
-rw-r--r--include/exevents.h1
-rw-r--r--include/input.h6
-rw-r--r--include/inputstr.h2
14 files changed, 201 insertions, 42 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index dc9eba70e..98973b7ff 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1153,7 +1153,7 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
* @see InitValuatorClassDeviceStruct
*/
void
-InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
+InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
int resolution, int min_res, int max_res)
{
AxisInfoPtr ax;
@@ -1170,6 +1170,7 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
ax->resolution = resolution;
ax->min_resolution = min_res;
ax->max_resolution = max_res;
+ ax->label = label;
}
static void
diff --git a/dix/devices.c b/dix/devices.c
index 517829a53..5fa196e1f 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -554,16 +554,33 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
static int
CorePointerProc(DeviceIntPtr pDev, int what)
{
- BYTE map[33];
+#define NBUTTONS 32
+#define NAXES 2
+ BYTE map[NBUTTONS + 1];
int i = 0;
+ Atom btn_labels[NBUTTONS] = {0};
+ Atom axes_labels[NAXES] = {0};
switch (what) {
case DEVICE_INIT:
- for (i = 1; i <= 32; i++)
+ for (i = 1; i <= NBUTTONS; i++)
map[i] = i;
- if (!InitPointerDeviceStruct((DevicePtr)pDev, map, 32,
+
+ 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);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ /* don't know about the rest */
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
+ if (!InitPointerDeviceStruct((DevicePtr)pDev, map, NBUTTONS, btn_labels,
(PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), 2))
+ GetMotionHistorySize(), NAXES, axes_labels))
{
ErrorF("Could not initialize device '%s'. Out of memory.\n",
pDev->name);
@@ -583,6 +600,9 @@ CorePointerProc(DeviceIntPtr pDev, int what)
}
return Success;
+
+#undef NBUTTONS
+#undef NAXES
}
/**
@@ -1133,7 +1153,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
}
_X_EXPORT Bool
-InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
+InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom* labels,
CARD8 *map)
{
ButtonClassPtr butc;
@@ -1146,12 +1166,13 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
butc->sourceid = dev->id;
for (i = 1; i <= numButtons; i++)
butc->map[i] = map[i];
+ memcpy(butc->labels, labels, numButtons * sizeof(Atom));
dev->button = butc;
return TRUE;
}
Bool
-InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
+InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
int numMotionEvents, int mode)
{
int i;
@@ -1190,7 +1211,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
AllocateMotionHistory(dev);
for (i=0; i<numAxes; i++) {
- InitValuatorAxisStruct(dev, i, NO_AXIS_LIMITS, NO_AXIS_LIMITS,
+ InitValuatorAxisStruct(dev, i, labels[i], NO_AXIS_LIMITS, NO_AXIS_LIMITS,
0, 0, 0);
valc->axisVal[i]=0;
}
@@ -1459,14 +1480,14 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
}
Bool
-InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons,
+InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons, Atom* btn_labels,
PtrCtrlProcPtr controlProc, int numMotionEvents,
- int numAxes)
+ int numAxes, Atom *axes_labels)
{
DeviceIntPtr dev = (DeviceIntPtr)device;
- return(InitButtonClassDeviceStruct(dev, numButtons, map) &&
- InitValuatorClassDeviceStruct(dev, numAxes,
+ return(InitButtonClassDeviceStruct(dev, numButtons, btn_labels, map) &&
+ InitValuatorClassDeviceStruct(dev, numAxes, axes_labels,
numMotionEvents, 0) &&
InitPtrFeedbackClassDeviceStruct(dev, controlProc));
}
diff --git a/dix/getevents.c b/dix/getevents.c
index 9b1908cbb..7c018c14d 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -214,7 +214,7 @@ CreateClassesChangedEvent(EventList* event,
{
dce->buttons.num_buttons = slave->button->numButtons;
for (i = 0; i < dce->buttons.num_buttons; i++)
- dce->buttons.names[i] = 0; /* FIXME */
+ dce->buttons.names[i] = slave->button->labels[i];
}
if (slave->valuator)
{
@@ -226,7 +226,7 @@ CreateClassesChangedEvent(EventList* event,
dce->valuators[i].resolution = slave->valuator->axes[i].resolution;
/* This should, eventually, be a per-axis mode */
dce->valuators[i].mode = slave->valuator->mode;
- dce->valuators[i].name = 0; /* FIXME: */
+ dce->valuators[i].name = slave->valuator->axes[i].label;
}
}
if (slave->key)
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 740852ee0..5e7ff5376 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -46,6 +46,7 @@
#include "exevents.h"
#include "extinit.h"
#include "exglobals.h"
+#include "xserver-properties.h"
#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
@@ -382,6 +383,8 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
DevicePtr pDev = (DevicePtr)pDevice;
KdPointerInfo *pi;
Atom xiclass;
+ Atom *btn_labels;
+ Atom *axes_labels;
if (!pDev)
return BadImplementation;
@@ -429,9 +432,47 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
return !Success;
}
- InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
+ btn_labels = xcalloc(pi->nButtons, sizeof(Atom));
+ if (!btn_labels)
+ return BadAlloc;
+ axes_labels = xcalloc(pi->nAxes, sizeof(Atom));
+ if (!axes_labels) {
+ xfree(btn_labels);
+ return BadAlloc;
+ }
+
+ switch(pi->nAxes)
+ {
+ default:
+ case 7:
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ case 6:
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ case 5:
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ case 4:
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ case 3:
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ case 2:
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ case 1:
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ case 0:
+ break;
+ }
+
+ if (pi->nAxes >= 2) {
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ }
+
+ InitPointerDeviceStruct(pDev, pi->map, pi->nButtons, btn_labels,
(PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), pi->nAxes);
+ GetMotionHistorySize(), pi->nAxes, axes_labels);
+
+ xfree(btn_labels);
+ xfree(axes_labels);
if (pi->inputClass == KD_TOUCHSCREEN) {
InitAbsoluteClassDeviceStruct(pDevice);
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index 4c8c99653..7f2d56fa8 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -41,6 +41,8 @@ from The Open Group.
#include "lk201kbd.h"
#include "xkbsrv.h"
#include <X11/keysym.h>
+#include "xserver-properties.h"
+#include "exevents.h"
Bool
LegalModifier(unsigned int key, DeviceIntPtr pDev)
@@ -87,8 +89,13 @@ vfbKeybdProc(DeviceIntPtr pDevice, int onoff)
static int
vfbMouseProc(DeviceIntPtr pDevice, int onoff)
{
- BYTE map[4];
+#define NBUTTONS 3
+#define NAXES 2
+
+ BYTE map[NBUTTONS + 1];
DevicePtr pDev = (DevicePtr)pDevice;
+ Atom btn_labels[NBUTTONS] = {0};
+ Atom axes_labels[NAXES] = {0};
switch (onoff)
{
@@ -96,8 +103,16 @@ vfbMouseProc(DeviceIntPtr pDevice, int onoff)
map[1] = 1;
map[2] = 2;
map[3] = 3;
- InitPointerDeviceStruct(pDev, map, 3,
- (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), 2);
+
+ 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);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
+ InitPointerDeviceStruct(pDev, map, NBUTTONS, btn_labels,
+ (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), NAXES, axes_labels);
break;
case DEVICE_ON:
@@ -112,6 +127,9 @@ vfbMouseProc(DeviceIntPtr pDevice, int onoff)
break;
}
return Success;
+
+#undef NBUTTONS
+#undef NAXES
}
void
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 5d36cecff..ded52162e 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -83,7 +83,7 @@ typedef enum {
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(5, 0)
-#define ABI_XINPUT_VERSION SET_ABI_VERSION(6, 0)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(7, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(2, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 39186ac9f..cb1e92090 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -1010,13 +1010,13 @@ xf86XInputSetScreen(LocalDevicePtr local,
void
-xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
+xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
int resolution, int min_res, int max_res)
{
if (!dev || !dev->valuator)
return;
- InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res,
+ InitValuatorAxisStruct(dev, axnum, label, minval, maxval, resolution, min_res,
max_res);
}
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 04c663faa..0ad56649b 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -171,7 +171,7 @@ extern _X_EXPORT LocalDevicePtr xf86FirstLocalDevice(void);
extern _X_EXPORT int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
extern _X_EXPORT void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
-extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
+extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
int maxval, int resolution, int min_res,
int max_res);
extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c
index 8f764a624..c5d361c63 100644
--- a/hw/xnest/Pointer.c
+++ b/hw/xnest/Pointer.c
@@ -33,6 +33,8 @@ is" without express or implied warranty.
#include "Pointer.h"
#include "Args.h"
+#include "xserver-properties.h"
+
DeviceIntPtr xnestPointerDevice = NULL;
void
@@ -46,6 +48,8 @@ int
xnestPointerProc(DeviceIntPtr pDev, int onoff)
{
CARD8 map[MAXBUTTONS];
+ Atom btn_labels[MAXBUTTONS] = {0};
+ Atom axes_labels[2] = {0};
int nmap;
int i;
@@ -55,9 +59,21 @@ xnestPointerProc(DeviceIntPtr pDev, int onoff)
nmap = XGetPointerMapping(xnestDisplay, map, MAXBUTTONS);
for (i = 0; i <= nmap; i++)
map[i] = i; /* buttons are already mapped */
- InitPointerDeviceStruct(&pDev->public, map, nmap,
+
+ 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);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
+ InitPointerDeviceStruct(&pDev->public, map, nmap, btn_labels,
xnestChangePointerControl,
- GetMotionHistorySize(), 2);
+ GetMotionHistorySize(), 2, axes_labels);
break;
case DEVICE_ON:
xnestEventMask |= XNEST_POINTER_EVENT_MASK;
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index f01668201..fdbdfe48c 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -51,6 +51,8 @@
#include "exevents.h"
#include "extinit.h"
+#include "xserver-properties.h"
+
#include <sys/types.h>
#include <sys/time.h>
#include <sys/syslimits.h>
@@ -336,17 +338,35 @@ static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv)
* DarwinMouseProc: Handle the initialization, etc. of a mouse
*/
static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
+#define NBUTTONS 7
+#define NAXES 2
// 7 buttons: left, right, middle, then four scroll wheel "buttons"
- CARD8 map[8] = {0, 1, 2, 3, 4, 5, 6, 7};
-
+ CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3, 4, 5, 6, 7};
+ Atom btn_labels[NAXES] = {0};
+ Atom axes_labels[NBUTTONS] = {0};
+
switch (what) {
case DEVICE_INIT:
pPointer->public.on = FALSE;
-
+
+ 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);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
+
// Set button map.
- InitPointerDeviceStruct((DevicePtr)pPointer, map, 7,
+ InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
+ btn_labels,
(PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), 2);
+ GetMotionHistorySize(), NAXES,
+ axes_labels);
pPointer->valuator->mode = Absolute; // Relative
InitAbsoluteClassDeviceStruct(pPointer);
// InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
@@ -364,28 +384,43 @@ static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
}
return Success;
+#undef NBUTTONS
+#undef NAXES
}
static int DarwinTabletProc(DeviceIntPtr pPointer, int what) {
- CARD8 map[4] = {0, 1, 2, 3};
-
+#define NBUTTONS 3
+#define NAXES 5
+ CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3};
+ Atom axes_labels[NAXES] = {0};
+ Atom btn_labels[NBUTTONS] = {0};
+
switch (what) {
case DEVICE_INIT:
pPointer->public.on = FALSE;
-
+
+ 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);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+
// Set button map.
- InitPointerDeviceStruct((DevicePtr)pPointer, map, 3,
+ InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
+ btn_labels,
(PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), 5);
+ GetMotionHistorySize(), NAXES,
+ axes_labels);
pPointer->valuator->mode = Absolute; // Relative
InitProximityClassDeviceStruct(pPointer);
InitAbsoluteClassDeviceStruct(pPointer);
- InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 2, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 3, -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 4, -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 3, axes_labels[3], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 4, axes_labels[4], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
// pPointer->use = IsXExtensionDevice;
break;
case DEVICE_ON:
@@ -399,6 +434,8 @@ static int DarwinTabletProc(DeviceIntPtr pPointer, int what) {
return Success;
}
return Success;
+#undef NBUTTONS
+#undef NAXES
}
/*
diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c
index 9cfc945f8..e6d891397 100644
--- a/hw/xwin/winmouse.c
+++ b/hw/xwin/winmouse.c
@@ -38,6 +38,8 @@
#if defined(XFree86Server)
#include "inputstr.h"
+#include "exevents.h" /* for button/axes labels */
+#include "xserver-properties.h"
/* Peek the internal button mapping */
static CARD8 const *g_winMouseButtonMap = NULL;
@@ -70,6 +72,8 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
int lngWheelEvents = 2;
CARD8 *map;
DevicePtr pDevice = (DevicePtr) pDeviceInt;
+ Atom *btn_labels;
+ Atom axes_labels[2];
switch (iState)
{
@@ -97,13 +101,27 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
map[0] = 0;
for (i=1; i <= lngMouseButtons + lngWheelEvents; i++)
map[i] = i;
+
+ btn_labels = calloc((lngMouseButtons + lngWheelEvents), sizeof(Atom));
+ 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);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
InitPointerDeviceStruct (pDevice,
+ btn_labels,
map,
lngMouseButtons + lngWheelEvents,
winMouseCtrl,
GetMotionHistorySize(),
- 2);
+ 2,
+ axes_labels);
free(map);
+ free(btn_labels);
#if defined(XFree86Server)
g_winMouseButtonMap = pDeviceInt->button->map;
diff --git a/include/exevents.h b/include/exevents.h
index 80eaa768d..861d0ddb1 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -73,6 +73,7 @@ extern _X_EXPORT int InitProximityClassDeviceStruct(
extern _X_EXPORT void InitValuatorAxisStruct(
DeviceIntPtr /* dev */,
int /* axnum */,
+ Atom /* label */,
int /* minval */,
int /* maxval */,
int /* resolution */,
diff --git a/include/input.h b/include/input.h
index b3d56b31c..9711fa87d 100644
--- a/include/input.h
+++ b/include/input.h
@@ -274,11 +274,13 @@ extern _X_EXPORT Bool SetKeySymsMap(
extern _X_EXPORT Bool InitButtonClassDeviceStruct(
DeviceIntPtr /*device*/,
int /*numButtons*/,
+ Atom* /* labels */,
CARD8* /*map*/);
extern _X_EXPORT Bool InitValuatorClassDeviceStruct(
DeviceIntPtr /*device*/,
int /*numAxes*/,
+ Atom* /* labels */,
int /*numMotionEvents*/,
int /*mode*/);
@@ -351,9 +353,11 @@ extern _X_EXPORT Bool InitPointerDeviceStruct(
DevicePtr /*device*/,
CARD8* /*map*/,
int /*numButtons*/,
+ Atom* /* btn_labels */,
PtrCtrlProcPtr /*controlProc*/,
int /*numMotionEvents*/,
- int /*numAxes*/);
+ int /*numAxes*/,
+ Atom* /* axes_labels */);
extern _X_EXPORT Bool InitKeyboardDeviceStruct(
DeviceIntPtr /*device*/,
diff --git a/include/inputstr.h b/include/inputstr.h
index 23c34a5e8..b284ea4e9 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -215,6 +215,7 @@ typedef struct _AxisInfo {
int max_resolution;
int min_value;
int max_value;
+ Atom label;
} AxisInfo, *AxisInfoPtr;
typedef struct _ValuatorAccelerationRec {
@@ -254,6 +255,7 @@ typedef struct _ButtonClassRec {
CARD8 postdown[DOWN_LENGTH];
CARD8 map[MAP_LENGTH];
union _XkbAction *xkb_acts;
+ Atom labels[MAX_BUTTONS];
} ButtonClassRec, *ButtonClassPtr;
typedef struct _FocusClassRec {