From: H.G.Muller <hgm@hgm-xboard.(none)>
Date: Tue, 5 Apr 2016 16:52:32 +0000 (+0200)
Subject: Pick -boardSize on window width rather than square size
X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=945cd7a8c01737a506fcb7c304dfdc71d6fab144;p=xboard.git

Pick -boardSize on window width rather than square size

For boards with other than 8 files the squares will be scaled different
from what the sizeDefaults say, so that the font and menu clipping
determined by the latter will match the total board width. We now pick
the boardSize after sizing such that popup with an 8-wide board next time
would reproduce the board width.
---

diff --git a/gtk/xboard.c b/gtk/xboard.c
index 5029495..eb7457d 100644
--- a/gtk/xboard.c
+++ b/gtk/xboard.c
@@ -1690,7 +1690,7 @@ ReSize (WindowPlacement *wp)
 	    lg = sqx < 37 ? 1 : sqx < 59 ? 2 : sqx < 116 ? 3 : 4;
 	    if(sqx == oldSqx + 1 && lg == lineGap + 1) sqx = oldSqx, squareSize = 0; // prevent oscillations, force resize by kludge
 	}
-	for(h=0; sizeDefaults[h].name && sizeDefaults[h].squareSize > sqx; h++) {}
+	for(h=0; sizeDefaults[h].name && sizeDefaults[h].squareSize*8 > sqx*BOARD_WIDTH; h++) {}
 	if(!strchr(appData.boardSize, ',')) {
 	    ASSIGN(appData.boardSize, sizeDefaults[h].name);
 	    initialSquareSize = sizeDefaults[h].squareSize; // used for saving font