[orca/gnome-3-14] Don't just grab focus on elements in structural navigation



commit a1f3e581f1fd561ce182d1bece0cf707e9e69092
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sun Sep 14 20:05:21 2014 -0400

    Don't just grab focus on elements in structural navigation
    
    Expliciting setting the caret position ensures we keep accurate track of
    what has focus.

 src/orca/scripts/toolkits/Gecko/script.py |    3 ++-
 src/orca/structural_navigation.py         |   24 ++++++++++++++++++------
 2 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index ebc2df4..642f1c1 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1234,7 +1234,8 @@ class Script(default.Script):
         if self._lastCommandWasStructNav:
             msg = "INFO: Focus change event handled manually: last command was struct nav"
             debug.println(debug.LEVEL_INFO, msg)
-            if role != pyatspi.ROLE_LINK:
+            if role != pyatspi.ROLE_LINK \
+               and obj.parent.getRole() != pyatspi.ROLE_LIST_BOX:
                 self.setCaretContext(event.source, 0)
                 orca.setLocusOfFocus(event, event.source)
             return
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 7d65a21..7588298 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -1907,7 +1907,9 @@ class StructuralNavigation:
         """
 
         if obj:
-            obj.queryComponent().grabFocus()
+            [obj, characterOffset] = self._getCaretPosition(obj)
+            self._setCaretPosition(obj, characterOffset)
+            self._presentObject(obj, characterOffset)
         else:
             full = messages.NO_MORE_BUTTONS
             brief = messages.STRUCTURAL_NAVIGATION_NOT_FOUND
@@ -1989,7 +1991,9 @@ class StructuralNavigation:
         """
 
         if obj:
-            obj.queryComponent().grabFocus()
+            [obj, characterOffset] = self._getCaretPosition(obj)
+            self._setCaretPosition(obj, characterOffset)
+            self._presentObject(obj, characterOffset)
         else:
             full = messages.NO_MORE_CHECK_BOXES
             brief = messages.STRUCTURAL_NAVIGATION_NOT_FOUND
@@ -2162,7 +2166,9 @@ class StructuralNavigation:
         """
 
         if obj:
-            obj.queryComponent().grabFocus()
+            [obj, characterOffset] = self._getCaretPosition(obj)
+            self._setCaretPosition(obj, characterOffset)
+            self._presentObject(obj, characterOffset)
         else:
             full = messages.NO_MORE_COMBO_BOXES
             brief = messages.STRUCTURAL_NAVIGATION_NOT_FOUND
@@ -2257,7 +2263,9 @@ class StructuralNavigation:
         """
 
         if obj:
-            obj.queryComponent().grabFocus()
+            [obj, characterOffset] = self._getCaretPosition(obj)
+            self._setCaretPosition(obj, characterOffset)
+            self._presentObject(obj, characterOffset)
         else:
             full = messages.NO_MORE_ENTRIES
             brief = messages.STRUCTURAL_NAVIGATION_NOT_FOUND
@@ -2347,7 +2355,9 @@ class StructuralNavigation:
         if obj:
             if obj.getRole() == pyatspi.ROLE_TEXT and obj.childCount:
                 obj = obj[0]
-            obj.queryComponent().grabFocus()
+            [obj, characterOffset] = self._getCaretPosition(obj)
+            self._setCaretPosition(obj, characterOffset)
+            self._presentObject(obj, characterOffset)
         else:
             full = messages.NO_MORE_FORM_FIELDS
             brief = messages.STRUCTURAL_NAVIGATION_NOT_FOUND
@@ -3087,7 +3097,9 @@ class StructuralNavigation:
         """
 
         if obj:
-            obj.queryComponent().grabFocus()
+            [obj, characterOffset] = self._getCaretPosition(obj)
+            self._setCaretPosition(obj, characterOffset)
+            self._presentObject(obj, characterOffset)
         else:
             full = messages.NO_MORE_RADIO_BUTTONS
             brief = messages.STRUCTURAL_NAVIGATION_NOT_FOUND


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