    
    This patch makes workspace navigation with the Win+{Up,Down,Left,Right}
    keys to wrap around at the boundaries of the workspace grid. I believe
    this is better than the current behaviour, because this considerably
    reduces the average number of keystrokes needed to reach another
    workspace, when browsing workspaces using the keyboard.
    
    For Metacity (CVS 2005-05-22).

    -- Pauli Virtanen <pauli.virtanen@hut.fi>

Index: src/workspace.c
===================================================================
RCS file: /cvs/gnome/metacity/src/workspace.c,v
retrieving revision 1.70
diff -u -p -r1.70 workspace.c
--- src/workspace.c	22 Feb 2005 02:11:25 -0000	1.70
+++ src/workspace.c	22 May 2005 11:44:48 -0000
@@ -757,14 +757,11 @@ meta_workspace_get_neighbor (MetaWorkspa
       break;
     }
 
-  if (layout.current_col < 0)
-    layout.current_col = 0;
-  if (layout.current_col >= layout.cols)
-    layout.current_col = layout.cols - 1;
-  if (layout.current_row < 0)
-    layout.current_row = 0;
-  if (layout.current_row >= layout.rows)
-    layout.current_row = layout.rows - 1;
+  /* Wrap around */
+  layout.current_col =
+      ((layout.current_col % layout.cols) + layout.cols) % layout.cols;
+  layout.current_row =
+      ((layout.current_row % layout.rows) + layout.rows) % layout.rows;
 
   i = layout.grid[layout.current_row * layout.cols + layout.current_col];
 
