From: H.G. Muller Date: Mon, 28 Nov 2011 10:56:18 +0000 (+0100) Subject: Refrain from making unnecessary resize X request X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=2bc700b32c6058a3e8f9c3a70d842c525cf0a6e3;p=xboard.git Refrain from making unnecessary resize X request The window resizing code in InitDrawingSizes is suppressed when no change is needed. Similarly, changing piece bitmaps is suppressed when we stay in the same variant (and InitDrawingSizes is called e.g. because of chaging lineGap through the Board dialog). --- diff --git a/xboard.c b/xboard.c index a0fa9b6..26adc76 100644 --- a/xboard.c +++ b/xboard.c @@ -1682,9 +1682,17 @@ void InitDrawingSizes(BoardSize boardSize, int flags) Arg args[16]; XtGeometryResult gres; int i; + static Dimension oldWidth, oldHeight; + static VariantClass oldVariant; + static int oldDual = -1; if(!formWidget) return; + if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap; + boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap); + boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap); + + if(boardWidth != oldWidth || boardHeight != oldHeight || oldDual != twoBoards) { // do resizing stuff only if size actually changed /* * Enable shell resizing. */ @@ -1699,9 +1707,7 @@ void InitDrawingSizes(BoardSize boardSize, int flags) XtSetArg(args[0], XtNdefaultDistance, &sep); XtGetValues(formWidget, args, 1); - if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap; - boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap); - boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap); + oldWidth = boardWidth; oldHeight = boardHeight; oldDual = twoBoards; CreateGrid(); hOffset = boardWidth + 10; for(i=0; i