Index: src/orca/orca.py
===================================================================
--- src/orca/orca.py	(revision 3950)
+++ src/orca/orca.py	(working copy)
@@ -183,6 +183,15 @@
     if obj == orca_state.locusOfFocus:
         return
 
+    # If this event is not for the currently active script, then just return.
+    #
+    if event and event.source and \
+       event.host_application and orca_state.activeScript:
+        currentApp = orca_state.activeScript.app
+        if currentApp != event.host_application and \
+           currentApp != event.source.getApplication():
+            return
+
     oldLocusOfFocus = orca_state.locusOfFocus
     try:
         # Just to see if we have a valid object.
Index: src/orca/focus_tracking_presenter.py
===================================================================
--- src/orca/focus_tracking_presenter.py	(revision 3950)
+++ src/orca/focus_tracking_presenter.py	(working copy)
@@ -605,9 +605,18 @@
                     # in use, and then issues a focus: event on the
                     # main window, which is a frame.]]]
                     #
-                    if (event.type == "window:activate") \
-                       or ((event.type.startswith("focus")) 
-                           and (event.source.getRole() == pyatspi.ROLE_FRAME)):
+                    # Added in a further check. We look for modal panels
+                    # that are now showing (such as gnome-screensaver-dialog).
+                    # See bug #530368 for more details.
+                    #
+                    eType = event.type
+                    if (eType == "window:activate") \
+                       or ((eType.startswith("focus")) 
+                         and (event.source.getRole() == pyatspi.ROLE_FRAME)) \
+                       or (eType.startswith("object:state-changed:showing")
+                         and (event.source.getRole() == pyatspi.ROLE_PANEL)
+                         and state.contains(pyatspi.STATE_MODAL)):
+
                         # We'll let someone else decide if it's important
                         # to stop speech or not.
                         #speech.stop()
