Quoth I,

The important thing, however, is that while we can debate the logic
the execution seems at first glance to be a success.

It survived several more glances too! Alas I found a bug. Horizontal maximization doesn't maintain the window's height and Maximus doesn't fill the full height of the screen when it could do.

The old, hairy code had some hacks to deal with those cases. Thanks to Renan's good work tidying up the code, so the fix is easier this time round.
From 4c2193636b017189352ec89d7092beb8869ada62 Mon Sep 17 00:00:00 2001
From: Iain Patterson <w...@iain.cx>
Date: Sun, 9 Jun 2013 13:18:18 +0100
Subject: [PATCH] Maximization regression

wMaximizeWindow() was previously rewritten and simplified.
Unfortunately the rewrite introduced a regression with windows which
were horizontally maximized or Maximusized, whereby they would be too
small after the maximization.

The bug is easy to see by opening a standard 80x24 terminal and hitting
the maximize horizontally shortcut.  The terminal shrinks to 21 lines.
Pressing the shortcut key again correctly restores it to 80x24.

The fix is to refrain from shrinking the final window height, which is
done to account for its frame border and titlebar, for the affected
maximization styles.
---
 src/actions.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index 1417833..e492419 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -410,8 +410,6 @@ void wMaximizeWindow(WWindow *wwin, int directions)
                        new_height += wwin->frame->bottom_width - 1;
                        new_y -= wwin->frame->top_width;
                }
-               /* HACK: this will be subtracted again below */
-               new_height += wwin->frame->top_width + 
wwin->frame->bottom_width;
 
                wwin->maximus_x = new_x;
                wwin->maximus_y = new_y;
@@ -457,7 +455,7 @@ void wMaximizeWindow(WWindow *wwin, int directions)
                }
        }
 
-       if (!WFLAGP(wwin, full_maximize))
+       if (!WFLAGP(wwin, full_maximize) && !(directions == MAX_MAXIMUS || 
directions == MAX_HORIZONTAL))
                new_height -= wwin->frame->top_width + 
wwin->frame->bottom_width;
 
        /* set maximization state */
-- 
1.8.1.4

Reply via email to