mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Adding mouse wheel emulation code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Peter Hutterer
parent
c1f7f8c3d2
commit
a9d72b40fb
11
src/evdev.c
11
src/evdev.c
@@ -217,11 +217,16 @@ EvdevReadInput(InputInfoPtr pInfo)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Get the signed value, earlier kernels had this as unsigned */
|
||||
value = ev.value;
|
||||
|
||||
switch (ev.type) {
|
||||
case EV_REL:
|
||||
/* Handle mouse wheel emulation */
|
||||
if (EvdevWheelEmuFilterMotion(pInfo, &ev))
|
||||
break;
|
||||
|
||||
switch (ev.code) {
|
||||
case REL_X:
|
||||
dx += value;
|
||||
@@ -286,6 +291,9 @@ EvdevReadInput(InputInfoPtr pInfo)
|
||||
if (EvdevMBEmuFilterEvent(pInfo, button, value))
|
||||
break;
|
||||
|
||||
if (EvdevWheelEmuFilterButton(pInfo, button, value))
|
||||
break;
|
||||
|
||||
if (button)
|
||||
xf86PostButtonEvent(pInfo->dev, 0, button, value, 0, 0);
|
||||
else
|
||||
@@ -943,7 +951,10 @@ EvdevProc(DeviceIntPtr device, int what)
|
||||
{
|
||||
xf86AddEnabledDevice(pInfo);
|
||||
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
|
||||
{
|
||||
EvdevMBEmuPreInit(pInfo);
|
||||
EvdevWheelEmuPreInit(pInfo);
|
||||
}
|
||||
device->public.on = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user