commit bf32ae30258e4fd2c36344126b629bf89c9de737 Author: Jérôme Carretero Date: Tue Dec 31 20:14:21 2013 -0500 add AutoReleaseButtons configuration option diff --git a/include/evdev-properties.h b/include/evdev-properties.h index 8ae5ba3..ab356e1 100644 --- a/include/evdev-properties.h +++ b/include/evdev-properties.h @@ -91,4 +91,8 @@ /* INT32, 3 values (vertical, horizontal, dial) */ #define EVDEV_PROP_SCROLL_DISTANCE "Evdev Scrolling Distance" +/* Auto-release */ +/* CARD32, 1 value, bitmap, bit N set = button (N+1) is auto-released */ +#define EVDEV_PROP_AUTORELEASE "Evdev Auto-Release Buttons" + #endif diff --git a/man/evdev.man b/man/evdev.man index 06613fc..a2f8128 100644 --- a/man/evdev.man +++ b/man/evdev.man @@ -82,6 +82,12 @@ 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. Property: "Evdev Drag Lock Buttons". .TP 7 +.BI "Option \*qAutoReleaseButtons\*q \*q" "Bn ..." \*q +Sets which buttons are to be treated as immediately released. This is +useful for mice which have buttons which do not generate events in the +normal way, generating a release event when the button is next clicked as +opposed to when it is released. +Property: "Evdev Auto Release Buttons". .TP 7 .BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q Enable/disable the emulation of the third (middle) mouse button for mice diff --git a/src/Makefile.am b/src/Makefile.am index 5e0c3b3..df68213 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,6 +38,7 @@ AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBEVDEV_CFLAGS) emuMB.c \ emuThird.c \ emuWheel.c \ + autorelease.c \ draglock.c \ apple.c \ axis_labels.h diff --git a/src/evdev.c b/src/evdev.c index d1ed9ee..b2f7a79 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -660,6 +660,9 @@ EvdevProcessButtonEvent(InputInfoPtr pInfo, struct input_event *ev) if (EvdevDragLockFilterEvent(pInfo, button, value)) return; + if (EvdevAutoReleaseFilterEvent(pInfo, button, value)) + return; + if (EvdevWheelEmuFilterButton(pInfo, button, value)) return; @@ -1949,6 +1952,7 @@ EvdevInit(DeviceIntPtr device) Evdev3BEmuInitProperty(device); EvdevWheelEmuInitProperty(device); EvdevDragLockInitProperty(device); + EvdevAutoReleaseInitProperty(device); EvdevAppleInitProperty(device); return Success; @@ -2663,6 +2667,7 @@ EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) Evdev3BEmuPreInit(pInfo); EvdevWheelEmuPreInit(pInfo); EvdevDragLockPreInit(pInfo); + EvdevAutoReleasePreInit(pInfo); } return Success; diff --git a/src/evdev.h b/src/evdev.h index 520d017..e8478e6 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -233,6 +233,7 @@ typedef struct { int min_y; int max_y; } calibration; + uint32_t releaseButtons; unsigned char btnmap[32]; /* config-file specified button mapping */ @@ -295,9 +296,14 @@ BOOL EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv); void EvdevDragLockPreInit(InputInfoPtr pInfo); BOOL EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value); +/* Auto-release code */ +void EvdevAutoReleasePreInit(InputInfoPtr pInfo); +BOOL EvdevAutoReleaseFilterEvent(InputInfoPtr pInfo, unsigned int button, int value); + void EvdevMBEmuInitProperty(DeviceIntPtr); void Evdev3BEmuInitProperty(DeviceIntPtr); void EvdevWheelEmuInitProperty(DeviceIntPtr); void EvdevDragLockInitProperty(DeviceIntPtr); +void EvdevAutoReleaseInitProperty(DeviceIntPtr); void EvdevAppleInitProperty(DeviceIntPtr); #endif