Pay attention to the width and height provided in WM_SIZE even when
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 22 Dec 2010 16:14:11 +0000 (16:14 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 22 Dec 2010 16:14:11 +0000 (16:14 +0000)
restoring a maximised window.

Failure to do this was noticeable in the following scenario (again
using Aero UI enhancements):
 1. resize window using topmost resize handle, and move pointer to top
    of screen which 'maximises' the window vertically
 2. now maximise the window properly using the maximise button in top
    right
 3. now restore. Notepad restores to its position before step 1,
    because Aero remembers that position for the purpose, but PuTTY
    thinks it knows better. Only now it doesn't any more.

git-svn-id: svn://svn.tartarus.org/sgt/putty@9041 cda61777-01e9-0310-a592-d414129be87e

windows/window.c

index b00865a..d73c04b 100644 (file)
@@ -2765,9 +2765,13 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
                 reset_window(0);
             } else if (wParam == SIZE_RESTORED && was_zoomed) {
                 was_zoomed = 0;
-                if (cfg.resize_action == RESIZE_TERM)
-                    term_size(term, prev_rows, prev_cols, cfg.savelines);
-                if (cfg.resize_action != RESIZE_FONT)
+                if (cfg.resize_action == RESIZE_TERM) {
+                    w = (width-cfg.window_border*2) / font_width;
+                    if (w < 1) w = 1;
+                    h = (height-cfg.window_border*2) / font_height;
+                    if (h < 1) h = 1;
+                    term_size(term, h, w, cfg.savelines);
+                } else if (cfg.resize_action != RESIZE_FONT)
                     reset_window(2);
                 else
                     reset_window(0);