mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
13 Commits
tracking/x
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
708eb34599 | ||
|
|
36a687796f | ||
|
|
26229df106 | ||
|
|
f4616d87fc | ||
|
|
2aa5ca8cdd | ||
|
|
39263dc65d | ||
|
|
57521e4e60 | ||
|
|
7da1522309 | ||
|
|
b4fcb825fc | ||
|
|
7c955ad050 | ||
|
|
4f80c0f2cb | ||
|
|
5070d64aa8 | ||
|
|
caacacf057 |
@@ -22,7 +22,7 @@
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT([xf86-input-evdev],
|
||||
2.0.99,
|
||||
2.0.99.1,
|
||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||
xf86-input-evdev)
|
||||
|
||||
|
||||
@@ -54,4 +54,8 @@
|
||||
/* BOOL, 2 values [x, y], 1 inverts axis */
|
||||
#define EVDEV_PROP_INVERT_AXES "Evdev Axis Inversion"
|
||||
|
||||
/* Reopen attempts. */
|
||||
/* CARD8 */
|
||||
#define EVDEV_PROP_REOPEN "Evdev Reopen Attempts"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -52,12 +52,12 @@ The mapping from device node to hardware is system-dependent.
|
||||
Enable/disable the emulation of the third (middle) mouse button for mice
|
||||
which only have two physical buttons. The third button is emulated by
|
||||
pressing both buttons simultaneously. Default: on, until a middle mouse
|
||||
button event is registered.
|
||||
button event is registered. Property: "Evdev Middle Button Emulation".
|
||||
.TP 7
|
||||
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
|
||||
Sets the timeout (in milliseconds) that the driver waits before deciding
|
||||
if two buttons where pressed "simultaneously" when 3 button emulation is
|
||||
enabled. Default: 50.
|
||||
enabled. Default: 50. Property: "Evdev Middle Button Timeout".
|
||||
.TP 7
|
||||
.BI "Option \*qButtonMapping\*q \*q" string \*q
|
||||
Sets the button mapping for this device. The mapping is a space-separated list
|
||||
@@ -74,12 +74,13 @@ Sets \*qdrag lock buttons\*q that simulate holding a button down, so
|
||||
that low dexterity people do not have to hold a button down at the
|
||||
same time they move a mouse cursor. Button numbers occur in pairs,
|
||||
with the lock button number occurring first, followed by the button
|
||||
number that is the target of the lock button.
|
||||
number that is the target of the lock button. Property: "Evdev
|
||||
Drag Lock Buttons".
|
||||
.TP 7
|
||||
.BI "Option \*qDragLockButtons\*q \*q" "M1" \*q
|
||||
Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q
|
||||
indicating that the next button pressed is to be
|
||||
\*qdrag locked\*q.
|
||||
\*qdrag locked\*q. Property: "Evdev Drag Lock Buttons".
|
||||
.TP 7
|
||||
.BI "Option \*qEmulateWheel\*q \*q" boolean \*q
|
||||
Enable/disable "wheel" emulation. Wheel emulation means emulating button
|
||||
@@ -94,7 +95,7 @@ more buttons but no wheel. See the description of the
|
||||
.BR XAxisMapping ,
|
||||
and
|
||||
.B YAxisMapping
|
||||
options below. Default: off.
|
||||
options below. Default: off. Property "Evdev Wheel Emulation".
|
||||
.TP 7
|
||||
.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q
|
||||
Specifies which button must be held down to enable wheel emulation mode.
|
||||
@@ -103,11 +104,12 @@ press/release events as specified for the
|
||||
.B XAxisMapping
|
||||
and
|
||||
.B YAxisMapping
|
||||
settings. Default: 4.
|
||||
settings. Default: 4. Property: "Evdev Wheel Emulation Button".
|
||||
.TP 7
|
||||
.BI "Option \*qEmulateWheelInertia\*q \*q" integer \*q
|
||||
Specifies how far (in pixels) the pointer must move to generate button
|
||||
press/release events in wheel emulation mode. Default: 10.
|
||||
press/release events in wheel emulation mode. Default: 10. Property: "Evdev
|
||||
Wheel Emulation Inertia".
|
||||
.TP 7
|
||||
.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
|
||||
Specifies the time in milliseconds the
|
||||
@@ -115,7 +117,7 @@ Specifies the time in milliseconds the
|
||||
must be pressed before wheel emulation is started. If the
|
||||
.BR EmulateWheelButton
|
||||
is released before this timeout, the original button press/release event
|
||||
is sent. Default: 200.
|
||||
is sent. Default: 200. Property: "Evdev Wheel Emulation Timeout".
|
||||
.TP 7
|
||||
.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q
|
||||
Specifies which buttons are mapped to motion in the X direction in wheel
|
||||
@@ -123,7 +125,8 @@ emulation mode. Button number
|
||||
.I N1
|
||||
is mapped to the negative X axis motion and button number
|
||||
.I N2
|
||||
is mapped to the positive X axis motion. Default: no mapping.
|
||||
is mapped to the positive X axis motion. Default: no mapping. Property:
|
||||
"Evdev Wheel Emulation Axes".
|
||||
.TP 7
|
||||
.BI "Option \*qYAxisMapping\*q \*q" "N1 N2" \*q
|
||||
Specifies which buttons are mapped to motion in the Y direction in wheel
|
||||
@@ -131,11 +134,50 @@ emulation mode. Button number
|
||||
.I N1
|
||||
is mapped to the negative Y axis motion and button number
|
||||
.I N2
|
||||
is mapped to the positive Y axis motion. Default: "4 5"
|
||||
is mapped to the positive Y axis motion. Default: "4 5". Property:
|
||||
"Evdev Wheel Emulation Axes".
|
||||
.TP 7
|
||||
.BI "Option \*qReopenAttempts\*q \*q" integer \*q
|
||||
Number of reopen attempts after a read error occurs on the device (e.g. after
|
||||
waking up from suspend). In between each attempt is a 100ms wait. Default: 10.
|
||||
.TP 7
|
||||
.BI "Option \*qInvertX\*q \*q" Bool \*q
|
||||
.TP 7
|
||||
.BI "Option \*qInvertY\*q \*q" Bool \*q
|
||||
Invert the given axis. Default: off. Property: "Evdev Axis Inversion".
|
||||
|
||||
.SH SUPPORTED PROPERTIES
|
||||
The following properties are provided by the
|
||||
.B evdev
|
||||
driver.
|
||||
.TP 7
|
||||
.BI "Evdev Middle Button Emulation"
|
||||
1 boolean value (8 bit, 0 or 1).
|
||||
.TP 7
|
||||
.BI "Evdev Middle Button Timeout"
|
||||
1 16-bit positive value.
|
||||
.TP 7
|
||||
.BI "Evdev Wheel Emulation"
|
||||
1 boolean value (8 bit, 0 or 1).
|
||||
.TP 7
|
||||
.BI "Evdev Wheel Emulation Axes"
|
||||
4 8-bit values, order X up, X down, Y up, Y down. 0 disables a value.
|
||||
.TP 7
|
||||
.BI "Evdev Wheel Emulation Inertia"
|
||||
1 16-bit positive value.
|
||||
.TP 7
|
||||
.BI "Evdev Wheel Emulation Timeout"
|
||||
1 16-bit positive value.
|
||||
.TP 7
|
||||
.BI "Evdev Wheel Emulation Button"
|
||||
1 8-bit value, allowed range 0-32, 0 disables the button.
|
||||
.TP 7
|
||||
.BI "Evdev Drag Lock Buttons"
|
||||
8-bit. Either 1 value or pairs of values. Value range 0-32, 0 disables a
|
||||
value.
|
||||
.TP 7
|
||||
.BI "Evdev Axis Inversion"
|
||||
2 boolean values (8 bit, 0 or 1), order X, Y. 1 inverts the axis.
|
||||
|
||||
.SH AUTHORS
|
||||
Kristian Høgsberg.
|
||||
|
||||
@@ -53,7 +53,7 @@ void EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button);
|
||||
|
||||
/* Setup and configuration code */
|
||||
void
|
||||
EvdevDragLockInit(InputInfoPtr pInfo)
|
||||
EvdevDragLockPreInit(InputInfoPtr pInfo)
|
||||
{
|
||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||
char *option_string = NULL;
|
||||
@@ -210,45 +210,6 @@ EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value)
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
/**
|
||||
* Initialise property for drag lock buttons setting.
|
||||
*/
|
||||
void
|
||||
EvdevDragLockInitProperty(DeviceIntPtr dev)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
if (!dev->button) /* don't init prop for keyboards */
|
||||
return;
|
||||
|
||||
prop_dlock = MakeAtom(EVDEV_PROP_DRAGLOCK, strlen(EVDEV_PROP_DRAGLOCK), TRUE);
|
||||
if (pEvdev->dragLock.meta)
|
||||
{
|
||||
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8,
|
||||
PropModeReplace, 1, &pEvdev->dragLock.meta,
|
||||
FALSE);
|
||||
} else {
|
||||
int highest = 0;
|
||||
int i;
|
||||
CARD8 pair[EVDEV_MAXBUTTONS] = {0};
|
||||
|
||||
for (i = 0; i < EVDEV_MAXBUTTONS; i++)
|
||||
{
|
||||
if (pEvdev->dragLock.lock_pair[i])
|
||||
highest = i;
|
||||
pair[i] = pEvdev->dragLock.lock_pair[i];
|
||||
}
|
||||
|
||||
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8, PropModeReplace,
|
||||
highest + 1, pair, FALSE);
|
||||
}
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_dlock, FALSE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the drag lock property.
|
||||
* If only one value is supplied, then this is used as the meta button.
|
||||
@@ -314,4 +275,44 @@ EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise property for drag lock buttons setting.
|
||||
*/
|
||||
void
|
||||
EvdevDragLockInitProperty(DeviceIntPtr dev)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
if (!dev->button) /* don't init prop for keyboards */
|
||||
return;
|
||||
|
||||
prop_dlock = MakeAtom(EVDEV_PROP_DRAGLOCK, strlen(EVDEV_PROP_DRAGLOCK), TRUE);
|
||||
if (pEvdev->dragLock.meta)
|
||||
{
|
||||
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8,
|
||||
PropModeReplace, 1, &pEvdev->dragLock.meta,
|
||||
FALSE);
|
||||
} else {
|
||||
int highest = 0;
|
||||
int i;
|
||||
CARD8 pair[EVDEV_MAXBUTTONS] = {0};
|
||||
|
||||
for (i = 0; i < EVDEV_MAXBUTTONS; i++)
|
||||
{
|
||||
if (pEvdev->dragLock.lock_pair[i])
|
||||
highest = i;
|
||||
pair[i] = pEvdev->dragLock.lock_pair[i];
|
||||
}
|
||||
|
||||
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8, PropModeReplace,
|
||||
highest + 1, pair, FALSE);
|
||||
}
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_dlock, FALSE);
|
||||
|
||||
XIRegisterPropertyHandler(dev, EvdevDragLockSetProperty, NULL, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
61
src/emuMB.c
61
src/emuMB.c
@@ -320,15 +320,6 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
||||
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||
EvdevMBEmuWakeupHandler,
|
||||
(pointer)pInfo);
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
XIChangeDeviceProperty(pInfo->dev, prop_mbemu, XA_INTEGER, 8,
|
||||
PropModeReplace, 1, &pEvdev->emulateMB.enabled,
|
||||
TRUE);
|
||||
XIChangeDeviceProperty(pInfo->dev, prop_mbtimeout, XA_INTEGER, 16,
|
||||
PropModeReplace, 1, &pEvdev->emulateMB.timeout,
|
||||
TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -351,6 +342,32 @@ EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
|
||||
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
int
|
||||
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
if (atom == prop_mbemu)
|
||||
{
|
||||
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
if (!checkonly)
|
||||
pEvdev->emulateMB.enabled = *((BOOL*)val->data);
|
||||
} else if (atom == prop_mbtimeout)
|
||||
{
|
||||
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
if (!checkonly)
|
||||
pEvdev->emulateMB.timeout = *((INT16*)val->data);
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise property for MB emulation on/off.
|
||||
*/
|
||||
@@ -382,31 +399,7 @@ EvdevMBEmuInitProperty(DeviceIntPtr dev)
|
||||
if (rc != Success)
|
||||
return;
|
||||
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
|
||||
}
|
||||
|
||||
int
|
||||
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
if (atom == prop_mbemu)
|
||||
{
|
||||
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
if (!checkonly)
|
||||
pEvdev->emulateMB.enabled = *((BOOL*)val->data);
|
||||
} else if (atom == prop_mbtimeout)
|
||||
{
|
||||
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
if (!checkonly)
|
||||
pEvdev->emulateMB.timeout = *((INT16*)val->data);
|
||||
}
|
||||
|
||||
return Success;
|
||||
XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
145
src/emuWheel.c
145
src/emuWheel.c
@@ -308,91 +308,9 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
||||
"EmulateWheelInertia: %d, "
|
||||
"EmulateWheelTimeout: %d\n",
|
||||
pInfo->name, pEvdev->emulateWheel.button, inertia, timeout);
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_emu, XA_INTEGER, 8,
|
||||
PropModeReplace, 1, &pEvdev->emulateWheel.enabled, TRUE);
|
||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_button, XA_INTEGER, 8,
|
||||
PropModeReplace, 1, &pEvdev->emulateWheel.button, TRUE);
|
||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_inertia, XA_INTEGER, 8,
|
||||
PropModeReplace, 1, &pEvdev->emulateWheel.inertia, TRUE);
|
||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_timeout, XA_INTEGER, 16,
|
||||
PropModeReplace, 1, &pEvdev->emulateWheel.timeout, TRUE);
|
||||
|
||||
val[0] = pEvdev->emulateWheel.X.up_button;
|
||||
val[1] = pEvdev->emulateWheel.X.down_button;
|
||||
val[2] = pEvdev->emulateWheel.Y.up_button;
|
||||
val[3] = pEvdev->emulateWheel.Y.down_button;
|
||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_axismap, XA_INTEGER, 8,
|
||||
PropModeReplace, 4, val, TRUE);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
void
|
||||
EvdevWheelEmuInitProperty(DeviceIntPtr dev)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
int rc = TRUE;
|
||||
INT32 vals[4] = { TRUE, FALSE};
|
||||
|
||||
if (!dev->button) /* don't init prop for keyboards */
|
||||
return;
|
||||
|
||||
prop_wheel_emu = MakeAtom(EVDEV_PROP_WHEEL, strlen(EVDEV_PROP_WHEEL), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_emu, XA_INTEGER, 8,
|
||||
PropModeReplace, 1,
|
||||
&pEvdev->emulateWheel.enabled, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_emu, FALSE);
|
||||
|
||||
vals[0] = pEvdev->emulateWheel.X.up_button;
|
||||
vals[1] = pEvdev->emulateWheel.X.down_button;
|
||||
vals[2] = pEvdev->emulateWheel.Y.up_button;
|
||||
vals[3] = pEvdev->emulateWheel.Y.down_button;
|
||||
|
||||
prop_wheel_axismap = MakeAtom(EVDEV_PROP_WHEEL_AXES, strlen(EVDEV_PROP_WHEEL_AXES), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_axismap, XA_INTEGER, 8,
|
||||
PropModeReplace, 4, vals, FALSE);
|
||||
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_axismap, FALSE);
|
||||
|
||||
prop_wheel_inertia = MakeAtom(EVDEV_PROP_WHEEL_INERTIA, strlen(EVDEV_PROP_WHEEL_INERTIA), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER, 16,
|
||||
PropModeReplace, 1,
|
||||
&pEvdev->emulateWheel.inertia, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_inertia, FALSE);
|
||||
|
||||
prop_wheel_timeout = MakeAtom(EVDEV_PROP_WHEEL_TIMEOUT, strlen(EVDEV_PROP_WHEEL_TIMEOUT), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16,
|
||||
PropModeReplace, 1,
|
||||
&pEvdev->emulateWheel.timeout, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_timeout, FALSE);
|
||||
|
||||
prop_wheel_button = MakeAtom(EVDEV_PROP_WHEEL_BUTTON, strlen(EVDEV_PROP_WHEEL_BUTTON), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_button, XA_INTEGER, 8,
|
||||
PropModeReplace, 1,
|
||||
&pEvdev->emulateWheel.button, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_button, FALSE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
@@ -482,4 +400,67 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
EvdevWheelEmuInitProperty(DeviceIntPtr dev)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
int rc = TRUE;
|
||||
char vals[4];
|
||||
|
||||
if (!dev->button) /* don't init prop for keyboards */
|
||||
return;
|
||||
|
||||
prop_wheel_emu = MakeAtom(EVDEV_PROP_WHEEL, strlen(EVDEV_PROP_WHEEL), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_emu, XA_INTEGER, 8,
|
||||
PropModeReplace, 1,
|
||||
&pEvdev->emulateWheel.enabled, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_emu, FALSE);
|
||||
|
||||
vals[0] = pEvdev->emulateWheel.X.up_button;
|
||||
vals[1] = pEvdev->emulateWheel.X.down_button;
|
||||
vals[2] = pEvdev->emulateWheel.Y.up_button;
|
||||
vals[3] = pEvdev->emulateWheel.Y.down_button;
|
||||
|
||||
prop_wheel_axismap = MakeAtom(EVDEV_PROP_WHEEL_AXES, strlen(EVDEV_PROP_WHEEL_AXES), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_axismap, XA_INTEGER, 8,
|
||||
PropModeReplace, 4, vals, FALSE);
|
||||
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_axismap, FALSE);
|
||||
|
||||
prop_wheel_inertia = MakeAtom(EVDEV_PROP_WHEEL_INERTIA, strlen(EVDEV_PROP_WHEEL_INERTIA), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER, 16,
|
||||
PropModeReplace, 1,
|
||||
&pEvdev->emulateWheel.inertia, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_inertia, FALSE);
|
||||
|
||||
prop_wheel_timeout = MakeAtom(EVDEV_PROP_WHEEL_TIMEOUT, strlen(EVDEV_PROP_WHEEL_TIMEOUT), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16,
|
||||
PropModeReplace, 1,
|
||||
&pEvdev->emulateWheel.timeout, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_timeout, FALSE);
|
||||
|
||||
prop_wheel_button = MakeAtom(EVDEV_PROP_WHEEL_BUTTON, strlen(EVDEV_PROP_WHEEL_BUTTON), TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_wheel_button, XA_INTEGER, 8,
|
||||
PropModeReplace, 1,
|
||||
&pEvdev->emulateWheel.button, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_wheel_button, FALSE);
|
||||
|
||||
XIRegisterPropertyHandler(dev, EvdevWheelEmuSetProperty, NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
63
src/evdev.c
63
src/evdev.c
@@ -105,6 +105,7 @@ static void EvdevInitProperty(DeviceIntPtr dev);
|
||||
static int EvdevSetProperty(DeviceIntPtr dev, Atom atom,
|
||||
XIPropertyValuePtr val, BOOL checkonly);
|
||||
static Atom prop_invert = 0;
|
||||
static Atom prop_reopen = 0;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -184,12 +185,10 @@ EvdevReopenTimer(OsTimerPtr timer, CARD32 time, pointer arg)
|
||||
|
||||
if (pInfo->fd != -1)
|
||||
{
|
||||
pEvdev->reopen_left = 0;
|
||||
|
||||
if (EvdevCacheCompare(pInfo, TRUE) == Success)
|
||||
{
|
||||
xf86Msg(X_INFO, "%s: Device reopened after %d attempts.\n", pInfo->name,
|
||||
pEvdev->reopen_attempts - pEvdev->reopen_left);
|
||||
pEvdev->reopen_attempts - pEvdev->reopen_left + 1);
|
||||
EvdevOn(pInfo->dev);
|
||||
} else
|
||||
{
|
||||
@@ -199,6 +198,7 @@ EvdevReopenTimer(OsTimerPtr timer, CARD32 time, pointer arg)
|
||||
close(pInfo->fd);
|
||||
pInfo->fd = -1;
|
||||
}
|
||||
pEvdev->reopen_left = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -949,9 +949,6 @@ EvdevInit(DeviceIntPtr device)
|
||||
/* We drop the return value, the only time we ever want the handlers to
|
||||
* unregister is when the device dies. In which case we don't have to
|
||||
* unregister anyway */
|
||||
XIRegisterPropertyHandler(device, EvdevMBEmuSetProperty, NULL, NULL);
|
||||
XIRegisterPropertyHandler(device, EvdevWheelEmuSetProperty, NULL, NULL);
|
||||
XIRegisterPropertyHandler(device, EvdevDragLockSetProperty, NULL, NULL);
|
||||
XIRegisterPropertyHandler(device, EvdevSetProperty, NULL, NULL);
|
||||
EvdevInitProperty(device);
|
||||
EvdevMBEmuInitProperty(device);
|
||||
@@ -999,13 +996,6 @@ EvdevOn(DeviceIntPtr device)
|
||||
} else
|
||||
{
|
||||
xf86AddEnabledDevice(pInfo);
|
||||
if ((pEvdev->flags & EVDEV_BUTTON_EVENTS) &&
|
||||
!(pEvdev->flags & EVDEV_INITIALIZED))
|
||||
{
|
||||
EvdevMBEmuPreInit(pInfo);
|
||||
EvdevWheelEmuPreInit(pInfo);
|
||||
EvdevDragLockInit(pInfo);
|
||||
}
|
||||
pEvdev->flags |= EVDEV_INITIALIZED;
|
||||
device->public.on = TRUE;
|
||||
}
|
||||
@@ -1293,7 +1283,6 @@ static InputInfoPtr
|
||||
EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
||||
{
|
||||
InputInfoPtr pInfo;
|
||||
MessageType deviceFrom = X_CONFIG;
|
||||
const char *device;
|
||||
EvdevPtr pEvdev;
|
||||
|
||||
@@ -1340,7 +1329,7 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
||||
|
||||
pEvdev->device = device;
|
||||
|
||||
xf86Msg(deviceFrom, "%s: Device: \"%s\"\n", pInfo->name, device);
|
||||
xf86Msg(X_CONFIG, "%s: Device: \"%s\"\n", pInfo->name, device);
|
||||
do {
|
||||
pInfo->fd = open(device, O_RDWR, 0);
|
||||
} while (pInfo->fd < 0 && errno == EINTR);
|
||||
@@ -1367,6 +1356,13 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
||||
|
||||
EvdevCacheCompare(pInfo, FALSE); /* cache device data */
|
||||
|
||||
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
|
||||
{
|
||||
EvdevMBEmuPreInit(pInfo);
|
||||
EvdevWheelEmuPreInit(pInfo);
|
||||
EvdevDragLockPreInit(pInfo);
|
||||
}
|
||||
|
||||
return pInfo;
|
||||
}
|
||||
|
||||
@@ -1467,19 +1463,35 @@ EvdevInitProperty(DeviceIntPtr dev)
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
int rc;
|
||||
BOOL invert[2];
|
||||
char reopen;
|
||||
|
||||
invert[0] = pEvdev->invert_x;
|
||||
invert[1] = pEvdev->invert_y;
|
||||
|
||||
prop_invert = MakeAtom(EVDEV_PROP_INVERT_AXES, strlen(EVDEV_PROP_INVERT_AXES), TRUE);
|
||||
if (pEvdev->flags & (EVDEV_RELATIVE_EVENTS | EVDEV_ABSOLUTE_EVENTS))
|
||||
{
|
||||
invert[0] = pEvdev->invert_x;
|
||||
invert[1] = pEvdev->invert_y;
|
||||
|
||||
rc = XIChangeDeviceProperty(dev, prop_invert, XA_INTEGER, 8,
|
||||
PropModeReplace, 2,
|
||||
invert, FALSE);
|
||||
prop_invert = MakeAtom(EVDEV_PROP_INVERT_AXES, strlen(EVDEV_PROP_INVERT_AXES), TRUE);
|
||||
|
||||
rc = XIChangeDeviceProperty(dev, prop_invert, XA_INTEGER, 8,
|
||||
PropModeReplace, 2,
|
||||
invert, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_invert, FALSE);
|
||||
}
|
||||
|
||||
prop_reopen = MakeAtom(EVDEV_PROP_REOPEN, strlen(EVDEV_PROP_REOPEN),
|
||||
TRUE);
|
||||
|
||||
reopen = pEvdev->reopen_attempts;
|
||||
rc = XIChangeDeviceProperty(dev, prop_reopen, XA_INTEGER, 8,
|
||||
PropModeReplace, 1, &reopen, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_invert, FALSE);
|
||||
XISetDevicePropertyDeletable(dev, prop_reopen, FALSE);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1501,6 +1513,13 @@ EvdevSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
pEvdev->invert_x = data[0];
|
||||
pEvdev->invert_y = data[1];
|
||||
}
|
||||
} else if (atom == prop_reopen)
|
||||
{
|
||||
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
if (!checkonly)
|
||||
pEvdev->reopen_attempts = *((CARD8*)val->data);
|
||||
}
|
||||
|
||||
return Success;
|
||||
|
||||
28
src/evdev.h
28
src/evdev.h
@@ -35,9 +35,8 @@
|
||||
#include <xf86Xinput.h>
|
||||
#include <xf86_OSproc.h>
|
||||
|
||||
#if defined(XKB)
|
||||
/* XXX VERY WRONG. this is a client side header. */
|
||||
#include <X11/extensions/XKBstr.h>
|
||||
#ifdef XKB
|
||||
#include <xkbstr.h>
|
||||
#endif
|
||||
|
||||
#define EVDEV_MAXBUTTONS 32
|
||||
@@ -120,6 +119,8 @@ typedef struct {
|
||||
struct input_absinfo absinfo[ABS_MAX];
|
||||
} EvdevRec, *EvdevPtr;
|
||||
|
||||
unsigned int EvdevUtilButtonEventToButtonNumber(int code);
|
||||
|
||||
/* Middle Button emulation */
|
||||
int EvdevMBEmuTimer(InputInfoPtr);
|
||||
BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
|
||||
@@ -129,25 +130,18 @@ void EvdevMBEmuPreInit(InputInfoPtr);
|
||||
void EvdevMBEmuFinalize(InputInfoPtr);
|
||||
void EvdevMBEmuEnable(InputInfoPtr, BOOL);
|
||||
|
||||
unsigned int EvdevUtilButtonEventToButtonNumber(int code);
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
void EvdevMBEmuInitProperty(DeviceIntPtr);
|
||||
int EvdevMBEmuSetProperty(DeviceIntPtr, Atom, XIPropertyValuePtr, BOOL);
|
||||
|
||||
void EvdevWheelEmuInitProperty(DeviceIntPtr);
|
||||
int EvdevWheelEmuSetProperty(DeviceIntPtr, Atom, XIPropertyValuePtr, BOOL);
|
||||
|
||||
void EvdevDragLockInitProperty(DeviceIntPtr);
|
||||
int EvdevDragLockSetProperty(DeviceIntPtr, Atom, XIPropertyValuePtr, BOOL);
|
||||
#endif
|
||||
|
||||
/* Mouse Wheel emulation */
|
||||
void EvdevWheelEmuPreInit(InputInfoPtr pInfo);
|
||||
BOOL EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value);
|
||||
BOOL EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv);
|
||||
|
||||
/* Draglock code */
|
||||
void EvdevDragLockInit(InputInfoPtr pInfo);
|
||||
void EvdevDragLockPreInit(InputInfoPtr pInfo);
|
||||
BOOL EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value);
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
void EvdevMBEmuInitProperty(DeviceIntPtr);
|
||||
void EvdevWheelEmuInitProperty(DeviceIntPtr);
|
||||
void EvdevDragLockInitProperty(DeviceIntPtr);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user