Index: orca/ChangeLog
===================================================================
RCS file: /cvs/gnome/orca/ChangeLog,v
retrieving revision 1.682
diff -p -u -r1.682 ChangeLog
--- orca/ChangeLog	11 Aug 2006 08:08:44 -0000	1.682
+++ orca/ChangeLog	11 Aug 2006 08:21:18 -0000
@@ -1,5 +1,10 @@
 2006-08-11  Willie Walker <william.walker@sun.com>
 
+	* src/orca/default.py: fix for bug 350854 - handle
+	object:state-changed:focused events so Orca will recognize when
+	GEdit's edit area has focus again after a maximize/unmaxmize of
+	GEdit's window on GNOME 2.15/16.
+	
 	* src/orca/speech.py: for regression testing purposes, allow us to
 	get what would have been spoken even if settings.speechServerFactory 
 	is None.
Index: orca/src/orca/default.py
===================================================================
RCS file: /cvs/gnome/orca/src/orca/default.py,v
retrieving revision 1.190
diff -p -u -r1.190 default.py
--- orca/src/orca/default.py	10 Aug 2006 16:50:23 -0000	1.190
+++ orca/src/orca/default.py	11 Aug 2006 08:21:18 -0000
@@ -1683,6 +1683,15 @@ class Script(script.Script):
         - event: the Event
         """
 
+        # We don't always get focus: events for text areas, so if we
+        # see caret moved events for a focused text area, we silently
+        # set them to be the locus of focus.
+        #
+        if event and event.source and \
+           (event.source != orca_state.locusOfFocus) and \
+            event.source.state.count(atspi.Accessibility.STATE_FOCUSED):
+            orca.setLocusOfFocus(event, event.source, False)
+
         # Ignore caret movements from non-focused objects, unless the
         # currently focused object is the parent of the object which
         # has the caret.
@@ -1783,8 +1792,8 @@ class Script(script.Script):
         - event: the Event
         """
 
-        # We don't always get focus: events for text areas, so if we 
-        # see inserted text events for a focused text area, we silently 
+        # We don't always get focus: events for text areas, so if we
+        # see inserted text events for a focused text area, we silently
         # set them to be the locus of focus..
         #
         if event and event.source and \
@@ -1895,13 +1904,23 @@ class Script(script.Script):
         orca.setLocusOfFocus(event, event.source)
 
     def onStateChanged(self, event):
-        """Called whenever an object's state changes.  Currently, the
-        state changes for non-focused objects are ignored.
+        """Called whenever an object's state changes.
 
         Arguments:
         - event: the Event
         """
 
+        # Sometimes an object will tell us it is focused this
+        # way versus issuing a focus event.  GEdit's edit area,
+        # for example, will do this: when you use metacity's
+        # window menu to do things like maximize or unmaximize
+        # a window, you will only get a state-changed event
+        # from the text area when it regains focus.
+        #
+        if (event.type == "object:state-changed:focused") \
+           and (event.detail1):
+            orca.setLocusOfFocus(event, event.source)
+
         # Do we care?
         #
         if state_change_notifiers.has_key(event.source.role):
@@ -1947,9 +1966,9 @@ class Script(script.Script):
         if event.source.role == rolenames.ROLE_COMBO_BOX:
             orca.visualAppearanceChanged(event, event.source)
 
-        # We treat selected children as the locus of focus. When the 
-        # selection changed we want to update the locus of focus. If 
-        # there is no selection, we default the locus of focus to the 
+        # We treat selected children as the locus of focus. When the
+        # selection changed we want to update the locus of focus. If
+        # there is no selection, we default the locus of focus to the
         # containing object.
         #
         elif (event.source != orca_state.locusOfFocus) and \
