[orca] Hack around missing events and broken hierarchy with Eclipse submenus



commit e4e24b36fe1ce7503d9ba7c963ebe1142852adff
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Jan 15 10:08:37 2016 -0500

    Hack around missing events and broken hierarchy with Eclipse submenus

 src/orca/scripts/apps/Eclipse/script.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/Eclipse/script.py b/src/orca/scripts/apps/Eclipse/script.py
index 6bf7f62..27bc792 100644
--- a/src/orca/scripts/apps/Eclipse/script.py
+++ b/src/orca/scripts/apps/Eclipse/script.py
@@ -25,6 +25,7 @@ __date__      = "$Date$"
 __copyright__ = "Copyright (c) 2010 Informal Informatica LTDA."
 __license__   = "LGPL"
 
+import orca.orca as orca
 import orca.scripts.toolkits.GAIL as GAIL
 import pyatspi
 
@@ -75,6 +76,21 @@ class Script(GAIL.Script):
 
         self._saveLastTextPosition(obj)
 
+    def onFocus(self, event):
+        """Callback for focus: accessibility events."""
+
+        # NOTE: This event type is deprecated and Orca should no longer use it.
+        # This callback remains just to handle bugs in applications and toolkits.
+
+        role = event.source.getRole()
+
+        menuItems = [pyatspi.ROLE_CHECK_MENU_ITEM,
+                     pyatspi.ROLE_MENU_ITEM,
+                     pyatspi.ROLE_RADIO_MENU_ITEM]
+        if role in menuItems:
+            orca.setLocusOfFocus(event, event.source)
+            return
+
     def onTextInserted(self, event):
         """Called whenever text is inserted into an object. Overridden here
         so that we can avoid speaking text when caret moves after new text


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