summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉric Brunet <Eric.Brunet@lps.ens.fr>2014-09-30 22:15:45 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2014-12-17 14:33:17 +1000
commitf59585b36709c8a529da6e08662ed6c62b73ebd5 (patch)
treeea995c7b149e4170899694cff1d6fac5bf4b809c
parent593bbc6390aa6f9feec0e2b081e1bfe6ab03595a (diff)
Change the logic concerning EVDEV_RELATIVE_MODE and in_proximity
When not in_proximity, we don't really trust data, even though a valuator sent just before a in_proximity event might actually be important. The present code for EVDEV_RELATIVE_MODE throws away all data if not in_proximity, which is a little bit too much. This patch allows for relative values to be calculated and old_vals to be updated even if not in_proximity, but will prevent evdev to sending (presumably) wrong information to the X server. But at least, old_vals will be correctly filled when the device comes into proximity again. Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/src/evdev.c b/src/evdev.c
index ffa13fc..968c60b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -440,25 +440,21 @@ EvdevProcessValuators(InputInfoPtr pInfo)
if (pEvdev->abs_queued) {
/* convert to relative motion for touchpads */
if (pEvdev->flags & EVDEV_RELATIVE_MODE) {
- if (pEvdev->in_proximity) {
- if (valuator_mask_isset(pEvdev->abs_vals, 0))
- {
- if (valuator_mask_isset(pEvdev->old_vals, 0))
- deltaX = valuator_mask_get(pEvdev->abs_vals, 0) -
- valuator_mask_get(pEvdev->old_vals, 0);
- valuator_mask_set(pEvdev->old_vals, 0,
- valuator_mask_get(pEvdev->abs_vals, 0));
- }
- if (valuator_mask_isset(pEvdev->abs_vals, 1))
- {
- if (valuator_mask_isset(pEvdev->old_vals, 1))
- deltaY = valuator_mask_get(pEvdev->abs_vals, 1) -
- valuator_mask_get(pEvdev->old_vals, 1);
- valuator_mask_set(pEvdev->old_vals, 1,
- valuator_mask_get(pEvdev->abs_vals, 1));
- }
- } else {
- valuator_mask_zero(pEvdev->old_vals);
+ if (valuator_mask_isset(pEvdev->abs_vals, 0))
+ {
+ if (valuator_mask_isset(pEvdev->old_vals, 0))
+ deltaX = valuator_mask_get(pEvdev->abs_vals, 0) -
+ valuator_mask_get(pEvdev->old_vals, 0);
+ valuator_mask_set(pEvdev->old_vals, 0,
+ valuator_mask_get(pEvdev->abs_vals, 0));
+ }
+ if (valuator_mask_isset(pEvdev->abs_vals, 1))
+ {
+ if (valuator_mask_isset(pEvdev->old_vals, 1))
+ deltaY = valuator_mask_get(pEvdev->abs_vals, 1) -
+ valuator_mask_get(pEvdev->old_vals, 1);
+ valuator_mask_set(pEvdev->old_vals, 1,
+ valuator_mask_get(pEvdev->abs_vals, 1));
}
valuator_mask_zero(pEvdev->abs_vals);
pEvdev->abs_queued = 0;
@@ -859,6 +855,15 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
* BTN_TOUCH as the proximity notifier */
if (!pEvdev->use_proximity)
pEvdev->in_proximity = value ? ev->code : 0;
+ /* When !pEvdev->use_proximity, we don't report
+ * proximity events to the X server. However, we
+ * still want to keep track if one is in proximity or
+ * not. This is especially important for touchpad
+ * who report proximity information to the computer
+ * (but it is not sent to X) and who might send unreliable
+ * position information when not in_proximity.
+ */
+
if (!(pEvdev->flags & (EVDEV_TOUCHSCREEN | EVDEV_TABLET)) ||
pEvdev->mt_mask)
break;
@@ -881,7 +886,7 @@ EvdevPostRelativeMotionEvents(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
- if (pEvdev->rel_queued) {
+ if (pEvdev->rel_queued && pEvdev->in_proximity) {
xf86PostMotionEventM(pInfo->dev, Relative, pEvdev->rel_vals);
}
}