aboutsummaryrefslogtreecommitdiff
path: root/src/evdev.c
diff options
context:
space:
mode:
authorÉric Brunet <Eric.Brunet@lps.ens.fr>2014-09-30 22:32:51 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2014-12-17 14:37:38 +1000
commit3dcf6f123c54fd3104bcb79677cd347972abea4c (patch)
tree46bd58ec612108f495ef99d70afa104ed77980c0 /src/evdev.c
parentChange the logic concerning EVDEV_RELATIVE_MODE and in_proximity (diff)
downloadxf86-input-evdev-3dcf6f123c54fd3104bcb79677cd347972abea4c.tar.gz
xf86-input-evdev-3dcf6f123c54fd3104bcb79677cd347972abea4c.tar.bz2
xf86-input-evdev-3dcf6f123c54fd3104bcb79677cd347972abea4c.zip
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>
Diffstat (limited to 'src/evdev.c')
-rw-r--r--src/evdev.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 968c60b..f488f96 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -139,6 +139,7 @@ static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode)
{
InputInfoPtr pInfo;
EvdevPtr pEvdev;
+ int val;
pInfo = device->public.devicePrivate;
pEvdev = pInfo->private;
@@ -154,10 +155,21 @@ static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode)
switch (mode) {
case Absolute:
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;
case Relative:
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;
default:
@@ -459,12 +471,6 @@ EvdevProcessValuators(InputInfoPtr pInfo)
valuator_mask_zero(pEvdev->abs_vals);
pEvdev->abs_queued = 0;
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);
}
}