[orca/gnome-3-16] Add handling for Evo's "autocomplete" popups



commit b21661bd4d6ca4c4038c78182496bd8f49e28c54
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Jun 26 22:08:56 2015 -0400

    Add handling for Evo's "autocomplete" popups

 src/orca/scripts/apps/evolution/script.py          |   15 +++++++++++++++
 .../scripts/apps/evolution/script_utilities.py     |   10 ++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/evolution/script.py b/src/orca/scripts/apps/evolution/script.py
index 7e4de21..52488de 100644
--- a/src/orca/scripts/apps/evolution/script.py
+++ b/src/orca/scripts/apps/evolution/script.py
@@ -105,6 +105,21 @@ class Script(WebKitGtk.Script):
     #                                                                      #
     ########################################################################
 
+    def onActiveDescendantChanged(self, event):
+        """Callback for object:active-descendant-changed accessibility events."""
+
+        if not event.any_data:
+            return
+
+        if self.utilities.isComposeAutocomplete(event.source):
+            if event.any_data.getState().contains(pyatspi.STATE_SELECTED):
+                orca.setLocusOfFocus(event, event.any_data)
+            else:
+                orca.setLocusOfFocus(event, event.source)
+            return
+
+        super().onActiveDescendantChanged(event)
+
     def onBusyChanged(self, event):
         """Callback for object:state-changed:busy accessibility events."""
         pass
diff --git a/src/orca/scripts/apps/evolution/script_utilities.py 
b/src/orca/scripts/apps/evolution/script_utilities.py
index fe9c8c4..066d651 100644
--- a/src/orca/scripts/apps/evolution/script_utilities.py
+++ b/src/orca/scripts/apps/evolution/script_utilities.py
@@ -59,6 +59,16 @@ class Utilities(WebKitGtk.Utilities):
 
         return self.isReceivedMessage(obj.parent)
 
+    def isComposeAutocomplete(self, obj):
+        if not (obj and obj.getRole() == pyatspi.ROLE_TABLE):
+            return False
+
+        if not obj.getState().contains(pyatspi.STATE_MANAGES_DESCENDANTS):
+            return False
+
+        topLevel = self.topLevelObject(obj)
+        return topLevel and topLevel.getRole() == pyatspi.ROLE_WINDOW
+
     def findMessageBodyChild(self, root):
         roles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]
         isDocument = lambda x: x and x.getRole() in roles


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