From: H.G. Muller Date: Wed, 26 Feb 2014 15:34:52 +0000 (+0100) Subject: Kludge repair of expose after startup resize X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=40bd473b68412069ea05a386974828c8538ee27c Kludge repair of expose after startup resize Redraw of the main board after resize is delegated to DragProc, which is scheduled after a delay, to make sure the user is done sizing (mainly to reposition docked windows). But at startup the program-requested resize when an engine does not support variant normal and needs a different board format takes so long that the finale size expose occurs after the DragProc timeout. As a result, the board was never drawn on the resized canvas. This is quite hard to fix in a satisfactory way. For now the suppression of board redrawing during resize is disabled during the first 10 seconds after startup, as any resize during that time is likely to be the result of a program request. --- diff --git a/backend.h b/backend.h index 29773a8..b304cb4 100644 --- a/backend.h +++ b/backend.h @@ -425,6 +425,8 @@ typedef struct { int ms; /* Assuming this is >= 16 bits */ } TimeMark; +extern TimeMark programStartTime; + void GetTimeMark P((TimeMark *)); long SubtractTimeMarks P((TimeMark *, TimeMark *)); diff --git a/dialogs.c b/dialogs.c index fdf6d11..0c430dd 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2505,6 +2505,7 @@ Exp (int n, int x, int y) { static int but1, but3, oldW, oldH; int menuNr = -3, sizing, f, r; + TimeMark now; if(n == 0) { // motion if(SeekGraphClick(Press, x, y, 1)) return NULL; @@ -2518,6 +2519,7 @@ Exp (int n, int x, int y) return NULL; } if(n != 10 && PopDown(PromoDlg)) fromX = fromY = -1; // user starts fiddling with board when promotion dialog is up + else GetTimeMark(&now); shiftKey = ShiftKeys(); controlKey = (shiftKey & 0xC) != 0; shiftKey = (shiftKey & 3) != 0; @@ -2532,7 +2534,7 @@ Exp (int n, int x, int y) sizing = (oldW != x || oldH != y); oldW = x; oldH = y; InitDrawingHandle(mainOptions + W_BOARD); - if(sizing) return NULL; // don't redraw while sizing + if(sizing && SubtractTimeMarks(&now, &programStartTime) > 10000) return NULL; // don't redraw while sizing (except at startup) DrawPosition(True, NULL); default: return NULL;