Reload piece images when pngDirectory is changed
[xboard.git] / xboard.c
index 3b97fca..54f9953 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -1315,12 +1315,13 @@ main (int argc, char **argv)
     XtGetValues(shellWidget, shellArgs, 2);
     shellArgs[4].value = shellArgs[2].value = w;
     shellArgs[5].value = shellArgs[3].value = h;
-    if(!CreateAnyPieces()) XtSetValues(shellWidget, &shellArgs[2], 4);
+//    XtSetValues(shellWidget, &shellArgs[2], 4);
     marginW =  w - boardWidth; // [HGM] needed to set new shellWidget size when we resize board
     marginH =  h - boardHeight;
 
     CatchDeleteWindow(shellWidget, "QuitProc");
 
+    CreateAnyPieces();
     CreateGrid();
 
     if(appData.logoSize)
@@ -1668,6 +1669,13 @@ SetupDropMenu ()
     }
 }
 
+cairo_surface_t *
+GetOutputSurface(Option *opt, int w, int h)
+{
+       if(w == 0) w = lineGap + BOARD_WIDTH * (squareSize + lineGap);
+       if(h == 0) h = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
+        return cairo_xlib_surface_create(xDisplay, XtWindow(opt->handle), DefaultVisual(xDisplay, 0), w, h);
+}
 
 static void
 do_flash_delay (unsigned long msec)
@@ -1740,7 +1748,7 @@ ReSize (WindowPlacement *wp)
            NewSurfaces();
            CreatePNGPieces(); // make newly scaled pieces
            InitDrawingSizes(0, 0); // creates grid etc.
-       }
+       } else ResizeBoardWindow(BOARD_WIDTH * (squareSize + lineGap) + lineGap, BOARD_HEIGHT * (squareSize + lineGap) + lineGap, 0);
 }
 
 static XtIntervalId delayedDragID = 0;