From 6b57f854463218f4adfc0b1eaf37eb275e35f893 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sun, 28 Sep 2014 10:55:10 +0200 Subject: [PATCH] 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. --- gtk/xboard.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) 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 -- 1.7.0.4