Fix clearing of markers dots with promo popup
[xboard.git] / xboard.c
index 84a4170..5dc557c 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -1055,7 +1055,6 @@ InitDrawingSizes (BoardSize boardSize, int flags)
     }
     for(i=0; i<2; i++) {
        int p;
-printf("Copy pieces\n");
        for(p=0; p<=(int)WhiteKing; p++)
           pngPieceBitmaps[i][p] = pngPieceBitmaps2[i][p]; // defaults
     }
@@ -2602,6 +2601,24 @@ BlankSquare (int x, int y, int color, ChessSquare piece, Drawable dest, int fac)
        XCopyArea(xDisplay, xpmBoardBitmap[color], dest, wlPieceGC, x0, y0,
                  squareSize, squareSize, x*fac, y*fac);
     } else
+    if(csBoardWindow) {
+       cairo_t *cr = cairo_create (csBoardWindow);
+       char *col;
+       switch (color) {
+         case 0: col = appData.darkSquareColor; break;
+         case 1: col = appData.lightSquareColor; break;
+         case 2: col = "#000000"; break;
+       }
+       SetPen(cr, 2.0, col, 0);
+       cairo_rectangle (cr, x, y, squareSize, squareSize);
+       cairo_fill (cr);
+       cairo_destroy (cr);
+       cr = cairo_create (csBoardBackup);
+       SetPen(cr, 2.0, col, 0);
+       cairo_rectangle (cr, x, y, squareSize, squareSize);
+       cairo_fill (cr);
+       cairo_destroy (cr);
+    } else
     if (useImages && useImageSqs) {
        Pixmap pm;
        switch (color) {
@@ -2870,8 +2887,18 @@ DrawOneSquare (int x, int y, ChessSquare piece, int square_color, int marker, ch
                if(align < 3) cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
                else          cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
                cairo_show_text (cr, string);
+               cairo_destroy (cr);
+               cr = cairo_create (csBoardBackup);
+               cairo_select_font_face (cr, "Sans",
+                           CAIRO_FONT_SLANT_NORMAL,
+                           CAIRO_FONT_WEIGHT_BOLD);
+
+               cairo_set_font_size (cr, squareSize/4);
 
-               /* free memory */
+               cairo_move_to (cr, xx-1, yy);
+               if(align < 3) cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+               else          cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+               cairo_show_text (cr, string);
                cairo_destroy (cr);
            } else
            XDrawString(xDisplay, xBoardWindow, hGC, xx, yy, string, 1);