orca r4097 - in trunk: . src/orca/scripts/apps/Thunderbird src/orca/scripts/toolkits/Gecko



Author: joanied
Date: Tue Aug 12 17:43:45 2008
New Revision: 4097
URL: http://svn.gnome.org/viewvc/orca?rev=4097&view=rev

Log:
* src/orca/scripts/toolkits/Gecko/script.py:
  src/orca/scripts/apps/Thunderbird/script.py:
  Fix for bug #547345 - Can't always "Alt+Tab" back into Thunderbird
  or Firefox.



Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/apps/Thunderbird/script.py
   trunk/src/orca/scripts/toolkits/Gecko/script.py

Modified: trunk/src/orca/scripts/apps/Thunderbird/script.py
==============================================================================
--- trunk/src/orca/scripts/apps/Thunderbird/script.py	(original)
+++ trunk/src/orca/scripts/apps/Thunderbird/script.py	Tue Aug 12 17:43:45 2008
@@ -250,10 +250,31 @@
         # Handle a newly-opened message.
         #
         if event.source.getRole() == pyatspi.ROLE_DOCUMENT_FRAME \
-           and orca_state.locusOfFocus.getRole() == pyatspi.ROLE_FRAME \
-           and self._messageLoaded:
-            consume = True
-            self._presentMessage(event.source)
+           and orca_state.locusOfFocus.getRole() == pyatspi.ROLE_FRAME:
+            if self._messageLoaded:
+                consume = True
+                self._presentMessage(event.source)
+
+            # If the user just gave focus to the message window (e.g. by
+            # Alt+Tabbing back into it), we might have an existing caret
+            # context. But we'll need the document frame in order to verify
+            # this. Therefore try to find the document frame.
+            #
+            elif self.getCaretContext() == [None, -1]:
+                documentFrame = None
+                for child in orca_state.locusOfFocus:
+                    if child.getRole() == pyatspi.ROLE_INTERNAL_FRAME \
+                       and child.childCount \
+                       and child[0].getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
+                        documentFrame = child[0]
+                        break
+                try:
+                    contextObj, contextOffset = \
+                        self._documentFrameCaretContext[hash(documentFrame)]
+                    if contextObj:
+                        orca.setLocusOfFocus(event, contextObj)
+                except:
+                    pass
 
         if not consume:
             Gecko.Script.onFocus(self, event)

Modified: trunk/src/orca/scripts/toolkits/Gecko/script.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/script.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/script.py	Tue Aug 12 17:43:45 2008
@@ -1712,6 +1712,16 @@
             #
             self.presentLine(obj, characterOffset)
 
+    def onWindowDeactivated(self, event):
+        """Called whenever a toplevel window is deactivated.
+
+        Arguments:
+        - event: the Event
+        """
+
+        self._objectForFocusGrab = None
+        default.Script.onWindowDeactivated(self, event)
+
     def handleProgressBarUpdate(self, event, obj):
         """Determine whether this progress bar event should be spoken or not.
         For Firefox, we don't want to speak the small "page load" progress
@@ -5028,7 +5038,7 @@
         #
         documentFrame = self.getDocumentFrame()
         if documentFrame:
-            self._documentFrameCaretContext[documentFrame] = caretContext
+            self._documentFrameCaretContext[hash(documentFrame)] = caretContext
 
         if caretContext == [obj, characterOffset]:
             return



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