Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/metacity/ChangeLog,v
retrieving revision 1.465
diff -u -p -r1.465 ChangeLog
--- ChangeLog	30 Sep 2002 13:58:56 -0000	1.465
+++ ChangeLog	1 Oct 2002 05:50:37 -0000
@@ -1,3 +1,13 @@
+2002-10-01  Mark McLoughlin  <mark@skynet.ie>
+
+	* src/screen.c: (meta_screen_new): default to
+	topleft starting corner.
+	(meta_screen_update_workspace_layout): handle
+	new property format : orient,x,y,starting corner.
+	Fixes #89373.
+
+	* src/screen.h: add MetaScreenCorner enum.
+
 2002-09-30  Havoc Pennington  <hp@pobox.com>
 
 	* src/screen.c (reload_xinerama_infos): fix compilation on
Index: src/screen.c
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.c,v
retrieving revision 1.83
diff -u -p -r1.83 screen.c
--- src/screen.c	30 Sep 2002 13:58:56 -0000	1.83
+++ src/screen.c	1 Oct 2002 05:50:41 -0000
@@ -524,6 +524,7 @@ meta_screen_new (MetaDisplay *display,
   screen->rows_of_workspaces = 1;
   screen->columns_of_workspaces = -1;
   screen->vertical_workspaces = FALSE;
+  screen->starting_corner = META_SCREEN_TOPLEFT;
 
   screen->xinerama_infos = NULL;
   screen->n_xinerama_infos = 0;
@@ -1059,6 +1060,8 @@ meta_screen_ensure_workspace_popup (Meta
   
   meta_screen_calc_workspace_layout (screen, len, &rows, &cols);
 
+  /* FIXME: handle screen->starting_corner
+   */
   if (screen->vertical_workspaces)
     {
       int j, k, iter;
@@ -1242,6 +1245,11 @@ meta_screen_get_current_xinerama (MetaSc
 #define _NET_WM_ORIENTATION_HORZ 0
 #define _NET_WM_ORIENTATION_VERT 1
 
+#define _NET_WM_TOPLEFT     0
+#define _NET_WM_TOPRIGHT    1
+#define _NET_WM_BOTTOMRIGHT 2
+#define _NET_WM_BOTTOMLEFT  3
+
 void
 meta_screen_update_workspace_layout (MetaScreen *screen)
 {
@@ -1256,7 +1264,7 @@ meta_screen_update_workspace_layout (Met
                                    screen->display->atom_net_desktop_layout,
                                    &list, &n_items))
     {
-      if (n_items == 3)
+      if (n_items == 3 || n_items == 4)
         {
           int cols, rows;
           
@@ -1273,8 +1281,8 @@ meta_screen_update_workspace_layout (Met
               break;
             }
 
-          rows = list[1];
-          cols = list[2];
+          cols = list[1];
+          rows = list[2];
 
           if (rows <= 0 && cols <= 0)
             {
@@ -1292,20 +1300,43 @@ meta_screen_update_workspace_layout (Met
               else
                 screen->columns_of_workspaces = -1;
             }
+
+          if (n_items == 4)
+            {
+              switch (list[3])
+                {
+                  case _NET_WM_TOPLEFT:
+                    screen->starting_corner = META_SCREEN_TOPLEFT;
+                    break;
+                  case _NET_WM_TOPRIGHT:
+                    screen->starting_corner = META_SCREEN_TOPRIGHT;
+                    break;
+                  case _NET_WM_BOTTOMRIGHT:
+                    screen->starting_corner = META_SCREEN_BOTTOMRIGHT;
+                    break;
+                  case _NET_WM_BOTTOMLEFT:
+                    screen->starting_corner = META_SCREEN_BOTTOMLEFT;
+                    break;
+                  default:
+                    meta_warning ("Someone set a weird starting corner in _NET_DESKTOP_LAYOUT\n");
+                    break;
+                }
+            }
         }
       else
         {
-          meta_warning ("Someone set _NET_DESKTOP_LAYOUT to %d integers instead of 3\n",
-                        n_items);
+          meta_warning ("Someone set _NET_DESKTOP_LAYOUT to %d integers instead of 4 "
+                        "(3 is accepted for backwards compat)\n", n_items);
         }
 
       meta_XFree (list);
     }
 
-  meta_verbose ("Workspace layout rows = %d cols = %d orientation = %d\n",
+  meta_verbose ("Workspace layout rows = %d cols = %d orientation = %d starting corner = %d\n",
                 screen->rows_of_workspaces,
                 screen->columns_of_workspaces,
-                screen->vertical_workspaces);
+                screen->vertical_workspaces,
+                screen->starting_corner);
 }
 
 void
@@ -1448,7 +1479,8 @@ meta_screen_calc_workspace_layout (MetaS
   int cols, rows;
 
   /*
-   * 3 rows, 4 columns, horizontal layout:
+   * 3 rows, 4 columns, horizontal layout
+   * and starting from top left:
    *  +--+--+--+--+
    *  | 1| 2| 3| 4|
    *  +--+--+--+--+
Index: src/screen.h
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.h,v
retrieving revision 1.37
diff -u -p -r1.37 screen.h
--- src/screen.h	29 Sep 2002 02:50:24 -0000	1.37
+++ src/screen.h	1 Oct 2002 05:50:41 -0000
@@ -40,6 +40,14 @@ struct _MetaXineramaScreenInfo
 typedef void (* MetaScreenWindowFunc) (MetaScreen *screen, MetaWindow *window,
                                        gpointer user_data);
 
+typedef enum
+{
+  META_SCREEN_TOPLEFT,
+  META_SCREEN_TOPRIGHT,
+  META_SCREEN_BOTTOMLEFT,
+  META_SCREEN_BOTTOMRIGHT
+} MetaScreenCorner;
+
 struct _MetaScreen
 {
   MetaDisplay *display;
@@ -74,6 +82,7 @@ struct _MetaScreen
 
   int rows_of_workspaces;
   int columns_of_workspaces;
+  MetaScreenCorner starting_corner;
   guint vertical_workspaces : 1;
   
   guint keys_grabbed : 1;
Index: src/workspace.c
===================================================================
RCS file: /cvs/gnome/metacity/src/workspace.c,v
retrieving revision 1.31
diff -u -p -r1.31 workspace.c
--- src/workspace.c	12 Sep 2002 20:46:03 -0000	1.31
+++ src/workspace.c	1 Oct 2002 05:50:42 -0000
@@ -458,6 +458,8 @@ meta_workspace_get_neighbor (MetaWorkspa
   
   /* FIXME someone who's better or more patient at math puzzles
    * should clean this up. ;-)
+   * This'll have to someone with mega patience 'cause you'll
+   * have to handle screen->starting_corner also.
    */
   if (workspace->screen->vertical_workspaces)
     {
