[orca] Try to filter out what are functionally duplicate mouse-moved events



commit 73bd8a4e081cda7367416c94f8a87b0ff59dd682
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Mar 27 10:50:24 2018 -0400

    Try to filter out what are functionally duplicate mouse-moved events

 src/orca/mouse_review.py |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/mouse_review.py b/src/orca/mouse_review.py
index 8fa4480..dc81595 100644
--- a/src/orca/mouse_review.py
+++ b/src/orca/mouse_review.py
@@ -112,6 +112,7 @@ class _ItemContext:
         self._frame = frame
         self._script = script
         self._string = self._getStringContext()
+        self._time = time.time()
 
     def __eq__(self, other):
         return other is not None \
@@ -119,6 +120,17 @@ class _ItemContext:
             and self._obj == other._obj \
             and self._string == other._string
 
+    def _treatAsDuplicate(self, prior):
+        if self._obj != prior._obj or self._frame != prior._frame:
+            return False
+
+        if self._time - prior._time > 0.1:
+            return False
+
+        msg = "MOUSE REVIEW: Treating as duplicate"
+        debug.println(debug.LEVEL_INFO, msg, True)
+        return True
+
     def _getStringContext(self):
         """Returns the _StringContext associated with the specified point."""
 
@@ -145,7 +157,7 @@ class _ItemContext:
     def present(self, prior):
         """Presents this context to the user."""
 
-        if self == prior:
+        if self == prior or self._treatAsDuplicate(prior):
             return False
 
         interrupt = self._obj and self._obj != prior._obj \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]