Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/metacity/ChangeLog,v
retrieving revision 1.1018
diff -p -u -5 -r1.1018 ChangeLog
--- ChangeLog	2 Jun 2005 15:47:37 -0000	1.1018
+++ ChangeLog	10 Jun 2005 11:55:49 -0000
@@ -1,5 +1,29 @@
+2005-06-10  Leena Gunda  <leena.gunda@wipro.com>
+
+	Added a keybinding to allow users to switch between the screens 
+	in multihead setup only.
+
+	* src/display.c (grab_op_is_keyboard), 
+	(meta_display_begin_grab_op), (meta_display_end_grab_op):
+	* src/keybindings.c (rebuild_binding_table), 
+	(meta_display_process_key_event), (process_screen_switch_grab), 
+	(find_screen_neighbor), (handle_move_to_screen): Functions 
+	to move between screens in tabpopup and to switch to the screen 
+	selected by user.
+	* src/metacity.schemas.in: Add gconf keys switch_screen and 
+	switch_screen_backward.
+	* src/prefs.c: Add the keys to switch screen to screen_binding 
+	table.
+	* src/prefs.h: Define the keybinding and keybinding action for 
+	switch screen.
+	* src/screen.[ch] (meta_screen_ensure_screen_popup) :
+	Create the tabpopup for screen switching.
+	* src/common.h: Add enum for screen switching.
+
+	Fixes bug #101659.
+	
 2005-06-02  Elijah Newren  <newren@gmail.com>
 
 	* src/window.c (meta_window_configure_request): If a window
 	requests to be raised and is denied, set the demands attention
 	hint.  Fixes #305882.
Index: src/common.h
===================================================================
RCS file: /cvs/gnome/metacity/src/common.h,v
retrieving revision 1.34
diff -p -u -5 -r1.34 common.h
--- src/common.h	21 Jun 2004 16:47:27 -0000	1.34
+++ src/common.h	10 Jun 2005 11:55:49 -0000
@@ -114,10 +114,11 @@ typedef enum
   /* Alt+Esc */
   META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL,
   META_GRAB_OP_KEYBOARD_ESCAPING_DOCK,
   
   META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
+  META_GRAB_OP_KEYBOARD_SCREEN_SWITCHING,
   
   /* Frame button ops */
   META_GRAB_OP_CLICKING_MINIMIZE,
   META_GRAB_OP_CLICKING_MAXIMIZE,
   META_GRAB_OP_CLICKING_UNMAXIMIZE,
Index: src/display.c
===================================================================
RCS file: /cvs/gnome/metacity/src/display.c,v
retrieving revision 1.257
diff -p -u -5 -r1.257 display.c
--- src/display.c	26 May 2005 19:58:17 -0000	1.257
+++ src/display.c	10 Jun 2005 11:55:52 -0000
@@ -1065,10 +1065,11 @@ grab_op_is_keyboard (MetaGrabOp op)
     case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
     case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
     case META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL:
     case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
     case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
+    case META_GRAB_OP_KEYBOARD_SCREEN_SWITCHING:
       return TRUE;
       break;
 
     default:
       return FALSE;
@@ -3359,10 +3360,14 @@ meta_display_begin_grab_op (MetaDisplay 
       
     case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
       meta_screen_ensure_workspace_popup (screen);
       break;
 
+    case META_GRAB_OP_KEYBOARD_SCREEN_SWITCHING:
+      meta_screen_ensure_screen_popup (screen);
+      break;
+
     default:
       break;
     }
 
   if (display->grab_window)
@@ -3392,11 +3397,12 @@ meta_display_end_grab_op (MetaDisplay *d
 
   if (display->grab_window != NULL)
     display->grab_window->shaken_loose = FALSE;
   
   if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op) ||
-      display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING)
+      display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING ||
+      display->grab_op == META_GRAB_OP_KEYBOARD_SCREEN_SWITCHING)
     {
       meta_ui_tab_popup_free (display->grab_screen->tab_popup);
       display->grab_screen->tab_popup = NULL;
 
       /* If the ungrab here causes an EnterNotify, ignore it for
Index: src/keybindings.c
===================================================================
RCS file: /cvs/gnome/metacity/src/keybindings.c,v
retrieving revision 1.111
diff -p -u -5 -r1.111 keybindings.c
--- src/keybindings.c	26 May 2005 19:58:17 -0000	1.111
+++ src/keybindings.c	10 Jun 2005 11:55:54 -0000
@@ -46,10 +46,14 @@ typedef void (* MetaKeyHandlerFunc) (Met
                                      MetaScreen     *screen,
                                      MetaWindow     *window,
                                      XEvent         *event,
                                      MetaKeyBinding *binding);
 
+static int find_screen_neighbor (MetaDisplay    *display,
+                                 MetaScreen     *screen,
+                                 int             backward);
+
 static void handle_activate_workspace (MetaDisplay    *display,
                                        MetaScreen     *screen,
                                        MetaWindow     *window,
                                        XEvent         *event,
                                        MetaKeyBinding *binding);
@@ -86,10 +90,15 @@ static void handle_toggle_fullscreen  (M
 static void handle_toggle_desktop     (MetaDisplay    *display,
                                        MetaScreen     *screen,
                                        MetaWindow     *window,
                                        XEvent         *event,
                                        MetaKeyBinding *binding);
+static void handle_move_to_screen     (MetaDisplay    *display,
+                                       MetaScreen     *screen,
+                                       MetaWindow     *window,
+                                       XEvent         *event,
+                                       MetaKeyBinding *binding);
 static void handle_panel_keybinding   (MetaDisplay    *display,
                                        MetaScreen     *screen,
                                        MetaWindow     *window,
                                        XEvent         *event,
                                        MetaKeyBinding *binding);
@@ -215,10 +224,15 @@ static gboolean process_tab_grab        
 static gboolean process_workspace_switch_grab (MetaDisplay *display,
                                                MetaScreen  *screen,
                                                XEvent      *event,
                                                KeySym       keysym);
 
+static gboolean process_screen_switch_grab (MetaDisplay *display,
+                                            MetaScreen  *screen,
+                                            XEvent      *event,
+                                            KeySym       keysym);
+
 static void regrab_screen_bindings         (MetaDisplay *display);
 static void regrab_window_bindings         (MetaDisplay *display);
 
 typedef struct
 {
@@ -286,10 +300,14 @@ static const MetaKeyHandler screen_handl
     GINT_TO_POINTER (META_TAB_LIST_DOCKS) },  
   { META_KEYBINDING_CYCLE_PANELS_BACKWARD, handle_cycle_backward,
     GINT_TO_POINTER (META_TAB_LIST_DOCKS) },  
   { META_KEYBINDING_SHOW_DESKTOP, handle_toggle_desktop,
     NULL },
+  { META_KEYBINDING_SWITCH_SCREEN, handle_move_to_screen,
+    GINT_TO_POINTER (0) },
+  { META_KEYBINDING_SWITCH_SCREEN_BACKWARD, handle_move_to_screen,
+    GINT_TO_POINTER (1) },
   { META_KEYBINDING_PANEL_MAIN_MENU, handle_panel_keybinding,
     GINT_TO_POINTER (META_KEYBINDING_ACTION_PANEL_MAIN_MENU) },
   { META_KEYBINDING_PANEL_RUN_DIALOG, handle_panel_keybinding,
     GINT_TO_POINTER (META_KEYBINDING_ACTION_PANEL_RUN_DIALOG) },
   { META_KEYBINDING_COMMAND_1, handle_run_command,
@@ -663,10 +681,22 @@ rebuild_binding_table (MetaDisplay      
   dest = 0;
   while (src < n_prefs)
     {
       if (prefs[src].keysym != None)
         {
+          if (!strcmp (prefs[src].name, META_KEYBINDING_SWITCH_SCREEN) ||
+              !strcmp (prefs[src].name, META_KEYBINDING_SWITCH_SCREEN_BACKWARD))
+            {
+              if (ScreenCount (display->xdisplay) <= 1)
+                {
+                  meta_topic (META_DEBUG_KEYBINDINGS,
+                              "Multihead setup not found. Not binding switch screen key.\n");
+                  ++src;
+                  continue;
+                }
+            }
+
           (*bindings_p)[dest].name = prefs[src].name;
           (*bindings_p)[dest].keysym = prefs[src].keysym;
           (*bindings_p)[dest].modifiers = prefs[src].modifiers;
           (*bindings_p)[dest].mask = 0;
           (*bindings_p)[dest].keycode = 0;          
@@ -692,12 +722,10 @@ rebuild_binding_table (MetaDisplay      
         }
       
       ++src;
     }
 
-  g_assert (dest == n_bindings);
-  
   *n_bindings_p = dest;
 
   meta_topic (META_DEBUG_KEYBINDINGS,
               " %d bindings in table\n",
               *n_bindings_p);
@@ -1661,10 +1689,16 @@ meta_display_process_key_event (MetaDisp
           meta_topic (META_DEBUG_KEYBINDINGS,
                       "Processing event for keyboard workspace switching\n");
           handled = process_workspace_switch_grab (display, screen, event, keysym);
           break;
 
+        case META_GRAB_OP_KEYBOARD_SCREEN_SWITCHING:
+          meta_topic (META_DEBUG_KEYBINDINGS,
+                      "Processing event for keyboard screen switching\n");
+          handled = process_screen_switch_grab (display, screen, event, keysym);
+          break;
+
         default:
           break;
         }
     }
   
@@ -2801,10 +2835,123 @@ process_workspace_switch_grab (MetaDispl
     (MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->tab_popup);
   meta_workspace_focus_default_window (workspace, NULL, event->xkey.time);
   return FALSE;
 }
 
+static gboolean
+process_screen_switch_grab (MetaDisplay *display,
+                            MetaScreen  *screen,
+                            XEvent      *event,
+                            KeySym       keysym)
+{
+  MetaKeyBindingAction action;
+  gboolean backward;
+  gboolean key_used;
+
+  if (screen != display->grab_screen)
+    return FALSE;
+
+  g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
+
+  if (event->type == KeyRelease &&
+      keycode_is_primary_modifier (display, event->xkey.keycode,
+                                   display->grab_mask))
+    {
+      MetaScreen *target_screen;
+
+      target_screen = (MetaScreen *) meta_ui_tab_popup_get_selected (screen->tab_popup);  
+
+      meta_topic (META_DEBUG_KEYBINDINGS,
+                  "Ending screen tab operation, primary modifier released\n");
+
+      if (target_screen)
+        {
+          meta_topic (META_DEBUG_KEYBINDINGS,
+                      "Ending grab early so we can focus the target screen\n");
+          meta_display_end_grab_op (display, event->xkey.time);
+
+          meta_topic (META_DEBUG_KEYBINDINGS,
+                      "Activating target screen\n");
+
+          meta_workspace_focus_default_window (target_screen->active_workspace,
+                                               NULL,
+                                               event->xkey.time);
+
+          return TRUE; /* we already ended the grab */
+        }
+
+      return FALSE; /* end grab */
+    }
+
+  /* don't care about other releases, but eat them, don't end grab */
+  if (event->type == KeyRelease)
+    return TRUE;
+
+  /* don't end grab on modifier key presses */
+  if (is_modifier (display, event->xkey.keycode))
+    return TRUE;
+
+  action = display_get_keybinding_action (display,
+                                          keysym,
+                                          display->grab_mask);
+
+  backward = FALSE;
+  key_used = FALSE;
+
+  switch (action)
+    {
+    case META_KEYBINDING_ACTION_SWITCH_SCREEN:
+      backward = FALSE;
+      key_used = TRUE;
+      break;
+    case META_KEYBINDING_ACTION_SWITCH_SCREEN_BACKWARD:
+      backward = TRUE;
+      key_used = TRUE;
+      break;
+    default:
+      break;
+    }
+	 
+  if (key_used)
+    {
+      MetaScreen *target_screen;
+
+      meta_topic (META_DEBUG_KEYBINDINGS,
+                  "Key pressed, moving tab focus in popup\n");
+
+      if (event->xkey.state & ShiftMask)
+        backward = !backward;
+
+      if (backward)
+        meta_ui_tab_popup_backward (screen->tab_popup);
+      else
+        meta_ui_tab_popup_forward (screen->tab_popup);
+
+      target_screen = (MetaScreen *) meta_ui_tab_popup_get_selected (screen->tab_popup);
+
+      if (target_screen)
+        {
+          meta_topic (META_DEBUG_KEYBINDINGS,
+                      "Tab key pressed, moving tab focus in popup\n");
+
+          meta_topic (META_DEBUG_KEYBINDINGS,
+                      "Activating target screen\n");
+
+          meta_workspace_focus_default_window (target_screen->active_workspace,
+                                               NULL,
+                                               event->xkey.time);
+        }
+    }
+  else
+    {
+      /* end grab */
+      meta_topic (META_DEBUG_KEYBINDINGS,
+                  "Ending screen tabbing, uninteresting key pressed\n");
+    }
+  return key_used;
+}
+
 static void
 handle_toggle_desktop (MetaDisplay    *display,
                        MetaScreen     *screen,
                        MetaWindow     *window,
                        XEvent         *event,
@@ -2817,10 +2964,105 @@ handle_toggle_desktop (MetaDisplay    *d
                                            NULL,
                                            event->xkey.time);
     }
   else
     meta_screen_show_desktop (screen, event->xkey.time);
+}
+
+static int
+find_screen_neighbor (MetaDisplay    *display,
+                      MetaScreen     *screen,
+                      int             backward)
+{
+  unsigned int ind;
+
+  ind  = g_slist_index (display->screens, screen);
+
+  if (backward)
+    {
+      if (ind == (g_slist_length (display->screens) - 1))
+        ind = 0;
+      else
+	ind++;
+    }
+  else
+    {
+      if (!ind)
+        ind =  g_slist_length (display->screens) - 1;
+      else
+        ind--;
+    }
+  
+  return (ind);
+}
+
+static void
+handle_move_to_screen (MetaDisplay    *display,
+                       MetaScreen     *screen,
+                       MetaWindow     *window,
+                       XEvent         *event,
+                       MetaKeyBinding *binding)
+{
+  int backward;
+  unsigned int grab_mask;
+
+  backward = GPOINTER_TO_INT (binding->handler->data);
+
+  /* reverse direction if shift is down */
+  if (event->xkey.state & ShiftMask)
+    backward = !backward;
+
+  meta_topic (META_DEBUG_KEYBINDINGS,
+              "Starting tab between screen, showing popup\n");
+
+  grab_mask = event->xkey.state & ~(display->ignored_modifier_mask);
+
+  if (meta_display_begin_grab_op (display,
+                                  screen,
+                                  NULL,
+                                  META_GRAB_OP_KEYBOARD_SCREEN_SWITCHING,
+                                  FALSE,
+                                  event->xkey.serial,
+                                  0,
+                                  grab_mask,
+                                  event->xkey.time,
+                                  0, 0))
+    {
+      MetaScreen *target_screen;
+      gboolean grabbed_before_release;
+      int ind;
+
+      ind = find_screen_neighbor (display, screen, backward);
+      target_screen = (MetaScreen *) g_slist_nth_data (display->screens, ind);
+
+      grabbed_before_release = primary_modifier_still_pressed (display, grab_mask);
+
+      meta_topic (META_DEBUG_KEYBINDINGS,
+                  "Activating target screen\n");
+
+      if (!grabbed_before_release)
+        {
+          /* end the grab right away, modifier possibly released
+           * before we could establish the grab and receive the
+           * release event. Must end grab before we can switch
+           * spaces.
+           */
+          meta_display_end_grab_op (display, event->xkey.time);
+        }
+
+      meta_workspace_focus_default_window (target_screen->active_workspace,
+                                           NULL,
+                                           event->xkey.time);
+
+      if (grabbed_before_release)
+        {
+          meta_ui_tab_popup_select (screen->tab_popup, (MetaTabEntryKey) target_screen);
+
+          /* only after selecting proper space */
+          meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
+        }
+    }
 }
 
 static void
 handle_panel_keybinding (MetaDisplay    *display,
                          MetaScreen     *screen,
Index: src/metacity.schemas.in
===================================================================
RCS file: /cvs/gnome/metacity/src/metacity.schemas.in,v
retrieving revision 1.42
diff -p -u -5 -r1.42 metacity.schemas.in
--- src/metacity.schemas.in	5 Feb 2005 03:57:41 -0000	1.42
+++ src/metacity.schemas.in	10 Jun 2005 11:55:56 -0000
@@ -1253,10 +1253,59 @@ you set
          </long>
       </locale>
     </schema>
 
     <schema>
+      <key>/schemas/apps/metacity/global_keybindings/switch_screen</key>
+      <applyto>/apps/metacity/global_keybindings/switch_screen</applyto>
+      <owner>metacity</owner>
+      <type>string</type>
+      <default>&lt;Control&gt;&lt;Alt&gt;s</default>
+      <locale name="C">
+         <short>Move between screens</short>
+         <long>
+          The keybinding used to move between screens in multihead setup.
+
+          The format looks like "&lt;Control&gt;a" or
+          "&lt;Shift&gt;&lt;Alt&gt;F1.
+
+          The parser is fairly liberal and allows lower or upper case,
+          and also abbreviations such as "&lt;Ctl&gt;" and
+          "&lt;Ctrl&gt;". If you set the option to the special string
+          "disabled", then there will be no keybinding for this
+          action.
+
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/metacity/global_keybindings/switch_screen_backward</key>
+      <applyto>/apps/metacity/global_keybindings/switch_screen_backward</applyto>
+      <owner>metacity</owner>
+      <type>string</type>
+      <default>disabled</default>
+      <locale name="C">
+         <short>Move between screens - backwards</short>
+         <long>
+          The keybinding used to move between screens in multihead setup in 
+	  backward direction.
+
+          The format looks like "&lt;Control&gt;a" or
+          "&lt;Shift&gt;&lt;Alt&gt;F1.
+
+          The parser is fairly liberal and allows lower or upper case,
+          and also abbreviations such as "&lt;Ctl&gt;" and
+          "&lt;Ctrl&gt;". If you set the option to the special string
+          "disabled", then there will be no keybinding for this
+          action.
+
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/metacity/global_keybindings/switch_to_workspace_1</key>
       <applyto>/apps/metacity/global_keybindings/switch_to_workspace_1</applyto>
       <owner>metacity</owner>
       <type>string</type>
       <default>disabled</default>
Index: src/prefs.c
===================================================================
RCS file: /cvs/gnome/metacity/src/prefs.c,v
retrieving revision 1.50
diff -p -u -5 -r1.50 prefs.c
--- src/prefs.c	26 Jan 2005 08:43:38 -0000	1.50
+++ src/prefs.c	10 Jun 2005 11:55:57 -0000
@@ -1509,10 +1509,12 @@ static MetaKeyPref screen_bindings[] = {
   { META_KEYBINDING_CYCLE_WINDOWS, 0, 0, TRUE },
   { META_KEYBINDING_CYCLE_WINDOWS_BACKWARD, 0, 0, TRUE },
   { META_KEYBINDING_CYCLE_PANELS, 0, 0, TRUE },
   { META_KEYBINDING_CYCLE_PANELS_BACKWARD, 0, 0, TRUE },
   { META_KEYBINDING_SHOW_DESKTOP, 0, 0, FALSE },
+  { META_KEYBINDING_SWITCH_SCREEN, 0, 0, TRUE },
+  { META_KEYBINDING_SWITCH_SCREEN_BACKWARD, 0, 0, TRUE },
   { META_KEYBINDING_PANEL_MAIN_MENU, 0, 0, FALSE },
   { META_KEYBINDING_PANEL_RUN_DIALOG, 0, 0, FALSE },
   { META_KEYBINDING_COMMAND_1, 0, 0, FALSE },
   { META_KEYBINDING_COMMAND_2, 0, 0, FALSE },
   { META_KEYBINDING_COMMAND_3, 0, 0, FALSE },
Index: src/prefs.h
===================================================================
RCS file: /cvs/gnome/metacity/src/prefs.h,v
retrieving revision 1.36
diff -p -u -5 -r1.36 prefs.h
--- src/prefs.h	26 Jan 2005 08:43:38 -0000	1.36
+++ src/prefs.h	10 Jun 2005 11:55:57 -0000
@@ -115,10 +115,12 @@ void        meta_prefs_change_workspace_
 #define META_KEYBINDING_CYCLE_WINDOWS            "cycle_windows"
 #define META_KEYBINDING_CYCLE_WINDOWS_BACKWARD   "cycle_windows_backward"
 #define META_KEYBINDING_CYCLE_PANELS             "cycle_panels"
 #define META_KEYBINDING_CYCLE_PANELS_BACKWARD    "cycle_panels_backward"
 #define META_KEYBINDING_SHOW_DESKTOP             "show_desktop"
+#define META_KEYBINDING_SWITCH_SCREEN            "switch_screen"
+#define META_KEYBINDING_SWITCH_SCREEN_BACKWARD   "switch_screen_backward"
 #define META_KEYBINDING_PANEL_MAIN_MENU          "panel_main_menu"
 #define META_KEYBINDING_PANEL_RUN_DIALOG         "panel_run_dialog"
 #define META_KEYBINDING_COMMAND_1                "run_command_1"
 #define META_KEYBINDING_COMMAND_2                "run_command_2"
 #define META_KEYBINDING_COMMAND_3                "run_command_3"
@@ -216,10 +218,12 @@ typedef enum _MetaKeyBindingAction
   META_KEYBINDING_ACTION_CYCLE_WINDOWS,
   META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD,
   META_KEYBINDING_ACTION_CYCLE_PANELS,
   META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD,
   META_KEYBINDING_ACTION_SHOW_DESKTOP,
+  META_KEYBINDING_ACTION_SWITCH_SCREEN,
+  META_KEYBINDING_ACTION_SWITCH_SCREEN_BACKWARD,
   META_KEYBINDING_ACTION_PANEL_MAIN_MENU,
   META_KEYBINDING_ACTION_PANEL_RUN_DIALOG,
   META_KEYBINDING_ACTION_COMMAND_1,
   META_KEYBINDING_ACTION_COMMAND_2,
   META_KEYBINDING_ACTION_COMMAND_3,
Index: src/screen.c
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.c,v
retrieving revision 1.138
diff -p -u -5 -r1.138 screen.c
--- src/screen.c	30 May 2005 20:15:26 -0000	1.138
+++ src/screen.c	10 Jun 2005 11:55:59 -0000
@@ -45,10 +45,11 @@
 
 #include <X11/Xatom.h>
 #include <locale.h>
 #include <string.h>
 #include <stdio.h>
+#include <gtk/gtkicontheme.h>
 
 static char* get_screen_name (MetaDisplay *display,
                               int          number);
 
 static void update_num_workspaces  (MetaScreen *screen);
@@ -1297,10 +1298,64 @@ meta_screen_ensure_workspace_popup (Meta
 
   g_free (entries);
   meta_screen_free_workspace_layout (&layout);
 
   /* don't show tab popup, since proper space isn't selected yet */
+}
+
+void
+meta_screen_ensure_screen_popup (MetaScreen *screen)
+{
+  MetaTabEntry *entries;
+  MetaDisplay *display;
+  MetaScreen *srn;
+  GSList *tmp;
+  GdkPixbuf *pixbuf;
+  int len, i;
+  
+  if (screen->tab_popup) 
+    return ;
+
+  pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+                                     "gnome-monitor", 48, 0, NULL);
+
+  if (!pixbuf)
+    {
+      char *path;
+      path = g_strdup_printf (METACITY_DATADIR "/pixmaps/gnome-monitor.png");
+      pixbuf = gdk_pixbuf_new_from_file (path, NULL);
+      g_free(path);
+    }
+
+  display = screen->display;
+  
+  len = g_slist_length (display->screens);  
+ 
+  entries = g_new (MetaTabEntry, len + 1);
+  entries[len].key = NULL;
+  entries[len].title = NULL;
+  entries[len].icon = NULL;
+
+  for (tmp = display->screens, i = len - 1; tmp; tmp = tmp->next, i--)
+    {
+      srn = (MetaScreen *) tmp->data;
+
+      entries[i].key = (MetaTabEntryKey) srn;
+      entries[i].title = g_strdup (srn->screen_name);
+      entries[i].icon = pixbuf;
+      entries[i].blank = FALSE;
+ 
+      g_assert (entries[i].title != NULL);
+    } 
+
+  screen->tab_popup = meta_ui_tab_popup_new (entries,
+                                             screen->number,
+                                             len,
+                                             5,
+                                             TRUE);
+
+  g_free (entries);
 }
 
 MetaWindow*
 meta_screen_get_mouse_window (MetaScreen  *screen,
                               MetaWindow  *not_this_one)
Index: src/screen.h
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.h,v
retrieving revision 1.59
diff -p -u -5 -r1.59 screen.h
--- src/screen.h	20 Dec 2004 02:46:42 -0000	1.59
+++ src/screen.h	10 Jun 2005 11:55:59 -0000
@@ -145,10 +145,12 @@ void          meta_screen_set_cursor    
 void          meta_screen_ensure_tab_popup    (MetaScreen                 *screen,
                                                MetaTabList                 type);
 
 void          meta_screen_ensure_workspace_popup (MetaScreen *screen);
 
+void          meta_screen_ensure_screen_popup (MetaScreen *screen);
+
 MetaWindow*   meta_screen_get_mouse_window     (MetaScreen                 *screen,
                                                 MetaWindow                 *not_this_one);
 
 const MetaXineramaScreenInfo* meta_screen_get_current_xinerama    (MetaScreen    *screen);
 const MetaXineramaScreenInfo* meta_screen_get_xinerama_for_rect   (MetaScreen    *screen,
