Index: src/display.c
===================================================================
RCS file: /cvs/gnome/metacity/src/display.c,v
retrieving revision 1.237
diff -u -r1.237 display.c
--- src/display.c	25 Oct 2004 16:17:19 -0000	1.237
+++ src/display.c	1 Nov 2004 22:26:43 -0000
@@ -289,7 +289,8 @@
     "_NET_RESTACK_WINDOW",
     "_NET_MOVERESIZE_WINDOW",
     "_NET_DESKTOP_GEOMETRY",
-    "_NET_DESKTOP_VIEWPORT"
+    "_NET_DESKTOP_VIEWPORT",
+    "_NET_WM_GEOMETRY_SAVE_ID"
   };
   Atom atoms[G_N_ELEMENTS(atom_names)];
   
@@ -444,6 +445,7 @@
   display->atom_net_moveresize_window = atoms[88];
   display->atom_net_desktop_geometry = atoms[89];
   display->atom_net_desktop_viewport = atoms[90];
+  display->atom_net_wm_geometry_save_id = atoms[91];
 
   display->prop_hooks = NULL;
   meta_display_init_window_prop_hooks (display);
Index: src/display.h
===================================================================
RCS file: /cvs/gnome/metacity/src/display.h,v
retrieving revision 1.125
diff -u -r1.125 display.h
--- src/display.h	4 Oct 2004 21:09:08 -0000	1.125
+++ src/display.h	1 Nov 2004 22:26:44 -0000
@@ -182,6 +182,7 @@
   Atom atom_net_moveresize_window;
   Atom atom_net_desktop_geometry;
   Atom atom_net_desktop_viewport;
+  Atom atom_net_wm_geometry_save_id;
 
   /* This is the actual window from focus events,
    * not the one we last set
Index: src/screen.c
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.c,v
retrieving revision 1.132
diff -u -r1.132 screen.c
--- src/screen.c	22 Oct 2004 20:28:36 -0000	1.132
+++ src/screen.c	1 Nov 2004 22:26:44 -0000
@@ -85,7 +85,7 @@
 static int
 set_supported_hint (MetaScreen *screen)
 {
-#define N_SUPPORTED 58
+#define N_SUPPORTED 59
   Atom atoms[N_SUPPORTED];
   
   atoms[0] = screen->display->atom_net_wm_name;
@@ -146,8 +146,9 @@
   atoms[55] = screen->display->atom_net_wm_state_demands_attention;
   atoms[56] = screen->display->atom_net_desktop_geometry;
   atoms[57] = screen->display->atom_net_desktop_viewport;
-  //atoms[58] = screen->display->atom_net_restack_window;
-  //atoms[59] = screen->display->atom_net_moveresize_window;
+  atoms[58] = screen->display->atom_net_wm_geometry_save_id;
+  //atoms[59] = screen->display->atom_net_restack_window;
+  //atoms[60] = screen->display->atom_net_moveresize_window;
   
   XChangeProperty (screen->display->xdisplay, screen->xroot,
                    screen->display->atom_net_supported,
Index: src/xprops.c
===================================================================
RCS file: /cvs/gnome/metacity/src/xprops.c,v
retrieving revision 1.21
diff -u -r1.21 xprops.c
--- src/xprops.c	19 Jun 2004 00:45:24 -0000	1.21
+++ src/xprops.c	1 Nov 2004 22:26:46 -0000
@@ -201,7 +201,10 @@
       results->type == None)
     {
       if (results->prop)
+	{
         XFree (results->prop);
+	  results->prop = NULL;
+	}
       meta_error_trap_pop_with_return (display, TRUE);
       return FALSE;
     }
@@ -209,7 +212,10 @@
   if (meta_error_trap_pop_with_return (display, TRUE) != Success)
     {
       if (results->prop)
+	{
         XFree (results->prop);
+	  results->prop = NULL;
+	}
       return FALSE;
     }
 
@@ -328,6 +334,38 @@
       results->prop = NULL;
     }
   
+  return TRUE;
+}
+
+gboolean
+meta_prop_get_save_id (MetaDisplay   *display,
+		       Window         xwindow,
+		       Atom           xatom,
+		       char         **save_id)
+{
+  GetPropertyResults results;
+
+  if (!get_property (display, xwindow, xatom, AnyPropertyType,
+		     &results))
+    {
+      meta_verbose ("History Geometry Save ID wasn't set on this window.\n");
+      return FALSE;
+    }
+  if (results.type == None || results.n_items <= 0)
+    {
+      meta_verbose ("History Geometry Save ID was set to NULL.  We need to forget this window's state.\n");
+      *save_id = NULL;
+      if (results.prop)
+	{
+	  XFree (results.prop);
+	  results.prop = NULL;
+	}
+      return TRUE;
+    }
+
+  *save_id = g_strdup (results.prop);
+  XFree (results.prop);
+
   return TRUE;
 }
 
Index: src/xprops.h
===================================================================
RCS file: /cvs/gnome/metacity/src/xprops.h,v
retrieving revision 1.10
diff -u -r1.10 xprops.h
--- src/xprops.h	19 Jun 2004 00:45:24 -0000	1.10
+++ src/xprops.h	1 Nov 2004 22:26:46 -0000
@@ -77,6 +77,10 @@
                                       Window         xwindow,
                                       Atom           xatom,
                                       MotifWmHints **hints_p);
+gboolean meta_prop_get_save_id       (MetaDisplay   *display,
+                                      Window         xwindow,
+                                      Atom           xatom,
+				      char         **save_id);
 gboolean meta_prop_get_cardinal_list (MetaDisplay   *display,
                                       Window         xwindow,
                                       Atom           xatom,
