[PATCH xf86-input-evdev] Copy out of proximity values into current values selectively

Chase Douglas chase.douglas at canonical.com
Fri Apr 15 09:14:03 PDT 2011


Otherwise, an event that causes us to go into proximity with some new
valuator values will retain some old valuator values from when last in
proximity. This change ensures that all values posted while out of
proximity are accounted for.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/evdev.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index b767b0e..f31f492 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -525,13 +525,14 @@ EvdevProcessProximityState(InputInfoPtr pInfo)
     {
         /* We're about to go into/out of proximity but have no abs events
          * within the EV_SYN. Use the last coordinates we have. */
-        if (!pEvdev->abs_queued &&
-            valuator_mask_num_valuators(pEvdev->prox) > 0)
-        {
-            valuator_mask_copy(pEvdev->vals, pEvdev->prox);
-            valuator_mask_zero(pEvdev->prox);
-            pEvdev->abs_queued = 1;
-        }
+        for (i = 0; i < valuator_mask_size(pEvdev->prox); i++)
+            if (!valuator_mask_isset(pEvdev->vals, i) &&
+                valuator_mask_isset(pEvdev->prox, i))
+                valuator_mask_set(pEvdev->vals, i,
+                                  valuator_mask_get(pEvdev->prox, i));
+        valuator_mask_zero(pEvdev->prox);
+
+        pEvdev->abs_queued = valuator_mask_size(pEvdev->vals);
     }
 
     pEvdev->in_proximity = prox_state;
-- 
1.7.4.1



More information about the xorg-devel mailing list