[orca] Handle more cases for object:active-descendant:changed



commit 60ee2fb69cdce74f61b8dbda4026a4e04dc99075
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Dec 25 11:57:24 2013 -0500

    Handle more cases for object:active-descendant:changed
    
    * Filter out events where the active descendant is not provided.
      That is indicative of a broken accessibility implementation
      and should not be dealt with in the default script.
    
    * Stop filtering out events solely on the basis of the parent
      lacking STATE_FOCUSED; if the active descendant has this state,
      then we're almost certainly in the widget emitting the event.

 src/orca/scripts/default.py |   26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index d947923..9e830b2 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2091,27 +2091,19 @@ class Script(script.Script):
             self.find()
 
     def onActiveDescendantChanged(self, event):
-        """Called when an object who manages its own descendants detects a
-        change in one of its children.
+        """Callback for object:active-descendant-changed accessibility events."""
 
-        Arguments:
-        - event: the Event
-        """
+        if not event.any_data:
+            return
 
-        if not event.source.getState().contains(pyatspi.STATE_FOCUSED):
+        if not event.source.getState().contains(pyatspi.STATE_FOCUSED) \
+           and not event.any_data.getState().contains(pyatspi.STATE_FOCUSED):
             return
 
-        # There can be cases when the object that fires an
-        # active-descendant-changed event has no children. In this case,
-        # use the object that fired the event, otherwise, use the child.
-        #
-        child = event.any_data
-        if child:
-            if self.stopSpeechOnActiveDescendantChanged(event):
-                speech.stop()
-            orca.setLocusOfFocus(event, child)
-        else:
-            orca.setLocusOfFocus(event, event.source)
+        if self.stopSpeechOnActiveDescendantChanged(event):
+            speech.stop()
+
+        orca.setLocusOfFocus(event, event.any_data)
 
     def onBusyChanged(self, event):
         """Callback for object:state-changed:busy accessibility events."""


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