Squelch some spurious resize events.
[u/mdw/putty] / window.c
index 8c2d96c..f810eba 100644 (file)
--- a/window.c
+++ b/window.c
@@ -1060,6 +1060,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
     static int ignore_clip = FALSE;
     static int just_reconfigged = FALSE;
     static int resizing = FALSE;
+    static int need_backend_resize = FALSE;
 
     switch (message) {
       case WM_TIMER:
@@ -1171,8 +1172,11 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
             {
                 int prev_alwaysontop = cfg.alwaysontop;
                int need_setwpos = FALSE;
+               int old_fwidth, old_fheight;
                cfg.width = cols;
                cfg.height = rows;
+               old_fwidth = font_width;
+               old_fheight = font_height;
                 if (!do_reconfig(hwnd))
                     break;
                 just_reconfigged = TRUE;
@@ -1250,6 +1254,8 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
 
                if (cfg.height != rows ||
                    cfg.width != cols ||
+                   old_fwidth != font_width ||
+                   old_fheight != font_height ||
                    cfg.savelines != savelines)
                    need_setwpos = TRUE;
                 term_size(cfg.height, cfg.width, cfg.savelines);
@@ -1417,11 +1423,13 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
       case WM_ENTERSIZEMOVE:
         EnableSizeTip(1);
         resizing = TRUE;
+       need_backend_resize = FALSE;
         break;
       case WM_EXITSIZEMOVE:
         EnableSizeTip(0);
         resizing = FALSE;
-        back->size();
+       if (need_backend_resize)
+           back->size();
         break;
       case WM_SIZING:
        {
@@ -1497,6 +1505,8 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
                  */
                 if (!resizing)
                     back->size();
+               else
+                   need_backend_resize = TRUE;
                just_reconfigged = FALSE;
            }
        }