diff --git a/src/Window.cc b/src/Window.cc
index 8e6b887..4ef83c3 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1251,7 +1251,8 @@ void FluxboxWindow::resize(unsigned int width, unsigned int height) {
 
 // send_event is just an override
 void FluxboxWindow::moveResize(int new_x, int new_y,
-                               unsigned int new_width, unsigned int new_height, bool send_event) {
+                               unsigned int new_width, unsigned int new_height,
+                               bool send_event, int fit) {
 
     // magic to detect if moved during initialisation
     if (!m_initialized)
@@ -1259,6 +1260,33 @@ void FluxboxWindow::moveResize(int new_x, int new_y,
 
     send_event = send_event || (frame().x() != new_x || frame().y() != new_y);
 
+    if (fit & MAX_VERT) {
+        new_height -= 2 * frame().window().borderWidth();
+        if (!screen().getMaxOverTabs()) {
+            new_y += yOffset();
+            new_height -= heightOffset();
+        }
+    }
+    if (fit & MAX_HORZ) {
+        new_width -= 2 * frame().window().borderWidth();
+        if (!screen().getMaxOverTabs()) {
+            new_x += xOffset();
+            new_width -= widthOffset();
+        }
+    }
+    if (fit & FIT_SIZEHINTS) {
+	m_last_resize_x = new_x; m_last_resize_y = new_y;
+	m_last_resize_w = new_width; m_last_resize_h = new_height;
+
+	ResizeDirection old_resize_corner = m_resize_corner;
+	m_resize_corner = NOCORNER;
+	fixsize(0, 0, true);
+	m_resize_corner = old_resize_corner;
+	
+	new_x = m_last_resize_x; new_y = m_last_resize_y;
+	new_width = m_last_resize_w; new_height = m_last_resize_h;
+    }
+
     if (new_width != frame().width() || new_height != frame().height()) {
         if ((((signed) frame().width()) + new_x) < 0)
             new_x = 0;
@@ -1632,6 +1660,7 @@ void FluxboxWindow::maximize(int type) {
         new_h = frame().height();
 
     int orig_max = maximized;
+    int fit = MAX_NONE;
 
     // These evaluate whether we need to TOGGLE the value for that field
     // Why? If maximize is only set to zero outside this,
@@ -1670,11 +1699,8 @@ void FluxboxWindow::maximize(int type) {
             m_old_pos_y  = new_y;
             m_old_height = new_h;
             new_y = screen().maxTop(head);
-            new_h = screen().maxBottom(head) - new_y - 2*frame().window().borderWidth();
-            if (!screen().getMaxOverTabs()) {
-                new_y += yOffset();
-                new_h -= heightOffset();
-            }
+            new_h = screen().maxBottom(head) - new_y;
+            fit |= MAX_VERT;
         }
         maximized ^= MAX_VERT;
     }
@@ -1693,28 +1719,17 @@ void FluxboxWindow::maximize(int type) {
             m_old_pos_x = new_x;
             m_old_width = new_w;
             new_x = screen().maxLeft(head);
-            new_w = screen().maxRight(head) - new_x - 2*frame().window().borderWidth();
-            if (!screen().getMaxOverTabs()) {
-                new_x += xOffset();
-                new_w -= widthOffset();
-            }
+            new_w = screen().maxRight(head) - new_x;
+            fit |= MAX_HORZ;
         }
         maximized ^= MAX_HORZ;
     }
 
     // ensure we apply the sizehints here, otherwise some
     // apps (eg xterm) end up a little bit .. crappy (visually)
-    m_last_resize_x = new_x;
-    m_last_resize_y = new_y;
-    m_last_resize_w = new_w;
-    m_last_resize_h = new_h;
-
-    ResizeDirection old_resize_corner = m_resize_corner;
-    m_resize_corner = NOCORNER;
-    fixsize(0, 0, true);
-    m_resize_corner = old_resize_corner;
+    fit |= FIT_SIZEHINTS;
 
-    moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h);
+    moveResize(new_x, new_y, new_w, new_h, false, fit);
 
     // notify listeners that we changed state
     stateSig().notify();
diff --git a/src/Window.hh b/src/Window.hh
index 3206fdd..5e8009b 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -115,6 +115,14 @@ public:
         MAX_VERT = 2, ///< maximize vertical
         MAX_FULL = 3  ///< maximize full
     };
+
+    /**
+     * Additional flags for moveResize
+     */
+    enum MoveResizeFit {
+	FIT_SIZEHINTS = 4 ///< apply size hints
+    };
+
     /**
        This enumeration represents individual decoration
        attributes, they can be OR-d together to get a mask.
@@ -259,7 +267,8 @@ public:
     /// resize frame to width, height
     void resize(unsigned int width, unsigned int height);
     /// move and resize frame to pox x,y and size width, height
-    void moveResize(int x, int y, unsigned int width, unsigned int height, bool send_event = false);
+    void moveResize(int x, int y, unsigned int width, unsigned int height,
+            bool send_event = false, int fit = MAX_NONE);
     /// move to pos x,y and resize client window to size width, height
     void moveResizeForClient(int x, int y, unsigned int width, unsigned int height, int gravity = ForgetGravity, unsigned int client_bw = 0);
     void setWorkspace(int n);
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc
index 56d6df7..c28cc75 100644
--- a/src/WorkspaceCmd.cc
+++ b/src/WorkspaceCmd.cc
@@ -216,17 +216,9 @@ void ArrangeWindowsCmd::execute() {
                 }
             }
 
-            if (normal_windows.size() > 1) {
-                (*closest)->moveResize(x_offs + (*closest)->xOffset(),
-			y_offs + (*closest)->yOffset(),
-			cal_width - (*closest)->widthOffset(),
-			cal_height - (*closest)->heightOffset());
-            } else { // the last window gets everything that is left.
-                (*closest)->moveResize(x_offs + (*closest)->xOffset(),
-			y_offs + (*closest)->yOffset(),
-			screen->maxRight(head) - x_offs - (*closest)->widthOffset(),
-			cal_height - (*closest)->heightOffset());
-            }
+	    (*closest)->moveResize(x_offs, y_offs,
+		    normal_windows.size() > 1 ? cal_width : screen->maxRight(head) - x_offs,
+		    cal_height, false, FluxboxWindow::MAX_FULL | FluxboxWindow::FIT_SIZEHINTS);
 
             normal_windows.erase(closest);
 
