Index: src/constraints.c
===================================================================
RCS file: /cvs/gnome/metacity/src/constraints.c,v
retrieving revision 1.32
diff -p -u -r1.32 constraints.c
--- src/constraints.c	8 Aug 2006 00:36:04 -0000	1.32
+++ src/constraints.c	20 Aug 2006 02:02:07 -0000
@@ -399,6 +399,23 @@ setup_constraint_info (ConstraintInfo   
     meta_workspace_get_onxinerama_region (cur_workspace, 
                                           xinerama_info->number);
 
+  /* Workaround braindead legacy apps that don't know how to
+   * fullscreen themselves properly.
+   */
+  if (meta_rectangle_equal (new, &xinerama_info->rect) &&
+      window->has_fullscreen_func &&
+      !window->fullscreen)
+    {
+      /*
+      meta_topic (META_DEBUG_GEOMETRY,
+      */
+      meta_warning (
+                  "Treating resize request of legacy application %s as a "
+                  "fullscreen request\n",
+                  window->desc);
+      meta_window_make_fullscreen_internal (window);
+    }
+
   /* Log all this information for debugging */
   meta_topic (META_DEBUG_GEOMETRY,
               "Setting up constraint info:\n"
@@ -1069,6 +1086,7 @@ constrain_fully_onscreen (MetaWindow    
    */
   if (window->type == META_WINDOW_DESKTOP ||
       window->type == META_WINDOW_DOCK    ||
+      window->fullscreen                  ||
       !window->require_fully_onscreen     || 
       info->is_user_action)
     return TRUE;
@@ -1110,6 +1128,7 @@ constrain_titlebar_visible (MetaWindow  
    */
   if (window->type == META_WINDOW_DESKTOP ||
       window->type == META_WINDOW_DOCK    ||
+      window->fullscreen                  ||
       !window->require_titlebar_visible   ||
       !window->decorated                  ||
       unconstrained_user_action)
Index: src/stack.c
===================================================================
RCS file: /cvs/gnome/metacity/src/stack.c,v
retrieving revision 1.81
diff -p -u -r1.81 stack.c
--- src/stack.c	13 Apr 2006 13:16:42 -0000	1.81
+++ src/stack.c	20 Aug 2006 02:02:08 -0000
@@ -197,42 +197,6 @@ meta_stack_thaw (MetaStack *stack)
 }
 
 static gboolean
-window_is_fullscreen_size (MetaWindow *window)
-{
-  int i;
-
-  if (meta_rectangle_could_fit_rect (&window->rect, &window->screen->rect))
-    {
-      /* we use the work area since windows that try to
-       * position at 0,0 will get pushed down by menu panel
-       */
-      MetaRectangle workarea;
-      
-      meta_window_get_work_area_current_xinerama (window, &workarea);
-      if (meta_rectangle_contains_rect (&window->rect, &workarea))
-        return TRUE;
-    }
-  
-  i = 0;
-  while (i < window->screen->n_xinerama_infos)
-    {
-      if (meta_rectangle_could_fit_rect (&window->rect,
-                                         &window->screen->xinerama_infos[i].rect))
-        {
-          MetaRectangle workarea;
-          
-          meta_window_get_work_area_current_xinerama (window, &workarea);
-          if (meta_rectangle_contains_rect (&window->rect, &workarea))
-            return TRUE;
-        }
-      
-      ++i;
-    }
-
-  return FALSE;
-}
-
-static gboolean
 is_focused_foreach (MetaWindow *window,
                     void       *data)
 {
@@ -283,7 +247,7 @@ get_standalone_layer (MetaWindow *window
 
       if (window->wm_state_below)
         layer = META_LAYER_BOTTOM;
-      else if ((window->fullscreen || window_is_fullscreen_size (window)) &&
+      else if (window->fullscreen &&
                (focused_transient ||
                 window == window->display->expected_focus_window ||
                 window->display->expected_focus_window == NULL ||
Index: src/window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.446
diff -p -u -r1.446 window.c
--- src/window.c	9 Aug 2006 18:32:30 -0000	1.446
+++ src/window.c	20 Aug 2006 02:02:08 -0000
@@ -701,6 +701,16 @@ meta_window_new_with_attrs (MetaDisplay 
   
   meta_window_update_struts (window);
 
+  /* Must add window to stack before doing move/resize, since the
+   * window might have fullscreen size (i.e. should have been
+   * fullscreen'd; acrobat is one such braindead case; it withdraws
+   * and remaps its window whenever trying to become fullscreen...)
+   * and thus constraints may try to auto-fullscreen it which also
+   * means restacking it.
+   */
+  meta_stack_add (window->screen->stack, 
+                  window);
+
   /* Put our state back where it should be,
    * passing TRUE for is_configure_request, ICCCM says
    * initial map is handled same as configure request
@@ -715,9 +725,6 @@ meta_window_new_with_attrs (MetaDisplay 
                                     window->size_hints.width,
                                     window->size_hints.height);
 
-  meta_stack_add (window->screen->stack, 
-                  window);
-
   /* Now try applying saved stuff from the session */
   {
     const MetaWindowSessionInfo *info;
@@ -2359,7 +2366,7 @@ meta_window_unmake_above (MetaWindow  *w
 }
 
 void
-meta_window_make_fullscreen (MetaWindow  *window)
+meta_window_make_fullscreen_internal (MetaWindow  *window)
 {
   if (!window->fullscreen)
     {
@@ -2379,12 +2386,20 @@ meta_window_make_fullscreen (MetaWindow 
       meta_window_raise (window);
       meta_stack_thaw (window->screen->stack);
       
+      recalc_window_features (window);
+      set_net_wm_state (window);
+    }
+}
+
+void
+meta_window_make_fullscreen (MetaWindow  *window)
+{
+  if (!window->fullscreen)
+    {
+      meta_window_make_fullscreen_internal (window);
       /* move_resize with new constraints
        */
       meta_window_queue_move_resize (window);
-
-      recalc_window_features (window);
-      set_net_wm_state (window);
     }
 }
 
Index: src/window.h
===================================================================
RCS file: /cvs/gnome/metacity/src/window.h,v
retrieving revision 1.131
diff -p -u -r1.131 window.h
--- src/window.h	7 Aug 2006 23:34:55 -0000	1.131
+++ src/window.h	20 Aug 2006 02:02:08 -0000
@@ -404,10 +404,10 @@ void        meta_window_unstick         
 
 void        meta_window_activate           (MetaWindow  *window,
                                             guint32      current_time);
-void        meta_window_activate_with_workspace (MetaWindow *window,
-                                            guint32          current_time,
-                                            MetaWorkspace   *workspace);   
-                                                                                    
+void        meta_window_activate_with_workspace  (MetaWindow    *window,
+                                                  guint32        current_time,
+                                                  MetaWorkspace *workspace);   
+void        meta_window_make_fullscreen_internal (MetaWindow    *window);
 void        meta_window_make_fullscreen    (MetaWindow  *window);
 void        meta_window_unmake_fullscreen  (MetaWindow  *window);
 
