Index: src/orca/default.py
===================================================================
--- src/orca/default.py	(revision 2538)
+++ src/orca/default.py	(working copy)
@@ -732,6 +732,8 @@
             self.onFocus
         #listeners["keyboard:modifiers"]                     = \
         #    self.noOp
+        listeners["mouse:button"]                           = \
+            self.onMouseButton
         listeners["object:property-change:accessible-name"] = \
             self.onNameChanged
         listeners["object:text-caret-moved"]                = \
@@ -3123,6 +3125,30 @@
             orca.setLocusOfFocus(event, None)
             orca_state.activeWindow = None
 
+    def onMouseButton(self, event):
+        """Called whenever the user presses or releases a mouse button.
+
+        Arguments:
+        - event: the Event
+        """
+
+        # If we've received a mouse button released event, then check if
+        # there are and text selections for the locus of focus and speak
+        # them.
+        #
+        state = event.type[-1]
+        if state == "r":
+            obj = orca_state.locusOfFocus
+            if obj and obj.text:
+                [textContents, startOffset, endOffset] = \
+                    self.whereAmI._getTextSelections(obj, True)
+                if textContents:
+                    utterances = []
+                    utterances.append(textContents)
+                    utterances.append(_("selected"))
+                    speech.speakUtterances(utterances)
+                self.updateBraille(orca_state.locusOfFocus)
+
     def noOp(self, event):
         """Just here to capture events.
 
Index: src/orca/focus_tracking_presenter.py
===================================================================
--- src/orca/focus_tracking_presenter.py	(revision 2538)
+++ src/orca/focus_tracking_presenter.py	(working copy)
@@ -524,7 +524,8 @@
             if (not debug.eventDebugFilter) \
                 or (debug.eventDebugFilter \
                     and debug.eventDebugFilter.match(event.type)):
-                debug.printDetails(debug.LEVEL_FINEST, "    ", event.source)
+                if not event.type.startswith("mouse:"):
+                    debug.printDetails(debug.LEVEL_FINEST, "    ", event.source)
 
         except CORBA.COMM_FAILURE:
             debug.printException(debug.LEVEL_WARNING)
@@ -559,7 +560,17 @@
         retryCount = 0
         oldLocusOfFocus = orca_state.locusOfFocus
         try:
-            s = self._getScript(event.source.app)
+            # If we've received a mouse event, then don't try to get
+            # event.source.app because the top most parent is of role 
+            # unknown, which will cause an ERROR message to be displayed.
+            # See Orca bug #409731 for more details.
+            #
+            if not event.type.startswith("mouse:"):
+                s = self._getScript(event.source.app)
+            else:
+                s = orca_state.activeScript
+            if not s:
+                return
         except:
             s = None
             debug.printException(debug.LEVEL_WARNING)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2538)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2007-07-13  Rich Burridge <rich.burridge@sun.com>
+
+        * src/orca/default.py:
+          src/orca/focus_tracking_presenter.py:
+          Fixed bug #409731 – Orca should speak text selected by the mouse.
+
 2007-07-12  Joanmarie Diggs <j-diggs@comcast.net>
 
         * src/orca/braille.py: Fix for bug 456296 - Traceback in 
