I backported the patch (see attachment) from Bugzilla 461927 to the
metacity version in sid, and it does _not_ fix the problem of Emacs
resizing itself to full screensize after toggling maximization.

-- 
If animal trapped call 410-844-6286
--- src/window.c.~1~	2008-02-20 17:48:28.000000000 +0100
+++ src/window.c	2008-02-20 17:52:15.000000000 +0100
@@ -75,6 +75,7 @@
 static void     meta_window_hide          (MetaWindow     *window);
 
 static void     meta_window_save_rect         (MetaWindow    *window);
+static void     meta_window_save_user_rect    (MetaWindow    *window);
 
 static void meta_window_move_resize_internal (MetaWindow         *window,
                                               MetaMoveResizeFlags flags,
@@ -2387,6 +2388,29 @@
     }
 }
 
+static void
+meta_window_save_user_rect (MetaWindow *window)
+{
+  if (!(META_WINDOW_MAXIMIZED (window) || window->fullscreen))
+    {
+      MetaRectangle user_rect;
+
+      meta_window_get_client_root_coords (window, &user_rect);
+
+      if (!window->maximized_horizontally)
+	{
+	  window->user_rect.x     = user_rect.x;
+	  window->user_rect.width = user_rect.width;
+	}
+
+      if (!window->maximized_vertically)
+	{
+	  window->user_rect.y      = user_rect.y;
+	  window->user_rect.height = user_rect.height;
+	}
+    }
+}
+
 void
 meta_window_maximize_internal (MetaWindow        *window,
                                MetaMaximizeFlags  directions,
@@ -3459,10 +3483,12 @@
 
   /* user_rect is the position to restore towards if strut changes occur.  Thus
    * we want user_rect to reflect user position/size changes OR the initial
-   * placement of the window.
+   * placement of the window.  We do not save maximized or fullscreen
+   * dimensions, otherwise the window may snap back to those dimensions
+   * (Bug #461927).
    */
   if (is_user_action || !window->placed)
-    meta_window_get_client_root_coords (window, &window->user_rect);
+    meta_window_save_user_rect (window);
 
   if (need_move_frame || need_resize_frame ||
       need_move_client || need_resize_client)
@@ -4507,6 +4533,7 @@
    * See also bug 426519.
    */
   meta_window_get_client_root_coords (window, &window->user_rect);
+  meta_window_save_user_rect (window);
 }
 
 gboolean

Reply via email to