patches a bug in chosing the initial board size on a virgin startup I introduced...
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 25 Jun 2009 05:52:20 +0000 (22:52 -0700)
committerArun Persaud <arun@nubati.net>
Thu, 25 Jun 2009 05:52:20 +0000 (22:52 -0700)
winboard/winboard.c

index ad14f7e..c7fad66 100644 (file)
@@ -155,7 +155,7 @@ BOOLEAN chessProgram;
 static int boardX, boardY;\r
 int  minX, minY; // [HGM] placement: volatile limits on upper-left corner\r
 static int squareSize, lineGap, minorSize;\r
-static int winWidth, winHeight;\r
+static int winWidth, winHeight, winW, winH;\r
 static RECT messageRect, whiteRect, blackRect, leftLogoRect, rightLogoRect; // [HGM] logo\r
 static int logoHeight = 0;\r
 static char messageText[MESSAGE_TEXT_MAX];\r
@@ -700,9 +700,9 @@ InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine)
        size that fits on this screen as the default. */\r
     InitDrawingSizes((BoardSize)(ibs+1000), 0);\r
     if (boardSize == (BoardSize)-1 &&\r
-        winHeight <= screenHeight\r
+        winH <= screenHeight\r
            - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYCAPTION) - 10\r
-        && winWidth <= screenWidth) {\r
+        && winW <= screenWidth) {\r
       boardSize = (BoardSize)ibs;\r
     }\r
   }\r
@@ -3234,10 +3234,12 @@ InitDrawingSizes(BoardSize boardSize, int flags)
   sizeInfo[boardSize].cliHeight = boardRect.bottom + OUTER_MARGIN;\r
   oldBoardSize = boardSize;\r
   oldTinyLayout = tinyLayout;\r
-  if(suppressVisibleEffects) return; // [HGM] when called for filling sizeInfo only\r
-  winWidth = 2 * GetSystemMetrics(SM_CXFRAME) + boardRect.right + OUTER_MARGIN;\r
-  winHeight = 2 * GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYMENU) +\r
+  winW = 2 * GetSystemMetrics(SM_CXFRAME) + boardRect.right + OUTER_MARGIN;\r
+  winH = 2 * GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYMENU) +\r
     GetSystemMetrics(SM_CYCAPTION) + boardRect.bottom + OUTER_MARGIN;\r
+  if(suppressVisibleEffects) return; // [HGM] when called for filling sizeInfo only\r
+  winWidth = winW;  // [HGM] placement: set through temporary which can used by initial sizing choice\r
+  winHeight = winH; //       without disturbing window attachments\r
   GetWindowRect(hwndMain, &wrect);\r
   SetWindowPos(hwndMain, NULL, 0, 0, winWidth, winHeight,\r
               SWP_NOCOPYBITS|SWP_NOZORDER|SWP_NOMOVE);\r