--- mngplay.old/mngplay.c +++ mngplay/mngplay.c @@ -382,12 +382,19 @@ mngstuff *mymng; mng_handle mng; SDL_Rect updaterect; + char *cp; + int ii; if (argc < 2) { const SDL_version *pSDLver = SDL_Linked_Version(); - fprintf(stderr, "Usage: %s mngfile [depth]\n\n", basename(argv[0])); - fprintf(stderr, " where 'depth' is 15,16,24 or 32\n"); + fprintf (stderr, + "Usage: %s foo.mng [depth] [-window=ID#]\n\n", + basename (argv [0])); + fprintf (stderr, "depth can be 15, 16, 24 or 32\n"); + fprintf (stderr, "-window=ID# specifies an X window ID"); + fprintf (stderr, " [useful for MozPlugger purposes]"); + fprintf(stderr, " Compiled with SDL %d.%d.%d; using SDL %d.%d.%d.\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL, @@ -425,23 +432,38 @@ /* pass the name of the file we want to play */ mymng->filename = argv[1]; + mymng->sdl_video_depth = DEFAULT_SDL_VIDEO_DEPTH; - /* pass the color depth we wish to use */ - if (argc>=3) { - mymng->sdl_video_depth = atoi(argv[2]); - switch(mymng->sdl_video_depth) { - case 15: - case 16: - case 24: - case 32: - break; - default: - fprintf(stderr, "Unsupported color depth. Choices are: 15, 16, 24 and 32\n"); - exit(1); - } - } - else { - mymng->sdl_video_depth = DEFAULT_SDL_VIDEO_DEPTH; + for (ii = 2; ii+1 <= argc; ii++) + { + if (!strncmp (argv [ii], "-window=", 8)) + { /* process window-id option */ + static char widbuf [64]; + cp = argv [ii] + 8; + + if (strlen (cp) < 32) + { + sprintf (widbuf, "SDL_WINDOWID=%s", cp); + putenv (widbuf); + } + } + else + { /* process color-depth option */ + mymng->sdl_video_depth = atoi (argv [ii]); + + switch (mymng->sdl_video_depth) + { + case 15: + case 16: + case 24: + case 32: + break; + default: + fprintf (stderr, +"Unsupported color depth. Choices are: 15, 16, 24 and 32\n"); + exit (1); + } + } } /* set up the mng decoder for our stream */