--- np2/x11/main.c 2003/12/19 16:08:01 1.10 +++ np2/x11/main.c 2004/07/26 15:53:26 1.20 @@ -27,6 +27,7 @@ #include "compiler.h" +#include #include #include @@ -46,6 +47,8 @@ #include "sysmenu.h" #include "toolwin.h" #include "viewer.h" +#include "debugwin.h" +#include "skbdwin.h" #include "commng.h" #include "fontmng.h" @@ -99,7 +102,9 @@ sighandler(int signo) static struct option longopts[] = { { "config", required_argument, 0, 'c' }, { "timidity-config", required_argument, 0, 'C' }, - { "shared-pixmap", no_argument, 0, 'p' }, +#if defined(USE_SDL) || defined(USE_SYSMENU) + { "ttfont", required_argument, 0, 't' }, +#endif { "help", no_argument, 0, 'h' }, { 0, 0, 0, 0 }, }; @@ -110,7 +115,14 @@ static void usage(void) { - printf("Usage: %s [options] [[FD1 image] [[FD2 image] [[FD3 image] [FD4 image]]]]\n", progname); + printf("Usage: %s [options] [[FD1 image] [[FD2 image] [[FD3 image] [FD4 image]]]]\n\n", progname); + printf("options:\n"); + printf("\t--help [-h] : print this message\n"); + printf("\t--config [-c] : specify config file\n"); + printf("\t--timidity-config [-C] : specify timidity config file\n"); +#if defined(USE_SDL) || defined(USE_SYSMENU) + printf("\t--ttfont [-t] : specify TrueType font\n"); +#endif exit(1); } @@ -126,14 +138,13 @@ main(int argc, char *argv[]) int rv = 1; int ch; int i, drvmax; - BOOL shared_pixmap_flag = FALSE; progname = argv[0]; toolkit_initialize(); toolkit_arginit(&argc, &argv); - while ((ch = getopt_long(argc, argv, "c:C:nh", longopts, NULL)) != -1) { + while ((ch = getopt_long(argc, argv, "c:C:t:ph", longopts, NULL)) != -1) { switch (ch) { case 'c': if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) { @@ -156,8 +167,12 @@ main(int argc, char *argv[]) sizeof(timidity_cfgfile_path)); break; - case 'p': - shared_pixmap_flag = TRUE; + case 't': + if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) { + fprintf(stderr, "Can't access %s.\n", optarg); + exit(1); + } + milstr_ncpy(fontfilename, optarg, sizeof(fontfilename)); break; case 'h': @@ -227,15 +242,16 @@ main(int argc, char *argv[]) initload(); toolwin_readini(); kdispwin_readini(); + skbdwin_readini(); rand_setseed((SINT32)time(NULL)); -#if defined(__GNUC__) && (defined(i386) || defined(__i386__)) +#if defined(GCC_CPU_ARCH_IA32) mmxflag = havemmx() ? 0 : MMXFLAG_NOTSUPPORT; mmxflag += np2oscfg.disablemmx ? MMXFLAG_DISABLE : 0; #endif - use_shared_pixmap = np2oscfg.shared_pixmap && shared_pixmap_flag; + use_shared_pixmap = np2oscfg.shared_pixmap; TRACEINIT(); @@ -244,12 +260,13 @@ main(int argc, char *argv[]) kdispwin_initialize(); viewer_init(); + skbdwin_initialize(); toolkit_widget_create(); scrnmng_initialize(); kbdmng_init(); inputmng_init(); - keystat_reset(); + keystat_initialize(); scrnmode = 0; if (np2cfg.RASTER) { @@ -278,6 +295,7 @@ main(int argc, char *argv[]) } } + joymng_initialize(); mousemng_initialize(); if (np2oscfg.MOUSE_SW) { mouse_running(MOUSE_ON); @@ -287,7 +305,6 @@ main(int argc, char *argv[]) sysmng_initialize(); taskmng_initialize(); - joy_init(); pccore_init(); S98_init(); @@ -303,6 +320,9 @@ main(int argc, char *argv[]) if (np2oscfg.keydisp) { kdispwin_create(); } + if (np2oscfg.softkbd) { + skbdwin_create(); + } } if (np2oscfg.resume) { @@ -324,10 +344,12 @@ main(int argc, char *argv[]) kdispwin_destroy(); toolwin_destroy(); + skbdwin_destroy(); pccore_cfgupdate(); mouse_running(MOUSE_OFF); + joymng_deinitialize(); S98_trash(); if (np2oscfg.resume) { @@ -337,6 +359,7 @@ main(int argc, char *argv[]) } pccore_term(); + debugwin_destroy(); soundmng_deinitialize(); scrnmng_destroy(); @@ -352,8 +375,11 @@ fontmng_failure: initsave(); toolwin_writeini(); kdispwin_writeini(); + skbdwin_writeini(); } + skbdwin_deinitialize(); + TRACETERM(); dosio_term();