Index: src/keybindings.c
===================================================================
RCS file: /cvs/gnome/metacity/src/keybindings.c,v
retrieving revision 1.112
diff -p -u -r1.112 keybindings.c
--- src/keybindings.c	3 Aug 2005 02:22:00 -0000	1.112
+++ src/keybindings.c	1 Oct 2005 19:50:28 -0000
@@ -2434,6 +2434,8 @@ process_tab_grab (MetaDisplay *display,
       
       if (target_window)
         {
+          target_window->tab_unminimized = FALSE;
+
           meta_topic (META_DEBUG_KEYBINDINGS,
                       "Activating target window\n");
 
@@ -2501,6 +2503,13 @@ process_tab_grab (MetaDisplay *display,
   
   if (key_used)
     {
+      Window      prev_xwindow;
+      MetaWindow *prev_window;
+      prev_xwindow =
+        (Window) meta_ui_tab_popup_get_selected (screen->tab_popup);
+      prev_window =
+        meta_display_lookup_x_window (display, prev_xwindow);
+
       meta_topic (META_DEBUG_KEYBINDINGS,
                   "Key pressed, moving tab focus in popup\n");
 
@@ -2525,14 +2534,25 @@ process_tab_grab (MetaDisplay *display,
           target_window =
             meta_display_lookup_x_window (display, target_xwindow);
           
+          if (prev_window && prev_window->tab_unminimized)
+            {
+              prev_window->tab_unminimized = FALSE;
+              meta_window_minimize (prev_window);
+            }
+
           if (target_window)
             {
               meta_window_raise (target_window);
+              target_window->tab_unminimized = target_window->minimized;
+              meta_window_unminimize (target_window);
             }
         }
     }
   else
     {
+      Window      prev_xwindow;
+      MetaWindow *prev_window;
+
       /* end grab */
       meta_topic (META_DEBUG_KEYBINDINGS,
                   "Ending tabbing/cycling, uninteresting key pressed\n");
@@ -2541,6 +2561,17 @@ process_tab_grab (MetaDisplay *display,
                   "Syncing to old stack positions.\n");
       meta_stack_set_positions (screen->stack,
                                 screen->display->grab_old_window_stacking);
+
+      prev_xwindow =
+        (Window) meta_ui_tab_popup_get_selected (screen->tab_popup);
+      prev_window =
+        meta_display_lookup_x_window (display, prev_xwindow);
+
+      if (prev_window && prev_window->tab_unminimized)
+        {
+          meta_window_minimize (prev_window);
+          prev_window->tab_unminimized = FALSE;
+        }
     }
   
   return key_used;
@@ -3099,7 +3130,12 @@ do_choose_window (MetaDisplay    *displa
                 meta_ui_tab_popup_set_showing (screen->tab_popup,
                                                TRUE);
               else
-                meta_window_raise (initial_selection);
+                {
+                  meta_window_raise (initial_selection);
+                  initial_selection->tab_unminimized = 
+                    initial_selection->minimized;
+                  meta_window_unminimize (initial_selection);
+                }
             }
         }
     }
Index: src/window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.392
diff -p -u -r1.392 window.c
--- src/window.c	3 Aug 2005 02:22:00 -0000	1.392
+++ src/window.c	1 Oct 2005 19:50:28 -0000
@@ -437,6 +437,7 @@ meta_window_new_with_attrs (MetaDisplay 
   window->shaded = FALSE;
   window->initially_iconic = FALSE;
   window->minimized = FALSE;
+  window->tab_unminimized = FALSE;
   window->iconic = FALSE;
   window->mapped = attrs->map_state != IsUnmapped;
   /* if already mapped, no need to worry about focus-on-first-time-showing */
Index: src/window.h
===================================================================
RCS file: /cvs/gnome/metacity/src/window.h,v
retrieving revision 1.116
diff -p -u -r1.116 window.h
--- src/window.h	26 May 2005 19:58:17 -0000	1.116
+++ src/window.h	1 Oct 2005 19:50:28 -0000
@@ -124,6 +124,7 @@ struct _MetaWindow
 
   /* Minimize is the state controlled by the minimize button */
   guint minimized : 1;
+  guint tab_unminimized : 1;
 
   /* Whether the window is mapped; actual server-side state
    * see also unmaps_pending
