[orca] Fix double-presentation and incorrect ordering of frame name changes



commit 8e5d2302fae08bc66b37ad7d2660948bb65bb458
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Nov 18 16:40:09 2015 -0500

    Fix double-presentation and incorrect ordering of frame name changes

 src/orca/script_utilities.py |    2 +-
 src/orca/scripts/default.py  |   30 +++++++++++++++---------------
 2 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index de7b4c9..7e1c41a 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -255,7 +255,7 @@ class Utilities:
         debug.println(debug.LEVEL_FINEST,
                       "script_utilities.commonAncestor...")
 
-        if (not a) or (not b):
+        if (not a or self.isZombie(a)) or (not b or self.isZombie(b)):
             return None
 
         if a == b:
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 38068f5..815c135 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -746,6 +746,8 @@ class Script(script.Script):
         # name has not.
         names = self.pointOfReference.get('names', {})
         names[hash(obj)] = name
+        if orca_state.activeWindow:
+            names[hash(orca_state.activeWindow)] = orca_state.activeWindow.name
         self.pointOfReference['names'] = names
 
         # We want to save the offset for text objects because some apps and
@@ -2264,27 +2266,25 @@ class Script(script.Script):
         names = self.pointOfReference.get('names', {})
         oldName = names.get(hash(obj))
         if oldName == event.any_data:
+            msg = "DEFAULT: Old name (%s) is the same as new name" % oldName
+            debug.println(debug.LEVEL_INFO, msg)
             return
 
-        # We are ignoring name changes in comboboxes that have focus
-        # see bgo#617204
         role = obj.getRole()
-        if role == pyatspi.ROLE_COMBO_BOX:
-            return
-
-        # Table cell accessibles in trees are often reused. When this occurs,
-        # we get name-changed events when the selection changes.
-        if role == pyatspi.ROLE_TABLE_CELL:
+        if role in [pyatspi.ROLE_COMBO_BOX, pyatspi.ROLE_TABLE_CELL]:
+            msg = "DEFAULT: Event is redundant notification for this role"
+            debug.println(debug.LEVEL_INFO, msg)
             return
 
-        # Normally, we only care about name changes in the current object.
-        # But with the new GtkHeaderBar, we are seeing instances where the
-        # real frame remains the same, but the functional frame changes
-        # e.g. g-c-c going from all settings to a specific panel.
-        if not self.utilities.isSameObject(obj, orca_state.locusOfFocus):
-            if role != pyatspi.ROLE_FRAME \
-               or not obj.getState().contains(pyatspi.STATE_ACTIVE):
+        if role == pyatspi.ROLE_FRAME:
+            if obj != orca_state.activeWindow:
+                msg = "DEFAULT: Event is for frame other than the active window"
+                debug.println(debug.LEVEL_INFO, msg)
                 return
+        elif obj != orca_state.locusOfFocus:
+            msg = "DEFAULT: Event is for object other than the locusOfFocus"
+            debug.println(debug.LEVEL_INFO, msg)
+            return
 
         names[hash(obj)] = event.any_data
         self.pointOfReference['names'] = names


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