? autom4te.cache
? src/window.c_goog
Index: src/display.c
===================================================================
RCS file: /cvs/gnome/metacity/src/display.c,v
retrieving revision 1.133
diff -u -r1.133 display.c
--- src/display.c	6 Aug 2002 04:11:23 -0000	1.133
+++ src/display.c	8 Aug 2002 04:07:13 -0000
@@ -288,6 +288,7 @@
   display->pending_pings = NULL;
   display->autoraise_timeout_id = 0;
   display->focus_window = NULL;
+  display->expected_focus_window = NULL;
   display->mru_list = NULL;
 
   display->showing_desktop = FALSE;
Index: src/display.h
===================================================================
RCS file: /cvs/gnome/metacity/src/display.h,v
retrieving revision 1.74
diff -u -r1.74 display.h
--- src/display.h	1 Aug 2002 23:52:47 -0000	1.74
+++ src/display.h	8 Aug 2002 04:07:14 -0000
@@ -153,6 +153,11 @@
    */
   MetaWindow *focus_window;
 
+  /* WM_TAKE_FOCUS has been sent but we have not yet 
+   * received the resulting FocusIn event for this window
+   */
+  MetaWindow *expected_focus_window;
+
   /* Most recently focused list. Always contains all
    * live windows.
    */
Index: src/window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.200
diff -u -r1.200 window.c
--- src/window.c	7 Aug 2002 23:12:08 -0000	1.200
+++ src/window.c	8 Aug 2002 04:08:27 -0000
@@ -812,6 +812,14 @@
                   window->desc);
       meta_screen_focus_top_window (window->screen, window);
     }
+  else if (window->display->expected_focus_window == window)
+    {
+      meta_topic (META_DEBUG_FOCUS,
+                  "Focusing top window since expected focus window freed %s\n",
+                  window->desc);
+      window->display->expected_focus_window = NULL;
+      meta_screen_focus_top_window (window->screen, window);
+    }
   else
     {
       meta_topic (META_DEBUG_FOCUS,
@@ -1632,7 +1640,7 @@
       
       window->fullscreen = TRUE;
 
-      meta_window_update_layer (window);
+      meta_stack_update_layer (window->screen->stack, window);
       meta_window_raise (window);
       
       /* save size/pos as appropriate args for move_resize */
@@ -1661,7 +1669,7 @@
       
       window->fullscreen = FALSE;
 
-      meta_window_update_layer (window);
+      meta_stack_update_layer (window->screen->stack, window);
       
       meta_window_move_resize (window,
                                TRUE,
@@ -2798,6 +2806,7 @@
           meta_window_send_icccm_message (window,
                                           window->display->atom_wm_take_focus,
                                           timestamp);
+          window->display->expected_focus_window = window;
         }
       
       meta_error_trap_pop (window->display);
@@ -3580,6 +3589,9 @@
     
   if (event->type == FocusIn)
     {
+      if (window->display->expected_focus_window == window)
+        window->display->expected_focus_window = NULL;
+
       if (window != window->display->focus_window)
         {
           meta_topic (META_DEBUG_FOCUS,
