Compare commits

..

27 Commits

Author SHA1 Message Date
Peter Hutterer
c0bee1b4d6 evdev 2.2.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 11:11:43 +10:00
Peter Hutterer
8acc999d40 Evdev doesn't require inputproto.
None of the inputproto headers seem to be included anywhere.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 6f4634111a)

Conflicts:

	configure.ac
2009-07-30 09:44:34 +10:00
Peter Hutterer
3cce7fa38a If a device fails to initialize relative axes, init the abs. axes instead.
Some devices have relative axes that don't count (scroll wheels). In this
case, don't claim we've initialized relative axes, continue with the
absolute axes instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b07ab6ea97)
2009-07-30 09:44:34 +10:00
Peter Hutterer
c793aa2738 Don't register middle mouse button emulation handlers for keyboards.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 2994825665)
2009-07-30 09:44:34 +10:00
Oliver McFadden
9f3632c0b6 Coverity Prevent: NO_EFFECT in EvdevWheelEmuSetProperty:
Event unsigned_compare: Comparing unsigned less than zero is never true. "pEvdev->emulateWheel.timeout < 0UL"
342  	            if (pEvdev->emulateWheel.timeout < 0)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9bfd9e8a36)
2009-07-30 09:44:34 +10:00
Asbjrn Sannes
06b303f26d evdev: Fix spelling of property in man page to match source code. #22571
Signed-off-by: Asbj�rn Sannes <ace@sannes.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit db8b1ca5cf)
2009-07-30 09:44:34 +10:00
Derek Upham
4dda242d56 evdev: Prevent driver from processing motion events that it has not configured. #21832
The current implementation initializes itself to support relative
motion events, or absolute motion events, or neither.  But the
event-handling code attempts to process all events, no matter what the
initialization was.  This patch reproduces the flag tests found during
init, to skip events that the driver doesn't support.

Signed-off-by: Derek Upham <sand@blarg.net>
Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 0a3657d2ee)
2009-07-30 09:44:33 +10:00
Peter Hutterer
4efe0d272e Deal with BTN_3 to BTN_9 buttons.
These buttons were previously mapped to 0, i.e. inactive. This patch
slightly improves things in that the buttons are now mapped to 8+.

Devices that have both BTN_3 and BTN_SIDE (or a similar pair in that
sequence) have both mapped to the same button number though.
Devices that have BTN_LEFT, BTN_0, BTN_3 and BTN_SIDE have the last three
mapped to 8 (and their followers have double-mappings too). We'll fix that
once we actually see devices affected by this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit dc2191285e)
2009-07-30 09:44:33 +10:00
Peter Hutterer
1432b5153e Only initialize the number of buttons we actually have.
This takes into account driver-configured button mappings, i.e. if device
with one button has this button mapped to 25 through the ButtonMapping
option, the X server will think the device has result 25 buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 255b9f6bbf)
2009-07-30 09:44:33 +10:00
Peter Hutterer
b8519930e4 Ensure enough buttons are advertised to pass the button mapping.
Some buttons are mapped to higher button numbers. For example, BTN_0 is
posted as button 8 if BTN_LEFT is present. On top of that, the
driver-specific button mapping may map the button to something else again.
We need to take these mappings into account when counting the number of
buttons on the device.

Example: A device with BTN_LEFT and BTN_0 and a mapping from 1 -> 7 and 8 ->
2.

BTN_LEFT is mapped to 1. 1 is mapped to 7. num_buttons is 7.
BTN_0 is mapped to 8. 8 is mapped to 2. num_buttons remains 7.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b358f1eb3a)
2009-07-30 09:44:33 +10:00
Peter Hutterer
6d43a45b99 Up the number of button labels atoms to EVDEV_MAXBUTTONS.
Button labels would smash memory if the device had less than 4 buttons and
did not advertise a wheel event. In this case the hard-coded wheel button
labels would write past the atoms[] boundary.

Potential memory smash if a device had a BTN_LEFT and BTN_0, since the
latter would map to 8, regardless of the the number of actual buttons
(same with BTN_MIDDLE and BTN_1 or BTN_RIGHT and BTN_2).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 33cc112ca1)
2009-07-30 09:44:33 +10:00
Peter Hutterer
40d3ad3ac0 Only label axes and buttons if the device has axes or buttons.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 3c43d880f1)
2009-07-30 09:44:33 +10:00
Peter Hutterer
cf887a2b7c evdev 2.2.2 2009-04-30 16:39:15 +10:00
Peter Hutterer
1cc0651e1b Print read errors as X_NONE to avoid mallocs in the server.
Messages of type X_NONE are just passed down to the log files, everything else
gets the (EE) or (II) prefixed. Since this mallocs, we can't use it in the
signal handler.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 220e2dfb8f)
2009-04-30 16:38:43 +10:00
Peter Hutterer
48a747ea86 Pre-allocate the reopen timer so we don't allocate during sigio handling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ddc1266374)
2009-04-30 16:38:41 +10:00
Peter Hutterer
aa58eb6096 Trigger read error handling if len is <= 0.
Red Hat Bug 494245 <https://bugzilla.redhat.com/show_bug.cgi?id=494245>

Reported-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 98ecb5233b)
2009-04-06 10:44:55 +10:00
Peter Hutterer
aff7228d97 evdev 2.2.1 2009-03-24 15:13:23 +10:00
Peter Hutterer
c695234c5c Fix jumpy touchpads by updating old_vals only when reported by the device.
Remember whether ABS_X or ABS_Y were reported before the SYN event and only
update the old_vals[0, 1] if we got data for them.
Touchpads that reported pressure data before x/y would otherwise update
old_x/y with bogus values, leading to jumps when the first x/y coordinates
were actually reported.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d9809d7edd)
2009-03-23 16:36:15 +10:00
Peter Hutterer
79d4956add If we have a touchpad, print so, don't claim we're configuring a tablet.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit b11439a176)
2009-03-23 16:36:13 +10:00
Jeremy Jay
7e9809837c make sure to clear all axis_map entries
don't use uninitialized axis_map entries, ie axis_map[ABS_PRESSURE]

Signed-off-by: Jeremy Jay <dinkumator@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 740dc202f7)
2009-03-23 16:36:06 +10:00
Peter Hutterer
d07692a4af Assume touchscreen/touchpad if we have _either_ ABS_PRESSURE or BTN_TOUCH
Touchpads have pressure or touch and also BTN_TOOL_FINGER.
Touchscreens have either pressure or touch, but no finger.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 7ac0c4456d)
2009-03-23 16:36:03 +10:00
Jeremy Jay
1073cd4fdc Set "rel" when converting absolute touchpad coordinates to relative (#20661)
We unset "abs" and convert to relative, but never set "rel" so the events
don't get posted. This bit got broken in 43dd2a9592.

X.Org Bug 20661 <http://bugs.freedesktop.org/show_bug.cgi?id=20661>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit a3ea979c2b)
2009-03-23 16:35:50 +10:00
Peter Hutterer
486bbdc481 Restore repeat-filtering for server 1.5 and earlier.
Letting the server deal with key repeats is fine if we have server 1.6. For
earlier servers, we need to pass on the repeat events (except for modifier
keys).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Marty Jack <martyj19@comcast.net>
(cherry picked from commit a7fb654a68)
2009-03-23 16:35:46 +10:00
Peter Hutterer
73e5eba8cd evdev 2.2.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-09 10:02:23 +10:00
Peter Hutterer
31853c39bf Define MAX_VALUATORS if it's missing to allow for builds against 1.5.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-09 09:31:16 +10:00
Peter Hutterer
2c49e21a81 Check button label before fetching the Atom from the server. (#20524)
The server doesn't like NULL names, so don't call XIGetKnownProperty for
labels that don't exist.

X.Org Bug 20524 <http://bugs.freedesktop.org/show_bug.cgi?id=20524>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Peter Henriksson
2009-03-09 09:23:57 +10:00
Peter Hutterer
4361b3efa0 Fix duplicate wheel button up mapping.
Reported by Simon Thum.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Simon Thum <simon.thum@gmx.de>
2009-03-06 19:45:28 +10:00
6 changed files with 122 additions and 44 deletions

View File

@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-input-evdev],
2.1.99.1,
2.2.3,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-input-evdev)
@@ -68,9 +68,6 @@ if test "x$BUILD_TEST" = "xyes"; then
AC_SUBST([DLOPEN_LIBS])
fi
# Checks for extensions
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
# Checks for pkg-config packages. We need to be able to override sdkdir
# to satisfy silly distcheck requirements.
PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES)

View File

@@ -171,7 +171,7 @@ server, such as touchscreens that require run-time calibration.
.BI "Evdev Axis Inversion"
2 boolean values (8 bit, 0 or 1), order X, Y. 1 inverts the axis.
.TP 7
.BI "Evdev Axis Swap"
.BI "Evdev Axes Swap"
1 boolean value (8 bit, 0 or 1). 1 swaps x/y axes.
.TP 7
.BI "Evdev Drag Lock Buttons"

View File

@@ -327,6 +327,9 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)
void
EvdevMBEmuOn(InputInfoPtr pInfo)
{
if (!pInfo->dev->button) /* don't init for keyboards */
return;
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
EvdevMBEmuWakeupHandler,
(pointer)pInfo);
@@ -335,6 +338,9 @@ EvdevMBEmuOn(InputInfoPtr pInfo)
void
EvdevMBEmuFinalize(InputInfoPtr pInfo)
{
if (!pInfo->dev->button) /* don't cleanup for keyboards */
return;
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
EvdevMBEmuWakeupHandler,
(pointer)pInfo);

View File

@@ -337,15 +337,6 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
16, PropModeReplace, 1,
&pEvdev->emulateWheel.inertia, TRUE);
}
/* Don't enable with negative timeout */
if (pEvdev->emulateWheel.timeout < 0)
{
pEvdev->emulateWheel.timeout = 200;
XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16,
PropModeReplace, 1,
&pEvdev->emulateWheel.timeout, TRUE);
}
}
}
else if (atom == prop_wheel_button)

View File

@@ -263,8 +263,17 @@ PostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
static char warned[KEY_CNT];
/* Filter all repeated events from device.
We'll do softrepeat in the server */
if (value == 2)
We'll do softrepeat in the server, but only since 1.6 */
if (value == 2
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) <= 2
&& (ev->code == KEY_LEFTCTRL || ev->code == KEY_RIGHTCTRL ||
ev->code == KEY_LEFTSHIFT || ev->code == KEY_RIGHTSHIFT ||
ev->code == KEY_LEFTALT || ev->code == KEY_RIGHTALT ||
ev->code == KEY_LEFTMETA || ev->code == KEY_RIGHTMETA ||
ev->code == KEY_CAPSLOCK || ev->code == KEY_NUMLOCK ||
ev->code == KEY_SCROLLLOCK) /* XXX windows keys? */
#endif
)
return;
if (code > 255)
@@ -333,6 +342,9 @@ EvdevReopenTimer(OsTimerPtr timer, CARD32 time, pointer arg)
return 100; /* come back in 100 ms */
}
#define ABS_X_VALUE 0x1
#define ABS_Y_VALUE 0x2
#define ABS_VALUE 0x4
/**
* Take one input event and process it accordingly.
*/
@@ -350,6 +362,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
switch (ev->type) {
case EV_REL:
/* Ignore EV_REL events if we never set up for them. */
if (!(pEvdev->flags & EVDEV_RELATIVE_EVENTS))
break;
/* Handle mouse wheel emulation */
if (EvdevWheelEmuFilterMotion(pInfo, ev))
break;
@@ -380,10 +396,19 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
break;
case EV_ABS:
/* Ignore EV_ABS events if we never set up for them. */
if (!(pEvdev->flags & EVDEV_ABSOLUTE_EVENTS))
break;
if (ev->code > ABS_MAX)
break;
pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
abs = 1;
if (ev->code == ABS_X)
abs |= ABS_X_VALUE;
else if (ev->code == ABS_Y)
abs |= ABS_Y_VALUE;
else
abs |= ABS_VALUE;
break;
case EV_KEY:
@@ -434,17 +459,20 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
case EV_SYN:
/* convert to relative motion for touchpads */
if (abs && (pEvdev->flags & EVDEV_TOUCHPAD)) {
abs = 0;
if (pEvdev->tool) { /* meaning, touch is active */
if (pEvdev->old_vals[0] != -1)
delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0];
if (pEvdev->old_vals[1] != -1)
delta[REL_Y] = pEvdev->vals[1] - pEvdev->old_vals[1];
pEvdev->old_vals[0] = pEvdev->vals[0];
pEvdev->old_vals[1] = pEvdev->vals[1];
if (abs & ABS_X_VALUE)
pEvdev->old_vals[0] = pEvdev->vals[0];
if (abs & ABS_Y_VALUE)
pEvdev->old_vals[1] = pEvdev->vals[1];
} else {
pEvdev->old_vals[0] = pEvdev->old_vals[1] = -1;
}
abs = 0;
rel = 1;
}
if (rel) {
@@ -527,6 +555,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
}
}
#undef ABS_X_VALUE
#undef ABS_Y_VALUE
#undef ABS_VALUE
/* just a magic number to reduce the number of reads */
#define NUM_EVENTS 16
@@ -540,25 +572,32 @@ EvdevReadInput(InputInfoPtr pInfo)
while (len == sizeof(ev))
{
len = read(pInfo->fd, &ev, sizeof(ev));
if (len == 0)
if (len <= 0)
{
if (errno == ENODEV) /* May happen after resume */
{
xf86RemoveEnabledDevice(pInfo);
close(pInfo->fd);
pInfo->fd = -1;
pEvdev->reopen_left = pEvdev->reopen_attempts;
pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo);
if (pEvdev->reopen_timer)
{
pEvdev->reopen_left = pEvdev->reopen_attempts;
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo);
}
} else if (errno != EAGAIN)
xf86Msg(X_ERROR, "%s: Read error: %s\n", pInfo->name,
{
/* We use X_NONE here because it doesn't alloc */
xf86MsgVerb(X_NONE, 0, "%s: Read error: %s\n", pInfo->name,
strerror(errno));
}
break;
}
/* The kernel promises that we always only read a complete
* event, so len != sizeof ev is an error. */
if (len % sizeof(ev[0])) {
/* The kernel promises that we always only read a complete
* event, so len != sizeof ev is an error. */
xf86Msg(X_ERROR, "%s: Read error: %s\n", pInfo->name, strerror(errno));
/* We use X_NONE here because it doesn't alloc */
xf86MsgVerb(X_NONE, 0, "%s: Read error: %s\n", pInfo->name, strerror(errno));
break;
}
@@ -1022,6 +1061,9 @@ EvdevAddRelClass(DeviceIntPtr device)
if (TestBit(REL_DIAL, pEvdev->rel_bitmask))
num_axes--;
if (num_axes <= 0)
return !Success;
pEvdev->num_vals = num_axes;
memset(pEvdev->vals, 0, num_axes * sizeof(int));
@@ -1064,9 +1106,7 @@ EvdevAddButtonClass(DeviceIntPtr device)
pInfo = device->public.devicePrivate;
pEvdev = pInfo->private;
/* FIXME: count number of actual buttons */
if (!InitButtonClassDeviceStruct(device, ArrayLength(pEvdev->btnmap),
pEvdev->btnmap))
if (!InitButtonClassDeviceStruct(device, pEvdev->buttons, pEvdev->btnmap))
return !Success;
return Success;
@@ -1126,12 +1166,17 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
static int
EvdevInit(DeviceIntPtr device)
{
int i;
InputInfoPtr pInfo;
EvdevPtr pEvdev;
pInfo = device->public.devicePrivate;
pEvdev = pInfo->private;
/* clear all axis_map entries */
for(i = 0; i < max(ABS_CNT,REL_CNT); i++)
pEvdev->axis_map[i]=-1;
if (pEvdev->flags & EVDEV_KEYBOARD_EVENTS)
EvdevAddKeyClass(device);
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
@@ -1145,9 +1190,18 @@ EvdevInit(DeviceIntPtr device)
FIXME: somebody volunteer to fix this.
*/
if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
EvdevAddRelClass(device);
else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) {
if (EvdevAddRelClass(device) == Success)
{
if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
xf86Msg(X_INFO,"%s: relative axes found, ignoring absolute "
"axes.\n", device->name);
pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
} else
pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
}
if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
EvdevAddAbsClass(device);
#ifdef HAVE_PROPERTIES
@@ -1197,7 +1251,7 @@ EvdevOn(DeviceIntPtr device)
if (pInfo->fd == -1)
{
pEvdev->reopen_left = pEvdev->reopen_attempts;
pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo);
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo);
} else
{
pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
@@ -1208,6 +1262,8 @@ EvdevOn(DeviceIntPtr device)
return !Success;
}
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 0, NULL, NULL);
xf86FlushInput(pInfo->fd);
xf86AddEnabledDevice(pInfo);
EvdevMBEmuOn(pInfo);
@@ -1428,8 +1484,14 @@ EvdevProbe(InputInfoPtr pInfo)
/* count all buttons */
for (i = BTN_MISC; i < BTN_JOYSTICK; i++)
{
int mapping = 0;
if (TestBit(i, pEvdev->key_bitmask))
num_buttons++;
{
mapping =
pEvdev->btnmap[EvdevUtilButtonEventToButtonNumber(pEvdev, i)];
if (mapping > num_buttons)
num_buttons = mapping;
}
}
if (num_buttons)
@@ -1462,9 +1524,9 @@ EvdevProbe(InputInfoPtr pInfo)
TestBit(ABS_Y, pEvdev->abs_bitmask)) {
xf86Msg(X_INFO, "%s: Found x and y absolute axes\n", pInfo->name);
pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;
if (!TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) &&
TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
if (num_buttons) {
if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) ||
TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
if (num_buttons || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
xf86Msg(X_INFO, "%s: Found absolute touchpad\n", pInfo->name);
pEvdev->flags |= EVDEV_TOUCHPAD;
memset(pEvdev->old_vals, -1, sizeof(int) * pEvdev->num_vals);
@@ -1490,7 +1552,10 @@ EvdevProbe(InputInfoPtr pInfo)
if (has_axes && num_buttons) {
pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |
XI86_CONFIGURED;
if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask)) {
if (pEvdev->flags & EVDEV_TOUCHPAD) {
xf86Msg(X_INFO, "%s: Configuring as touchpad\n", pInfo->name);
pInfo->type_name = XI_TOUCHPAD;
} else if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask)) {
xf86Msg(X_INFO, "%s: Configuring as tablet\n", pInfo->name);
pInfo->type_name = XI_TABLET;
} else {
@@ -1722,6 +1787,17 @@ EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code)
button = (TestBit(BTN_RIGHT, pEvdev->key_bitmask)) ? 10 : 3;
break;
/* FIXME: BTN_3.. and BTN_SIDE.. have the same button mapping */
case BTN_3:
case BTN_4:
case BTN_5:
case BTN_6:
case BTN_7:
case BTN_8:
case BTN_9:
button = (code - BTN_0 + 5);
break;
case BTN_SIDE:
case BTN_EXTRA:
case BTN_FORWARD:
@@ -1941,7 +2017,7 @@ EvdevInitProperty(DeviceIntPtr dev)
#ifdef HAVE_LABELS
/* Axis labelling */
if ((prop_axis_label = XIGetKnownProperty(AXIS_LABEL_PROP)))
if ((pEvdev->num_vals > 0) && (prop_axis_label = XIGetKnownProperty(AXIS_LABEL_PROP)))
{
Atom atom, atoms[pEvdev->num_vals];
int natoms = pEvdev->num_vals;
@@ -1985,14 +2061,14 @@ EvdevInitProperty(DeviceIntPtr dev)
XISetDevicePropertyDeletable(dev, prop_axis_label, FALSE);
}
/* Button labelling */
if ((prop_btn_label = XIGetKnownProperty(BTN_LABEL_PROP)))
if ((pEvdev->buttons > 0) && (prop_btn_label = XIGetKnownProperty(BTN_LABEL_PROP)))
{
Atom atom, atoms[pEvdev->buttons];
Atom atom, atoms[EVDEV_MAXBUTTONS];
int button, bmap;
/* First, make sure all atoms are initialized */
atom = XIGetKnownProperty(BTN_LABEL_PROP_BTN_UNKNOWN);
for (button = 0; button < pEvdev->buttons; button++)
for (button = 0; button < ArrayLength(atoms); button++)
atoms[button] = atom;
for (button = BTN_MISC; button < BTN_JOYSTICK; button++)
@@ -2002,6 +2078,9 @@ EvdevInitProperty(DeviceIntPtr dev)
int group = (button % 0x100)/16;
int idx = button - ((button/16) * 16);
if (!btn_labels[group][idx])
continue;
atom = XIGetKnownProperty(btn_labels[group][idx]);
if (!atom)
continue;
@@ -2014,7 +2093,7 @@ EvdevInitProperty(DeviceIntPtr dev)
/* wheel buttons, hardcoded anyway */
atoms[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
atoms[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
atoms[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
atoms[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
atoms[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);

View File

@@ -59,6 +59,11 @@
#define HAVE_PROPERTIES 1
#endif
#ifndef MAX_VALUATORS
#define MAX_VALUATORS 36
#endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 5
typedef struct {
char *rules;