[orca] Handle a missing event from a mystery object in the Evolution GUI



commit a45262178046d8b7bba9a6cae7c7d72d9310e958
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jan 20 23:28:28 2015 -0500

    Handle a missing event from a mystery object in the Evolution GUI
    
    This is some mystery child of the 'Messages' panel which fails to show
    up in the hierarchy or emit object:state-changed:focused events. But it
    seems to be the only object that claims focus (via the deprecated focus:
    event) when the 'Messages' tree table is navigated to. This really needs
    to be fixed in Evo. But we're finally getting accessibility back, so who
    am I to quibble? ;)

 src/orca/scripts/apps/evolution/script.py          |    8 ++++++++
 .../scripts/apps/evolution/script_utilities.py     |   12 ++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/evolution/script.py b/src/orca/scripts/apps/evolution/script.py
index 55e9f4f..e2cb780 100644
--- a/src/orca/scripts/apps/evolution/script.py
+++ b/src/orca/scripts/apps/evolution/script.py
@@ -29,6 +29,7 @@ __license__   = "LGPL"
 
 import pyatspi
 
+import orca.orca as orca
 import orca.scripts.toolkits.gtk as gtk
 import orca.scripts.toolkits.WebKitGtk as WebKitGtk
 import orca.settings as settings
@@ -108,6 +109,13 @@ class Script(WebKitGtk.Script):
         if self.utilities.isWebKitGtk(event.source):
             return
 
+        # This is some mystery child of the 'Messages' panel which fails to show
+        # up in the hierarchy or emit object:state-changed:focused events.
+        if event.source.getRole() == pyatspi.ROLE_LAYERED_PANE:
+            obj = self.utilities.realActiveDescendant(event.source)
+            orca.setLocusOfFocus(event, obj)
+            return
+
         gtk.Script.onFocus(self, event)
 
     def onNameChanged(self, event):
diff --git a/src/orca/scripts/apps/evolution/script_utilities.py 
b/src/orca/scripts/apps/evolution/script_utilities.py
index 73e7bae..ce3e3b3 100644
--- a/src/orca/scripts/apps/evolution/script_utilities.py
+++ b/src/orca/scripts/apps/evolution/script_utilities.py
@@ -47,3 +47,15 @@ class Utilities(WebKitGtk.Utilities):
 
         header = self.columnHeaderForCell(obj)
         return header and header.name == obj.name
+
+    def realActiveDescendant(self, obj):
+        if self.isWebKitGtk(obj):
+            return super().realActiveDescendant(obj)
+
+        # This is some mystery child of the 'Messages' panel which fails to show
+        # up in the hierarchy or emit object:state-changed:focused events.
+        if obj.getRole() == pyatspi.ROLE_LAYERED_PANE:
+            isTreeTable = lambda x: x and x.getRole() == pyatspi.ROLE_TREE_TABLE
+            return pyatspi.utils.findDescendant(obj, isTreeTable) or obj
+
+        return gtk.Utilities.realActiveDescendant(self, obj)


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