[orca] More aggressively work around missing events from Gecko dialogs



commit bb4a5b585ba2956f126cd5a0677c759d505c9199
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Mar 21 06:48:45 2017 -0400

    More aggressively work around missing events from Gecko dialogs

 src/orca/script_utilities.py              |    6 ++++
 src/orca/scripts/toolkits/Gecko/script.py |   39 ++++------------------------
 2 files changed, 12 insertions(+), 33 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index ee14320..3642ccd 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1230,6 +1230,12 @@ class Utilities:
             layoutOnly = False
         elif role == pyatspi.ROLE_FORM:
             layoutOnly = False
+        elif role in [pyatspi.ROLE_PUSH_BUTTON, pyatspi.ROLE_TOGGLE_BUTTON]:
+            layoutOnly = False
+        elif role in [pyatspi.ROLE_TEXT, pyatspi.ROLE_PASSWORD_TEXT, pyatspi.ROLE_ENTRY]:
+            layoutOnly = False
+        elif role == pyatspi.ROLE_LIST_ITEM and parentRole == pyatspi.ROLE_LIST_BOX:
+            layoutOnly = False
         elif self.isTableRow(obj):
             state = obj.getState()
             layoutOnly = not (state.contains(pyatspi.STATE_FOCUSABLE) \
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index a1d25dd..938f290 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -177,41 +177,14 @@ class Script(web.Script):
         if self.utilities.inDocumentContent(event.source):
             return
 
-        # NOTE: This event type is deprecated and Orca should no longer use it.
-        # This callback remains just to handle bugs in applications and toolkits
-        # in which object:state-changed:focused events are missing.
-
-        role = event.source.getRole()
-
-        # Unfiled. When a context menu pops up, we seem to get a focus: event,
-        # but no object:state-changed:focused event from Gecko.
-        if role == pyatspi.ROLE_MENU:
-            orca.setLocusOfFocus(event, event.source)
+        if self.utilities.isLayoutOnly(event.source):
             return
 
-        # Unfiled. When the Thunderbird 'do you want to replace this file'
-        # attachment dialog pops up, the 'Replace' button emits a focus:
-        # event, but we only seem to get the object:state-changed:focused
-        # event when it gives up focus.
-        if role == pyatspi.ROLE_PUSH_BUTTON:
-            orca.setLocusOfFocus(event, event.source)
-
-        # Some of the dialogs used by Thunderbird (and perhaps Firefox?) seem
-        # to be using Gtk+ 2, along with its associated focused-event issues.
-        # Unfortunately, because Gtk+ 2 doesn't expose a per-object toolkit,
-        # we cannot know that a given widget is Gtk+ 2. Therefore, we'll put
-        # our Gtk+ 2 toolkit script hacks here as well just to be safe.
-        if role in [pyatspi.ROLE_TEXT, pyatspi.ROLE_PASSWORD_TEXT]:
-            orca.setLocusOfFocus(event, event.source)
-
-        if role == pyatspi.ROLE_COMBO_BOX:
-            orca.setLocusOfFocus(event, event.source)
-
-        if role == pyatspi.ROLE_PAGE_TAB:
-            orca.setLocusOfFocus(event, event.source)
-
-        if role == pyatspi.ROLE_RADIO_BUTTON:
-            orca.setLocusOfFocus(event, event.source)
+        # NOTE: This event type is deprecated and Orca should no longer use it.
+        # This callback remains just to handle bugs in applications and toolkits
+        # in which object:state-changed:focused events are missing. And in the
+        # case of Gecko dialogs, that seems to happen a lot.
+        orca.setLocusOfFocus(event, event.source)
 
     def onFocusedChanged(self, event):
         """Callback for object:state-changed:focused accessibility events."""


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