[orca] Filter out extraneous events for current mouse review object



commit c62f36c969661cbf1675660c677df7fab4cd5751
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jun 28 20:50:41 2018 -0400

    Filter out extraneous events for current mouse review object

 src/orca/mouse_review.py                | 13 +++++++++++++
 src/orca/scripts/default.py             |  7 +++++++
 src/orca/scripts/toolkits/gtk/script.py |  6 ++++++
 3 files changed, 26 insertions(+)
---
diff --git a/src/orca/mouse_review.py b/src/orca/mouse_review.py
index 16545d89b..161a8f83d 100644
--- a/src/orca/mouse_review.py
+++ b/src/orca/mouse_review.py
@@ -172,6 +172,11 @@ class _ItemContext:
         isContainer = lambda x: x and x.getRole() in roles
         return pyatspi.findAncestor(self._obj, isContainer)
 
+    def getObject(self):
+        """Returns the accessible object associated with this context."""
+
+        return self._obj
+
     def present(self, prior):
         """Presents this context to the user."""
 
@@ -248,6 +253,14 @@ class MouseReviewer:
             value.disconnect(key)
         self._handlerIds = {}
 
+    def getCurrentItem(self):
+        """Returns the accessible object being reviewed."""
+
+        if not _mouseReviewCapable:
+            return None
+
+        return self._currentMouseOver.getObject()
+
     def toggle(self, script=None, event=None):
         """Toggle mouse reviewing on or off."""
 
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 6b025ccd2..1a646e992 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2455,12 +2455,19 @@ class Script(script.Script):
             if entry and entry.getState().contains(pyatspi.STATE_FOCUSED):
                 return
  
+        mouseReviewItem = mouse_review.reviewer.getCurrentItem()
         selectedChildren = self.utilities.selectedChildren(obj)
         for child in selectedChildren:
             if pyatspi.findAncestor(orca_state.locusOfFocus, lambda x: x == child):
                 msg = "DEFAULT: Child %s is ancestor of locusOfFocus" % child
                 debug.println(debug.LEVEL_INFO, msg, True)
                 return
+
+            if child == mouseReviewItem:
+                msg = "DEFAULT: Child %s is current mouse review item" % child
+                debug.println(debug.LEVEL_INFO, msg, True)
+                continue
+
             if not self.utilities.isLayoutOnly(child):
                 orca.setLocusOfFocus(event, child)
                 break
diff --git a/src/orca/scripts/toolkits/gtk/script.py b/src/orca/scripts/toolkits/gtk/script.py
index 91b8f9da7..494d19e66 100644
--- a/src/orca/scripts/toolkits/gtk/script.py
+++ b/src/orca/scripts/toolkits/gtk/script.py
@@ -29,6 +29,7 @@ import pyatspi
 import time
 
 import orca.debug as debug
+import orca.mouse_review as mouse_review
 import orca.orca as orca
 import orca.orca_state as orca_state
 import orca.scripts.default as default
@@ -120,6 +121,11 @@ class Script(default.Script):
         if self.utilities.isLayoutOnly(event.source):
             return
 
+        if event.source == mouse_review.reviewer.getCurrentItem():
+            msg = "GTK: Event source is current mouse review item"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return
+
         if self.utilities.isTypeahead(orca_state.locusOfFocus) \
            and "Table" in pyatspi.listInterfaces(event.source) \
            and not event.source.getState().contains(pyatspi.STATE_FOCUSED):


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