mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-03-24 01:34:04 +00:00
Allow 0 as wheel emulation button for unconditional scrolling (#20529)
If wheel emulation is on and the emulation button is 0, then any x/y motion of the device is converted into wheel events. The devices becomes a scrolling-only device. Signed-off-by: Dima Kogan <dkogan@cds.caltech.edu> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Peter Hutterer
parent
2e5f68754f
commit
f4ba2bd785
@@ -43,7 +43,7 @@
|
||||
#define EVDEV_PROP_WHEEL_INERTIA "Evdev Wheel Emulation Inertia"
|
||||
/* CARD16 */
|
||||
#define EVDEV_PROP_WHEEL_TIMEOUT "Evdev Wheel Emulation Timeout"
|
||||
/* CARD8, value range 0-32 */
|
||||
/* CARD8, value range 0-32, 0 to always scroll */
|
||||
#define EVDEV_PROP_WHEEL_BUTTON "Evdev Wheel Emulation Button"
|
||||
|
||||
/* Drag lock */
|
||||
|
||||
@@ -105,7 +105,10 @@ press/release events as specified for the
|
||||
.B XAxisMapping
|
||||
and
|
||||
.B YAxisMapping
|
||||
settings. Default: 4. Property: "Evdev Wheel Emulation Button".
|
||||
settings. If the button is 0 and
|
||||
.BR EmulateWheel
|
||||
is on, any motion of the device is converted into wheel events. 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
|
||||
|
||||
@@ -100,18 +100,20 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||
WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
|
||||
int value = pEv->value;
|
||||
int ms;
|
||||
|
||||
/* Has wheel emulation been configured to be enabled? */
|
||||
if (!pEvdev->emulateWheel.enabled)
|
||||
return FALSE;
|
||||
|
||||
/* Handle our motion events if the emuWheel button is pressed*/
|
||||
if (pEvdev->emulateWheel.button_state) {
|
||||
/* Handle our motion events if the emuWheel button is pressed
|
||||
* wheel button of 0 means always emulate wheel.
|
||||
*/
|
||||
if (pEvdev->emulateWheel.button_state || !pEvdev->emulateWheel.button) {
|
||||
/* Just return if the timeout hasn't expired yet */
|
||||
ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
|
||||
if (ms > 0)
|
||||
if (pEvdev->emulateWheel.button &&
|
||||
pEvdev->emulateWheel.expires - GetTimeInMillis() > 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* We don't want to intercept real mouse wheel events */
|
||||
switch(pEv->code) {
|
||||
|
||||
Reference in New Issue
Block a user