Index: src/core.c
===================================================================
RCS file: /cvs/gnome/metacity/src/core.c,v
retrieving revision 1.41
diff -p -u -r1.41 core.c
--- src/core.c	4 Oct 2004 20:32:59 -0000	1.41
+++ src/core.c	5 Oct 2004 19:08:19 -0000
@@ -275,13 +275,13 @@ meta_core_user_lower_and_unfocus (Displa
             g_list_append (window->screen->active_workspace->mru_list, 
                            window);
         }
-
-      /* focus on the (new) topmost window */
-      if (window->has_focus)
-        meta_workspace_focus_default_window (window->screen->active_workspace,
-                                             window,
-                                             timestamp);
     }
+
+  /* focus the default window, if needed */
+  if (window->has_focus)
+    meta_workspace_focus_default_window (window->screen->active_workspace,
+                                         NULL,
+                                         timestamp);
 }
 
 void
Index: src/display.c
===================================================================
RCS file: /cvs/gnome/metacity/src/display.c,v
retrieving revision 1.234
diff -p -u -r1.234 display.c
--- src/display.c	4 Oct 2004 21:21:38 -0000	1.234
+++ src/display.c	5 Oct 2004 19:08:19 -0000
@@ -1784,7 +1784,7 @@ event_callback (XEvent   *event,
           switch (meta_prefs_get_focus_mode ())
             {
             case META_FOCUS_MODE_MOUSE:
-              if (window->has_focus &&
+              if (window == display->expected_focus_window &&
                   (window->frame == NULL || frame_was_receiver) &&
 		  event->xcrossing.mode != NotifyGrab && 
 		  event->xcrossing.mode != NotifyUngrab &&
