mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Don't update old_vals when not in EVDEV_RELATIVE_MODE
When not in EVDEV_RELATIVE_MODE, absolute position is stored in old_vals. This serves no purpose except that old_vals is ready when the device is switched to EVDEV_RELATIVE_MODE. It is however better to make the copy between old_vals and abs_vals at the time of the switch rather than all the time. Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Peter Hutterer
parent
f59585b367
commit
3dcf6f123c
18
src/evdev.c
18
src/evdev.c
@@ -139,6 +139,7 @@ static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode)
|
|||||||
{
|
{
|
||||||
InputInfoPtr pInfo;
|
InputInfoPtr pInfo;
|
||||||
EvdevPtr pEvdev;
|
EvdevPtr pEvdev;
|
||||||
|
int val;
|
||||||
|
|
||||||
pInfo = device->public.devicePrivate;
|
pInfo = device->public.devicePrivate;
|
||||||
pEvdev = pInfo->private;
|
pEvdev = pInfo->private;
|
||||||
@@ -154,10 +155,21 @@ static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode)
|
|||||||
switch (mode) {
|
switch (mode) {
|
||||||
case Absolute:
|
case Absolute:
|
||||||
pEvdev->flags &= ~EVDEV_RELATIVE_MODE;
|
pEvdev->flags &= ~EVDEV_RELATIVE_MODE;
|
||||||
|
if (valuator_mask_fetch(pEvdev->old_vals, 0, &val))
|
||||||
|
valuator_mask_set(pEvdev->abs_vals, 0, val);
|
||||||
|
if (valuator_mask_fetch(pEvdev->old_vals, 1, &val))
|
||||||
|
valuator_mask_set(pEvdev->abs_vals, 1, val);
|
||||||
|
valuator_mask_zero(pEvdev->old_vals);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Relative:
|
case Relative:
|
||||||
pEvdev->flags |= EVDEV_RELATIVE_MODE;
|
pEvdev->flags |= EVDEV_RELATIVE_MODE;
|
||||||
|
if (valuator_mask_fetch(pEvdev->abs_vals, 0, &val))
|
||||||
|
valuator_mask_set(pEvdev->old_vals, 0, val);
|
||||||
|
if (valuator_mask_fetch(pEvdev->abs_vals, 1, &val))
|
||||||
|
valuator_mask_set(pEvdev->old_vals, 1, val);
|
||||||
|
valuator_mask_unset(pEvdev->abs_vals, 0);
|
||||||
|
valuator_mask_unset(pEvdev->abs_vals, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -459,12 +471,6 @@ EvdevProcessValuators(InputInfoPtr pInfo)
|
|||||||
valuator_mask_zero(pEvdev->abs_vals);
|
valuator_mask_zero(pEvdev->abs_vals);
|
||||||
pEvdev->abs_queued = 0;
|
pEvdev->abs_queued = 0;
|
||||||
pEvdev->rel_queued = 1;
|
pEvdev->rel_queued = 1;
|
||||||
} else {
|
|
||||||
int val;
|
|
||||||
if (valuator_mask_fetch(pEvdev->abs_vals, 0, &val))
|
|
||||||
valuator_mask_set(pEvdev->old_vals, 0, val);
|
|
||||||
if (valuator_mask_fetch(pEvdev->abs_vals, 1, &val))
|
|
||||||
valuator_mask_set(pEvdev->old_vals, 1, val);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user