From: H.G. Muller Date: Wed, 10 Oct 2012 18:07:53 +0000 (+0200) Subject: Make draw handle for board globally available X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=caa23c86bfabccac8edc448f6521e475b1f65d36;p=xboard.git Make draw handle for board globally available --- diff --git a/draw.c b/draw.c index 7571850..668e4a5 100644 --- a/draw.c +++ b/draw.c @@ -111,7 +111,7 @@ extern char *getenv(); #define OUTLINE 1 Boolean cairoAnimate; Option *currBoard; -static cairo_surface_t *csBoardWindow; +cairo_surface_t *csBoardWindow; static cairo_surface_t *pngPieceImages[2][(int)BlackPawn+4]; // png 256 x 256 images static cairo_surface_t *pngPieceBitmaps[2][(int)BlackPawn]; // scaled pieces as used static cairo_surface_t *pngPieceBitmaps2[2][(int)BlackPawn+4]; // scaled pieces in store @@ -430,10 +430,14 @@ void DrawSeekDot(int x, int y, int colorNr) } void +InitDrawingHandle (Option *opt) +{ + csBoardWindow = DRAWABLE(opt); +} + +void DrawSeekOpen () { - csBoardWindow = (cairo_surface_t *) mainOptions[W_BOARD].choice; - currBoard = &mainOptions[W_BOARD]; } void diff --git a/draw.h b/draw.h index 3ba9efe..a7bdfce 100644 --- a/draw.h +++ b/draw.h @@ -68,6 +68,7 @@ extern Pixel lightSquareColor, darkSquareColor, whitePieceColor, blackPieceColor highlightSquareColor, premoveHighlightColor; // defined in draw.c +void InitDrawingHandle P((Option *opt)); void CreateGCs P((int redo)); void NewSurfaces P((void)); void CreateAnyPieces P((void)); diff --git a/xboard.c b/xboard.c index 2ac676d..ede493d 100644 --- a/xboard.c +++ b/xboard.c @@ -1261,6 +1261,8 @@ main (int argc, char **argv) #else clockFontStruct); #endif + InitDrawingHandle(optList + W_BOARD); + currBoard = &optList[W_BOARD]; boardWidget = optList[W_BOARD].handle; menuBarWidget = optList[W_MENU].handle; dropMenu = optList[W_DROP].handle;