[orca] Verify we're not in a focused object before updating focus to context object



commit 0fc6174ade476fe24bb0490063dc8881ce5e1bf8
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Feb 10 03:55:00 2017 -0500

    Verify we're not in a focused object before updating focus to context object

 src/orca/scripts/web/script.py |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 53c0354..a1027fa 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1233,9 +1233,17 @@ class Script(default.Script):
             orca.setLocusOfFocus(event, obj)
             return True
 
-        msg = "WEB: Setting locus of focus to context obj %s (no notification)" % obj
-        debug.println(debug.LEVEL_INFO, msg, True)
-        orca.setLocusOfFocus(event, obj, False)
+        try:
+            focusState = orca_state.locusOfFocus.getState()
+        except:
+            inFocusedObject = False
+        else:
+            inFocusedObject = focusState.contains(pyatspi.STATE_FOCUSED)
+
+        if not inFocusedObject:
+            msg = "WEB: Setting locus of focus to context obj %s (no notification)" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            orca.setLocusOfFocus(event, obj, False)
 
         self.updateBraille(obj)
         if state.contains(pyatspi.STATE_FOCUSABLE) and not self.utilities.isDocument(obj):


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