// [HGM] font: use defaults from settings file if available and not overruled
}
- /* Now, using squareSize as a hint, find a good XPM/XIM set size */
- if (strlen(appData.pixmapDirectory) > 0) {
- p = ExpandPathName(appData.pixmapDirectory);
- if (!p) {
- fprintf(stderr, _("Error expanding path name \"%s\"\n"),
- appData.pixmapDirectory);
- exit(1);
- }
- if (appData.debugMode) {
- fprintf(stderr, _("\
-XBoard square size (hint): %d\n\
-%s fulldir:%s:\n"), squareSize, IMAGE_EXT, p);
- }
- squareSize = xpm_closest_to(p, squareSize, IMAGE_EXT);
- if (appData.debugMode) {
- fprintf(stderr, _("Closest %s size: %d\n"), IMAGE_EXT, squareSize);
- }
- }
defaultLineGap = lineGap;
if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap;
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");
- CreateGCs(False);
+ CreateAnyPieces();
CreateGrid();
if(appData.logoSize)
void
ReadBitmap (Pixmap *pm, String name, unsigned char bits[], u_int wreq, u_int hreq)
{
- int x_hot, y_hot;
- u_int w, h;
- int errcode;
- char msg[MSG_SIZ], fullname[MSG_SIZ];
-
- if (*appData.bitmapDirectory != NULLCHAR) {
- safeStrCpy(fullname, appData.bitmapDirectory, sizeof(fullname)/sizeof(fullname[0]) );
- strncat(fullname, "/", MSG_SIZ - strlen(fullname) - 1);
- strncat(fullname, name, MSG_SIZ - strlen(fullname) - 1);
- errcode = XReadBitmapFile(xDisplay, xBoardWindow, fullname,
- &w, &h, pm, &x_hot, &y_hot);
- fprintf(stderr, "load %s\n", name);
- if (errcode != BitmapSuccess) {
- switch (errcode) {
- case BitmapOpenFailed:
- snprintf(msg, sizeof(msg), _("Can't open bitmap file %s"), fullname);
- break;
- case BitmapFileInvalid:
- snprintf(msg, sizeof(msg), _("Invalid bitmap in file %s"), fullname);
- break;
- case BitmapNoMemory:
- snprintf(msg, sizeof(msg), _("Ran out of memory reading bitmap file %s"),
- fullname);
- break;
- default:
- snprintf(msg, sizeof(msg), _("Unknown XReadBitmapFile error %d on file %s"),
- errcode, fullname);
- break;
- }
- fprintf(stderr, _("%s: %s...using built-in\n"),
- programName, msg);
- } else if (w != wreq || h != hreq) {
- fprintf(stderr,
- _("%s: Bitmap %s is %dx%d, not %dx%d...using built-in\n"),
- programName, fullname, w, h, wreq, hreq);
- } else {
- return;
- }
- }
if (bits != NULL) {
*pm = XCreateBitmapFromData(xDisplay, xBoardWindow, (char *) bits,
wreq, hreq);
}
}
+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)