From: H.G.Muller Date: Sun, 28 Sep 2014 08:55:10 +0000 (+0200) Subject: Prevent board-size oscillations X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6b57f854463218f4adfc0b1eaf37eb275e35f893;p=xboard.git Prevent board-size oscillations It could happen that after resize there was room for enlarging the squares by one pixel, but that this crossed the boundary where the line gaps also become wider, and there is no room for making both squares and line gap. This would cause perpetual oscillations of the window size. Resizing is now suppressed when a 1-pixel square-size increase would also result in a line-gap increase. --- diff --git a/gtk/xboard.c b/gtk/xboard.c index 0d04c5b..78fa0f6 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -1647,10 +1647,13 @@ ReSize (WindowPlacement *wp) if(sqy < sqx) sqx = sqy; if(sqx < 20) return; if(appData.overrideLineGap < 0) { // do second iteration with adjusted lineGap + int oldSqx = sqx; lg = lineGap = sqx < 37 ? 1 : sqx < 59 ? 2 : sqx < 116 ? 3 : 4; sqx = (wp->width - lg - marginW) / BOARD_WIDTH - lg; sqy = (wp->height - lg - marginH - hc) / BOARD_HEIGHT - lg; if(sqy < sqx) sqx = sqy; + 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 } if(sqx != squareSize) { squareSize = sqx; // adopt new square size