? DIFFS
Index: core.c
===================================================================
RCS file: /cvs/gnome/metacity/src/core.c,v
retrieving revision 1.49
diff -u -p -r1.49 core.c
--- core.c	28 Apr 2006 16:54:52 -0000	1.49
+++ core.c	16 Jul 2006 17:59:30 -0000
@@ -604,7 +604,7 @@ meta_core_begin_grab_op (Display    *xdi
                                      op, pointer_already_grabbed,
                                      event_serial,
                                      button, modmask,
-                                     timestamp, root_x, root_y);
+                                     timestamp, root_x, root_y, NULL);
 }
 
 void
Index: display.c
===================================================================
RCS file: /cvs/gnome/metacity/src/display.c,v
retrieving revision 1.286
diff -u -p -r1.286 display.c
--- display.c	26 May 2006 16:51:03 -0000	1.286
+++ display.c	16 Jul 2006 17:59:34 -0000
@@ -1713,7 +1713,8 @@ event_callback (XEvent   *event,
                                                 0,
                                                 event->xbutton.time,
                                                 event->xbutton.x_root,
-                                                event->xbutton.y_root);
+                                                event->xbutton.y_root,
+                                                NULL);
                 }
             }
           else if (event->xbutton.button == 3)
@@ -1770,7 +1771,8 @@ event_callback (XEvent   *event,
                                           0,
                                           event->xbutton.time,
                                           event->xbutton.x_root,
-                                          event->xbutton.y_root);
+                                          event->xbutton.y_root,
+                                          NULL);
             }
         }
       break;
@@ -3221,7 +3223,8 @@ meta_display_begin_grab_op (MetaDisplay 
                             gulong       modmask,
                             Time         timestamp,
                             int          root_x,
-                            int          root_y)
+                            int          root_y,
+                            MetaWindow  *ricochet_window)
 {
   Window grab_xwindow;
   
@@ -3449,34 +3452,40 @@ meta_display_begin_grab_op (MetaDisplay 
     case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
       meta_screen_ensure_tab_popup (screen,
                                     META_TAB_LIST_NORMAL,
-                                    META_TAB_SHOW_ICON);
+                                    META_TAB_SHOW_ICON,
+                                    NULL);
       break;
     case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL:
       meta_screen_ensure_tab_popup (screen,
                                     META_TAB_LIST_NORMAL,
-                                    META_TAB_SHOW_INSTANTLY);
+                                    META_TAB_SHOW_INSTANTLY,
+                                    NULL);
       break;
 
     case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
       meta_screen_ensure_tab_popup (screen,
                                     META_TAB_LIST_DOCKS,
-                                    META_TAB_SHOW_ICON);
+                                    META_TAB_SHOW_ICON,
+                                    NULL);
       break;
     case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
       meta_screen_ensure_tab_popup (screen,
                                     META_TAB_LIST_DOCKS,
-                                    META_TAB_SHOW_INSTANTLY);
+                                    META_TAB_SHOW_INSTANTLY,
+                                    NULL);
       break;
     case META_GRAB_OP_KEYBOARD_TABBING_GROUP:
       meta_screen_ensure_tab_popup (screen,
                                     META_TAB_LIST_GROUP,
-                                    META_TAB_SHOW_ICON);
+                                    META_TAB_SHOW_ICON,
+                                    ricochet_window);
       break;
      case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
       meta_screen_ensure_tab_popup (screen,
                                     META_TAB_LIST_GROUP,
-                                    META_TAB_SHOW_INSTANTLY);
-      
+                                    META_TAB_SHOW_INSTANTLY,
+                                    ricochet_window);
+      break; 
     case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
       meta_screen_ensure_workspace_popup (screen);
       break;
@@ -4190,9 +4199,14 @@ get_focussed_group (MetaDisplay *display
     return NULL;
 }
 
-#define IN_TAB_CHAIN(w,t) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \
+/* This returns whether the window "w" is in the tab list of type "t".
+ * The "g" parameter is only valid when t==META_TAB_LIST_GROUP.
+ * If it is non-NULL, then "g" is used as the group to check.
+ * If it is NULL, then the currently focussed group is used.
+ */
+#define IN_TAB_CHAIN(w,t,g) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \
     || ((t) == META_TAB_LIST_DOCKS && META_WINDOW_IN_DOCK_TAB_CHAIN (w)) \
-    || ((t) == META_TAB_LIST_GROUP && META_WINDOW_IN_GROUP_TAB_CHAIN (w, get_focussed_group(w->display))))
+    || ((t) == META_TAB_LIST_GROUP && META_WINDOW_IN_GROUP_TAB_CHAIN (w, ((g)?(g):(get_focussed_group(w->display))) )))
 
 static MetaWindow*
 find_tab_forward (MetaDisplay   *display,
@@ -4216,7 +4230,7 @@ find_tab_forward (MetaDisplay   *display
       MetaWindow *window = tmp->data;
 
       if (window->screen == screen &&
-	  IN_TAB_CHAIN (window, type))
+	  IN_TAB_CHAIN (window, type, NULL))
         return window;
 
       tmp = tmp->next;
@@ -4227,7 +4241,7 @@ find_tab_forward (MetaDisplay   *display
     {
       MetaWindow *window = tmp->data;
 
-      if (IN_TAB_CHAIN (window, type))
+      if (IN_TAB_CHAIN (window, type, NULL))
         return window;
 
       tmp = tmp->next;
@@ -4257,7 +4271,7 @@ find_tab_backward (MetaDisplay   *displa
       MetaWindow *window = tmp->data;
 
       if (window->screen == screen &&
-	  IN_TAB_CHAIN (window, type))
+	  IN_TAB_CHAIN (window, type, NULL))
         return window;
 
       tmp = tmp->prev;
@@ -4268,7 +4282,7 @@ find_tab_backward (MetaDisplay   *displa
     {
       MetaWindow *window = tmp->data;
 
-      if (IN_TAB_CHAIN (window, type))
+      if (IN_TAB_CHAIN (window, type, NULL))
         return window;
 
       tmp = tmp->prev;
@@ -4281,9 +4295,14 @@ GList*
 meta_display_get_tab_list (MetaDisplay   *display,
                            MetaTabList    type,
                            MetaScreen    *screen,
-                           MetaWorkspace *workspace)
+                           MetaWorkspace *workspace,
+                           MetaWindow    *ricochet_window)
 {
   GList *tab_list;
+  MetaGroup *group = NULL;
+
+  if (ricochet_window != NULL)
+    group = ricochet_window->group;
 
   g_return_val_if_fail (workspace != NULL, NULL);
 
@@ -4301,7 +4320,7 @@ meta_display_get_tab_list (MetaDisplay  
         
         if (!window->minimized &&
             window->screen == screen &&
-            IN_TAB_CHAIN (window, type))
+            IN_TAB_CHAIN (window, type, group))
           tab_list = g_list_prepend (tab_list, window);
         
         tmp = tmp->next;
@@ -4318,7 +4337,7 @@ meta_display_get_tab_list (MetaDisplay  
         
         if (window->minimized &&
             window->screen == screen &&
-            IN_TAB_CHAIN (window, type))
+            IN_TAB_CHAIN (window, type, group))
           tab_list = g_list_prepend (tab_list, window);
         
         tmp = tmp->next;
@@ -4336,15 +4355,18 @@ meta_display_get_tab_next (MetaDisplay  
                            MetaScreen    *screen,
                            MetaWorkspace *workspace,
                            MetaWindow    *window,
-                           gboolean       backward)
+                           gboolean       backward,
+                           MetaWindow    *ricochet_window)
 {
   gboolean skip;
   GList *tab_list;
   MetaWindow *ret;
+
   tab_list = meta_display_get_tab_list(display,
                                        type,
                                        screen,
-                                       workspace);
+                                       workspace,
+                                       ricochet_window);
 
   if (tab_list == NULL)
     return NULL;
@@ -4367,7 +4389,7 @@ meta_display_get_tab_next (MetaDisplay  
   else
     {
       skip = display->focus_window != NULL && 
-             IN_TAB_CHAIN (display->focus_window, type);
+             IN_TAB_CHAIN (display->focus_window, type, NULL);
       if (backward)
         ret = find_tab_backward (display, type, screen, workspace,
                                  tab_list, skip);
@@ -4392,7 +4414,7 @@ meta_display_get_tab_current (MetaDispla
   
   if (window != NULL &&
       window->screen == screen &&
-      IN_TAB_CHAIN (window, type) &&
+      IN_TAB_CHAIN (window, type, NULL) &&
       (workspace == NULL ||
        meta_window_located_on_workspace (window, workspace)))
     return window;
Index: display.h
===================================================================
RCS file: /cvs/gnome/metacity/src/display.h,v
retrieving revision 1.152
diff -u -p -r1.152 display.h
--- display.h	4 May 2006 17:32:26 -0000	1.152
+++ display.h	16 Jul 2006 17:59:34 -0000
@@ -443,7 +443,8 @@ gboolean meta_display_begin_grab_op (Met
                                      gulong       modmask,
                                      Time         timestamp,
                                      int          root_x,
-                                     int          root_y);
+                                     int          root_y,
+                                     MetaWindow  *ricochet_window);
 void     meta_display_end_grab_op   (MetaDisplay *display,
                                      Time         timestamp);
 
@@ -507,14 +508,16 @@ typedef enum
 GList* meta_display_get_tab_list (MetaDisplay   *display,
                                   MetaTabList    type,
                                   MetaScreen    *screen,
-                                  MetaWorkspace *workspace);
+                                  MetaWorkspace *workspace,
+                                  MetaWindow    *reference_window);
 
 MetaWindow* meta_display_get_tab_next (MetaDisplay   *display,
                                        MetaTabList    type,
 				       MetaScreen    *screen,
                                        MetaWorkspace *workspace,
                                        MetaWindow    *window,
-                                       gboolean       backward);
+                                       gboolean       backward,
+                                       MetaWindow    *ricochet_window);
 
 MetaWindow* meta_display_get_tab_current (MetaDisplay   *display,
                                           MetaTabList    type,
Index: keybindings.c
===================================================================
RCS file: /cvs/gnome/metacity/src/keybindings.c,v
retrieving revision 1.129
diff -u -p -r1.129 keybindings.c
--- keybindings.c	17 Apr 2006 17:23:09 -0000	1.129
+++ keybindings.c	16 Jul 2006 17:59:37 -0000
@@ -2408,7 +2408,22 @@ process_tab_grab (MetaDisplay *display,
           /* carry on */
              break;
         default:
-             return FALSE;
+             /* They were using alt-Escape or alt-Tab, and now they've started
+              * using alt-f6 without letting go of alt in between. We should
+              * therefore switch to the subwindows of the selected window.
+              */
+             meta_display_end_grab_op (display, event->xkey.time);
+
+             process_event (display->screen_bindings,
+                 display->n_screen_bindings,
+                 screen_handlers,
+                 display, screen, prev_window, event, keysym);
+ 
+             /* Make sure we have the cursor somewhere. */
+             meta_ui_tab_popup_select (screen->tab_popup,
+                                       (MetaTabEntryKey) prev_window->xwindow);
+ 
+             return TRUE;
         }
  
       break;
@@ -3011,7 +3026,8 @@ do_choose_window (MetaDisplay    *displa
                                                  screen,
                                                  screen->active_workspace,
                                                  NULL,
-                                                 backward);
+                                                 backward,
+                                                 event_window);
 
   /* Note that focus_window may not be in the tab chain, but it's OK */
   if (initial_selection == NULL)
@@ -3048,7 +3064,8 @@ do_choose_window (MetaDisplay    *displa
                                            0,
                                            binding->mask,
                                            event->xkey.time,
-                                           0, 0))
+                                           0, 0,
+                                           event_window))
         {
           if (!primary_modifier_still_pressed (display,
                                                binding->mask))
@@ -3481,7 +3498,7 @@ handle_workspace_switch  (MetaDisplay   
                                   0,
                                   grab_mask,
                                   event->xkey.time,
-                                  0, 0))
+                                  0, 0, NULL))
     {
       MetaWorkspace *next;
       gboolean grabbed_before_release;
Index: screen.c
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.c,v
retrieving revision 1.158
diff -u -p -r1.158 screen.c
--- screen.c	15 May 2006 18:37:36 -0000	1.158
+++ screen.c	16 Jul 2006 17:59:39 -0000
@@ -1201,7 +1201,8 @@ meta_screen_update_cursor (MetaScreen *s
 void
 meta_screen_ensure_tab_popup (MetaScreen      *screen,
                               MetaTabList      list_type,
-                              MetaTabShowType  show_type)
+                              MetaTabShowType  show_type,
+                              MetaWindow      *ricochet_window)
 {
   MetaTabEntry *entries;
   GList *tab_list;
@@ -1215,7 +1216,8 @@ meta_screen_ensure_tab_popup (MetaScreen
   tab_list = meta_display_get_tab_list (screen->display,
                                         list_type,
                                         screen,
-                                        screen->active_workspace);
+                                        screen->active_workspace,
+                                        ricochet_window);
   
   len = g_list_length (tab_list);
 
Index: screen.h
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.h,v
retrieving revision 1.70
diff -u -p -r1.70 screen.h
--- screen.h	16 Feb 2006 20:26:05 -0000	1.70
+++ screen.h	16 Jul 2006 17:59:39 -0000
@@ -143,7 +143,8 @@ void          meta_screen_update_cursor 
 
 void          meta_screen_ensure_tab_popup    (MetaScreen                 *screen,
                                                MetaTabList                 list_type,
-                                               MetaTabShowType             show_type);
+                                               MetaTabShowType             show_type,
+                                               MetaWindow                 *ricochet_window);
 void          meta_screen_ensure_workspace_popup (MetaScreen *screen);
 
 MetaWindow*   meta_screen_get_mouse_window     (MetaScreen                 *screen,
Index: window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.440
diff -u -p -r1.440 window.c
--- window.c	26 May 2006 20:50:34 -0000	1.440
+++ window.c	16 Jul 2006 17:59:45 -0000
@@ -4710,7 +4710,8 @@ meta_window_client_message (MetaWindow *
                                           button, 0,
                                           meta_display_get_current_time (window->display),
                                           x_root,
-                                          y_root);
+                                          y_root,
+                                          NULL);
             }
         }
 
@@ -7520,7 +7521,7 @@ meta_window_begin_grab_op (MetaWindow *w
                               0 /* button */,
                               0,
                               timestamp,
-                              x, y);
+                              x, y, NULL);
 
   /* We override the one set in display_begin_grab_op since we
    * did additional stuff as part of the grabbing process
