Adding mouse wheel emulation code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Chris Salch
2008-08-06 22:08:13 -05:00
committed by Peter Hutterer
parent c1f7f8c3d2
commit a9d72b40fb
5 changed files with 334 additions and 2 deletions

View File

@@ -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;