Index: src/window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.333
diff -p -u -r1.333 window.c
--- src/window.c	31 Jul 2004 21:26:05 -0000	1.333
+++ src/window.c	1 Aug 2004 20:53:46 -0000
@@ -1640,7 +1640,7 @@ window_takes_focus_on_map (MetaWindow *w
                     window->display->focus_window->desc,
                     window->display->focus_window->net_wm_user_time);
       }
-
+ 
       /* We expect the most common case for not focusing a new window
        * to be when a hint to not focus it has been set.  Since we can
        * deal with that case rapidly, we use special case it--this is
@@ -1672,12 +1672,15 @@ window_takes_focus_on_map (MetaWindow *w
        * set the _NET_WM_USER_TIME.  If both are set, then it means
        * the user has interacted with the application since it
        * launched, and _NET_WM_USER_TIME is the value that should be
-       * used in the comparison.
+       * used in the comparison.  Always let windows steal focus from
+       * the dock or the desktop.
        */
       compare = window->initial_timestamp_set ? window->initial_timestamp : 0;
       compare = window->net_wm_user_time_set  ? window->net_wm_user_time  : compare;
 
       if ((window->display->focus_window == NULL) ||
+          (window->display->focus_window->type == META_WINDOW_DOCK) ||
+          (window->display->focus_window->type == META_WINDOW_DESKTOP) ||
           (XSERVER_TIME_IS_LATER (compare, window->display->focus_window->net_wm_user_time)))
         {
           meta_topic (META_DEBUG_STARTUP,
@@ -1712,11 +1715,6 @@ meta_window_show (MetaWindow *window)
 
   did_show = FALSE;
   did_placement = FALSE;
-  takes_focus_on_map = window_takes_focus_on_map (window);
-
-  if ( (!takes_focus_on_map) && (window->display->focus_window != NULL) )
-    meta_window_stack_just_below (window,
-                                  window->display->focus_window);
 
   window->focus_despite_user_time = FALSE;
  
@@ -1815,6 +1813,12 @@ meta_window_show (MetaWindow *window)
                                  meta_display_get_current_time (window->display));
             }
         }
+
+      takes_focus_on_map = window_takes_focus_on_map (window);
+      
+      if ( (!takes_focus_on_map) && (window->display->focus_window != NULL) )
+        meta_window_stack_just_below (window,
+                                      window->display->focus_window);
 
       if (takes_focus_on_map)
         {                
