X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=449f5b3cdc3daa721273b76fc8d444f0fc8e65ab;hb=a7db862b2f44d23b358a1319cd8a374cf88c24fd;hp=452255eb9b456ef011104ddd8606652c73b58024;hpb=4befbb88fd4688d1613e32b14f5ac3933cb56657;p=xboard.git diff --git a/xboard.c b/xboard.c index 452255e..449f5b3 100644 --- a/xboard.c +++ b/xboard.c @@ -243,6 +243,7 @@ RETSIGTYPE CmailSigHandler P((int sig)); RETSIGTYPE IntSigHandler P((int sig)); RETSIGTYPE TermSizeSigHandler P((int sig)); void CreateGCs P((int redo)); +void CreateAnyPieces P((void)); void CreateXIMPieces P((void)); void CreateXPMPieces P((void)); void CreateXPMBoard P((char *s, int n)); @@ -1509,7 +1510,7 @@ SaveFontArg(FILE *f, ArgDescriptor *ad) break; } for(i=0; iargName, i, fontTable[n][i]); + fprintf(f, OPTCHAR "%s" SEPCHAR "\"size%d:%s\"\n", ad->argName, i, fontTable[n][i]); } void @@ -1898,6 +1899,28 @@ int MakeColors() return forceMono; } +void +CreateAnyPieces() +{ // [HGM] taken out of main +#if HAVE_LIBXPM + if (appData.monoMode && // [HGM] no sense to go on to certain doom + (appData.bitmapDirectory == NULL || appData.bitmapDirectory[0] == NULLCHAR)) + appData.bitmapDirectory = DEF_BITMAP_DIR; + + if (appData.bitmapDirectory[0] != NULLCHAR) { + CreatePieces(); + } else { + CreateXPMPieces(); + CreateXPMBoard(appData.liteBackTextureFile, 1); + CreateXPMBoard(appData.darkBackTextureFile, 0); + } +#else + CreateXIMPieces(); + /* Create regular pieces */ + if (!useImages) CreatePieces(); +#endif +} + int main(argc, argv) int argc; @@ -2138,10 +2161,7 @@ XBoard square size (hint): %d\n\ if (forceMono) { fprintf(stderr, _("%s: too few colors available; trying monochrome mode\n"), programName); - - if (appData.bitmapDirectory == NULL || - appData.bitmapDirectory[0] == NULLCHAR) - appData.bitmapDirectory = DEF_BITMAP_DIR; + appData.monoMode = True; } if (appData.lowTimeWarning && !appData.monoMode) { @@ -2551,19 +2571,7 @@ XBoard square size (hint): %d\n\ CreateGCs(False); CreateGrid(); -#if HAVE_LIBXPM - if (appData.bitmapDirectory[0] != NULLCHAR) { - CreatePieces(); - } else { - CreateXPMPieces(); - CreateXPMBoard(appData.liteBackTextureFile, 1); - CreateXPMBoard(appData.darkBackTextureFile, 0); - } -#else - CreateXIMPieces(); - /* Create regular pieces */ - if (!useImages) CreatePieces(); -#endif + CreateAnyPieces(); CreatePieceMenus(); @@ -2622,7 +2630,8 @@ XBoard square size (hint): %d\n\ } gameInfo.boardWidth = 0; // [HGM] pieces: kludge to ensure InitPosition() calls InitDrawingSizes() InitPosition(TRUE); - XtSetKeyboardFocus(shellWidget, formWidget); +// XtSetKeyboardFocus(shellWidget, formWidget); + XSetInputFocus(xDisplay, XtWindow(formWidget), RevertToPointerRoot, CurrentTime); XtAppMainLoop(appContext); if (appData.debugMode) fclose(debugFP); // [DM] debug @@ -3062,7 +3071,6 @@ FindFont(pattern, targetPxlSize) char *def_string, *base_fnt_lst, strInt[3]; XFontSet fntSet; XFontStruct **fnt_list; - base_fnt_lst = calloc(1, strlen(pattern) + 3); snprintf(strInt, sizeof(strInt)/sizeof(strInt[0]), "%d", targetPxlSize); p = strstr(pattern, "--"); @@ -8010,8 +8018,7 @@ CreateAnimVars () /* For XPM pieces, we need bitmaps to use as masks. */ if (useImages) - CreateAnimMasks(info.depth); - xpmDone = 1; + CreateAnimMasks(info.depth), xpmDone = 1; } #ifndef HAVE_USLEEP