[orca] Work around missing events for popup menus



commit e0da4fe41a78a2bb778f031d8032a9ebe3504f2d
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jul 18 23:58:27 2017 +0200

    Work around missing events for popup menus

 src/orca/scripts/default.py |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 825d558..8abd79b 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2727,26 +2727,19 @@ class Script(script.Script):
         self.pointOfReference = {}
 
         self.windowActivateTime = time.time()
-        orca.setLocusOfFocus(event, event.source)
-
-        # We keep track of the active window to handle situations where
-        # we get window activated and window deactivated events out of
-        # order (see onWindowDeactivated).
-        #
-        # For example, events can be:
-        #
-        #    window:activate   (w1)
-        #    window:activate   (w2)
-        #    window:deactivate (w1)
-        #
-        # as well as:
-        #
-        #    window:activate   (w1)
-        #    window:deactivate (w1)
-        #    window:activate   (w2)
-        #
         orca_state.activeWindow = event.source
 
+        try:
+            childCount = event.source.childCount
+            childRole = event.source[0].getRole()
+        except:
+            pass
+        else:
+            if childCount == 1 and childRole == pyatspi.ROLE_MENU:
+                orca.setLocusOfFocus(event, event.source[0])
+            else:
+                orca.setLocusOfFocus(event, event.source)
+
     def onWindowCreated(self, event):
         """Callback for window:create accessibility events."""
 


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