mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
14 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf356d9399 | ||
|
|
4c1c4f2c83 | ||
|
|
c0bee1b4d6 | ||
|
|
8acc999d40 | ||
|
|
3cce7fa38a | ||
|
|
c793aa2738 | ||
|
|
9f3632c0b6 | ||
|
|
06b303f26d | ||
|
|
4dda242d56 | ||
|
|
4efe0d272e | ||
|
|
1432b5153e | ||
|
|
b8519930e4 | ||
|
|
6d43a45b99 | ||
|
|
40d3ad3ac0 |
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
AC_PREREQ(2.57)
|
AC_PREREQ(2.57)
|
||||||
AC_INIT([xf86-input-evdev],
|
AC_INIT([xf86-input-evdev],
|
||||||
2.2.2,
|
2.2.4,
|
||||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||||
xf86-input-evdev)
|
xf86-input-evdev)
|
||||||
|
|
||||||
@@ -68,9 +68,6 @@ if test "x$BUILD_TEST" = "xyes"; then
|
|||||||
AC_SUBST([DLOPEN_LIBS])
|
AC_SUBST([DLOPEN_LIBS])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checks for extensions
|
|
||||||
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
|
|
||||||
|
|
||||||
# Checks for pkg-config packages. We need to be able to override sdkdir
|
# Checks for pkg-config packages. We need to be able to override sdkdir
|
||||||
# to satisfy silly distcheck requirements.
|
# to satisfy silly distcheck requirements.
|
||||||
PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES)
|
PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES)
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ server, such as touchscreens that require run-time calibration.
|
|||||||
.BI "Evdev Axis Inversion"
|
.BI "Evdev Axis Inversion"
|
||||||
2 boolean values (8 bit, 0 or 1), order X, Y. 1 inverts the axis.
|
2 boolean values (8 bit, 0 or 1), order X, Y. 1 inverts the axis.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Axis Swap"
|
.BI "Evdev Axes Swap"
|
||||||
1 boolean value (8 bit, 0 or 1). 1 swaps x/y axes.
|
1 boolean value (8 bit, 0 or 1). 1 swaps x/y axes.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Drag Lock Buttons"
|
.BI "Evdev Drag Lock Buttons"
|
||||||
|
|||||||
@@ -327,6 +327,9 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
|||||||
void
|
void
|
||||||
EvdevMBEmuOn(InputInfoPtr pInfo)
|
EvdevMBEmuOn(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
|
if (!pInfo->dev->button) /* don't init for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
EvdevMBEmuWakeupHandler,
|
EvdevMBEmuWakeupHandler,
|
||||||
(pointer)pInfo);
|
(pointer)pInfo);
|
||||||
@@ -335,6 +338,9 @@ EvdevMBEmuOn(InputInfoPtr pInfo)
|
|||||||
void
|
void
|
||||||
EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
|
if (!pInfo->dev->button) /* don't cleanup for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
EvdevMBEmuWakeupHandler,
|
EvdevMBEmuWakeupHandler,
|
||||||
(pointer)pInfo);
|
(pointer)pInfo);
|
||||||
|
|||||||
@@ -337,15 +337,6 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|||||||
16, PropModeReplace, 1,
|
16, PropModeReplace, 1,
|
||||||
&pEvdev->emulateWheel.inertia, TRUE);
|
&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)
|
else if (atom == prop_wheel_button)
|
||||||
|
|||||||
128
src/evdev.c
128
src/evdev.c
@@ -362,6 +362,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
|
|||||||
|
|
||||||
switch (ev->type) {
|
switch (ev->type) {
|
||||||
case EV_REL:
|
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 */
|
/* Handle mouse wheel emulation */
|
||||||
if (EvdevWheelEmuFilterMotion(pInfo, ev))
|
if (EvdevWheelEmuFilterMotion(pInfo, ev))
|
||||||
break;
|
break;
|
||||||
@@ -392,6 +396,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EV_ABS:
|
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)
|
if (ev->code > ABS_MAX)
|
||||||
break;
|
break;
|
||||||
pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
|
pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
|
||||||
@@ -1053,6 +1061,9 @@ EvdevAddRelClass(DeviceIntPtr device)
|
|||||||
if (TestBit(REL_DIAL, pEvdev->rel_bitmask))
|
if (TestBit(REL_DIAL, pEvdev->rel_bitmask))
|
||||||
num_axes--;
|
num_axes--;
|
||||||
|
|
||||||
|
if (num_axes <= 0)
|
||||||
|
return !Success;
|
||||||
|
|
||||||
pEvdev->num_vals = num_axes;
|
pEvdev->num_vals = num_axes;
|
||||||
memset(pEvdev->vals, 0, num_axes * sizeof(int));
|
memset(pEvdev->vals, 0, num_axes * sizeof(int));
|
||||||
|
|
||||||
@@ -1095,9 +1106,7 @@ EvdevAddButtonClass(DeviceIntPtr device)
|
|||||||
pInfo = device->public.devicePrivate;
|
pInfo = device->public.devicePrivate;
|
||||||
pEvdev = pInfo->private;
|
pEvdev = pInfo->private;
|
||||||
|
|
||||||
/* FIXME: count number of actual buttons */
|
if (!InitButtonClassDeviceStruct(device, pEvdev->buttons, pEvdev->btnmap))
|
||||||
if (!InitButtonClassDeviceStruct(device, ArrayLength(pEvdev->btnmap),
|
|
||||||
pEvdev->btnmap))
|
|
||||||
return !Success;
|
return !Success;
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
@@ -1154,6 +1163,64 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
EvdevInitAbsClass(DeviceIntPtr device, EvdevPtr pEvdev)
|
||||||
|
{
|
||||||
|
if (EvdevAddAbsClass(device) == Success) {
|
||||||
|
|
||||||
|
xf86Msg(X_INFO,"%s: initialized for absolute axes.\n", device->name);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
xf86Msg(X_ERROR,"%s: failed to initialize for absolute axes.\n",
|
||||||
|
device->name);
|
||||||
|
|
||||||
|
pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
EvdevInitRelClass(DeviceIntPtr device, EvdevPtr pEvdev)
|
||||||
|
{
|
||||||
|
int has_abs_axes = pEvdev->flags & EVDEV_ABSOLUTE_EVENTS;
|
||||||
|
|
||||||
|
if (EvdevAddRelClass(device) == Success) {
|
||||||
|
|
||||||
|
xf86Msg(X_INFO,"%s: initialized for relative axes.\n", device->name);
|
||||||
|
|
||||||
|
if (has_abs_axes) {
|
||||||
|
|
||||||
|
xf86Msg(X_WARNING,"%s: ignoring absolute axes.\n", device->name);
|
||||||
|
pEvdev->flags &= ~EVDEV_ABSOLUTE_EVENTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
xf86Msg(X_ERROR,"%s: failed to initialize for relative axes.\n",
|
||||||
|
device->name);
|
||||||
|
|
||||||
|
pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
|
||||||
|
|
||||||
|
if (has_abs_axes)
|
||||||
|
EvdevInitAbsClass(device, pEvdev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
EvdevInitTouchDevice(DeviceIntPtr device, EvdevPtr pEvdev)
|
||||||
|
{
|
||||||
|
if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) {
|
||||||
|
|
||||||
|
xf86Msg(X_WARNING,"%s: touchpads and touchscreens ignore relative "
|
||||||
|
"axes.\n", device->name);
|
||||||
|
|
||||||
|
pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EvdevInitAbsClass(device, pEvdev);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
EvdevInit(DeviceIntPtr device)
|
EvdevInit(DeviceIntPtr device)
|
||||||
{
|
{
|
||||||
@@ -1172,19 +1239,27 @@ EvdevInit(DeviceIntPtr device)
|
|||||||
EvdevAddKeyClass(device);
|
EvdevAddKeyClass(device);
|
||||||
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
|
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
|
||||||
EvdevAddButtonClass(device);
|
EvdevAddButtonClass(device);
|
||||||
/* We don't allow relative and absolute axes on the same device. Reason
|
|
||||||
Reason being that some devices (MS Optical Desktop 2000) register both
|
|
||||||
rel and abs axes for x/y.
|
|
||||||
The abs axes register min/max, this min/max then also applies to the
|
|
||||||
relative device (the mouse) and caps it at 0..255 for both axis.
|
|
||||||
So unless you have a small screen, you won't be enjoying it much.
|
|
||||||
|
|
||||||
FIXME: somebody volunteer to fix this.
|
/* We don't allow relative and absolute axes on the same device. The
|
||||||
|
* reason is that some devices (MS Optical Desktop 2000) register both
|
||||||
|
* rel and abs axes for x/y.
|
||||||
|
*
|
||||||
|
* The abs axes register min/max; this min/max then also applies to the
|
||||||
|
* relative device (the mouse) and caps it at 0..255 for both axes.
|
||||||
|
* So, unless you have a small screen, you won't be enjoying it much;
|
||||||
|
* consequently, absolute axes are generally ignored.
|
||||||
|
*
|
||||||
|
* However, currenly only a device with absolute axes can be registered
|
||||||
|
* as a touch{pad,screen}. Thus, given such a device, absolute axes are
|
||||||
|
* used and relative axes are ignored.
|
||||||
*/
|
*/
|
||||||
if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
|
|
||||||
EvdevAddRelClass(device);
|
if (pEvdev->flags & (EVDEV_TOUCHPAD | EVDEV_TOUCHSCREEN))
|
||||||
|
EvdevInitTouchDevice(device, pEvdev);
|
||||||
|
else if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
|
||||||
|
EvdevInitRelClass(device, pEvdev);
|
||||||
else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
|
else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
|
||||||
EvdevAddAbsClass(device);
|
EvdevInitAbsClass(device, pEvdev);
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
#ifdef HAVE_PROPERTIES
|
||||||
/* We drop the return value, the only time we ever want the handlers to
|
/* We drop the return value, the only time we ever want the handlers to
|
||||||
@@ -1466,8 +1541,14 @@ EvdevProbe(InputInfoPtr pInfo)
|
|||||||
/* count all buttons */
|
/* count all buttons */
|
||||||
for (i = BTN_MISC; i < BTN_JOYSTICK; i++)
|
for (i = BTN_MISC; i < BTN_JOYSTICK; i++)
|
||||||
{
|
{
|
||||||
|
int mapping = 0;
|
||||||
if (TestBit(i, pEvdev->key_bitmask))
|
if (TestBit(i, pEvdev->key_bitmask))
|
||||||
num_buttons++;
|
{
|
||||||
|
mapping =
|
||||||
|
pEvdev->btnmap[EvdevUtilButtonEventToButtonNumber(pEvdev, i)];
|
||||||
|
if (mapping > num_buttons)
|
||||||
|
num_buttons = mapping;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_buttons)
|
if (num_buttons)
|
||||||
@@ -1763,6 +1844,17 @@ EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code)
|
|||||||
button = (TestBit(BTN_RIGHT, pEvdev->key_bitmask)) ? 10 : 3;
|
button = (TestBit(BTN_RIGHT, pEvdev->key_bitmask)) ? 10 : 3;
|
||||||
break;
|
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_SIDE:
|
||||||
case BTN_EXTRA:
|
case BTN_EXTRA:
|
||||||
case BTN_FORWARD:
|
case BTN_FORWARD:
|
||||||
@@ -1982,7 +2074,7 @@ EvdevInitProperty(DeviceIntPtr dev)
|
|||||||
|
|
||||||
#ifdef HAVE_LABELS
|
#ifdef HAVE_LABELS
|
||||||
/* Axis labelling */
|
/* 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];
|
Atom atom, atoms[pEvdev->num_vals];
|
||||||
int natoms = pEvdev->num_vals;
|
int natoms = pEvdev->num_vals;
|
||||||
@@ -2026,14 +2118,14 @@ EvdevInitProperty(DeviceIntPtr dev)
|
|||||||
XISetDevicePropertyDeletable(dev, prop_axis_label, FALSE);
|
XISetDevicePropertyDeletable(dev, prop_axis_label, FALSE);
|
||||||
}
|
}
|
||||||
/* Button labelling */
|
/* 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;
|
int button, bmap;
|
||||||
|
|
||||||
/* First, make sure all atoms are initialized */
|
/* First, make sure all atoms are initialized */
|
||||||
atom = XIGetKnownProperty(BTN_LABEL_PROP_BTN_UNKNOWN);
|
atom = XIGetKnownProperty(BTN_LABEL_PROP_BTN_UNKNOWN);
|
||||||
for (button = 0; button < pEvdev->buttons; button++)
|
for (button = 0; button < ArrayLength(atoms); button++)
|
||||||
atoms[button] = atom;
|
atoms[button] = atom;
|
||||||
|
|
||||||
for (button = BTN_MISC; button < BTN_JOYSTICK; button++)
|
for (button = BTN_MISC; button < BTN_JOYSTICK; button++)
|
||||||
|
|||||||
Reference in New Issue
Block a user