--- ray/src/px/x11image.c 1994/06/10 12:51:21 2.37 +++ ray/src/px/x11image.c 1995/01/25 10:53:02 2.41 @@ -1,4 +1,4 @@ -/* Copyright (c) 1993 Regents of the University of California */ +/* Copyright (c) 1995 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -74,6 +74,7 @@ int xoff = 0; /* x image offset */ int yoff = 0; /* y image offset */ int parent = 0; /* number of children, -1 if child */ +int sequential = 0; /* display images in sequence */ VIEW ourview = STDVIEW; /* image view parameters */ int gotview = 0; /* got parameters from file */ @@ -147,6 +148,7 @@ char *argv[]; greyscale = !greyscale; break; case 'm': + greyscale = 1; maxcolors = 2; break; case 'd': @@ -158,6 +160,9 @@ char *argv[]; case 'f': fast = !fast; break; + case 's': + sequential = !sequential; + break; case 'e': if (argv[i+1][0] != '+' && argv[i+1][0] != '-') goto userr; @@ -214,15 +219,11 @@ char *argv[]; init(argc, argv); /* get file and open window */ - if (parent < 0) { - kill(getppid(), SIGCONT); /* signal parent if child */ - sigrecv--; - } for ( ; ; ) getevent(); /* main loop */ userr: fprintf(stderr, -"Usage: %s [-di disp][[-ge] spec][-b][-m][-d][-f][-c nclrs][-e +/-stops][-g gamcor] pic ..\n", +"Usage: %s [-di disp][[-ge] spec][-b][-m][-d][-f][-c nclrs][-e +/-stops][-g gamcor][-s] pic ..\n", progname); exit(1); } @@ -276,7 +277,7 @@ char **argv; if (gamstr == NULL) /* get it from the X server */ gamstr = XGetDefault(thedisplay, "radiance", "gamma"); if (gamstr == NULL) /* get it from the environment */ - gamstr = getenv("GAMMA"); + gamstr = getenv("DISPLAY_GAMMA"); if (gamstr != NULL) gamcor = atof(gamstr); /* get best visual for default screen */ @@ -305,17 +306,20 @@ char **argv; } } /* open window */ + i = CWEventMask|CWCursor|CWBackPixel|CWBorderPixel; ourwinattr.border_pixel = ourwhite; ourwinattr.background_pixel = ourblack; - ourwinattr.colormap = XCreateColormap(thedisplay, ourroot, - ourvis.visual, AllocNone); + if (ourvis.visual != DefaultVisual(thedisplay,ourscreen)) { + ourwinattr.colormap = newcmap(thedisplay, ourscreen, ourvis.visual); + i |= CWColormap; + } ourwinattr.event_mask = ExposureMask|KeyPressMask|ButtonPressMask| ButtonReleaseMask|ButtonMotionMask|StructureNotifyMask; ourwinattr.cursor = XCreateFontCursor(thedisplay, XC_diamond_cross); wind = XCreateWindow(thedisplay, ourroot, xszhints.x, xszhints.y, xszhints.width, xszhints.height, BORWIDTH, - ourvis.depth, InputOutput, ourvis.visual, CWEventMask| - CWCursor|CWBackPixel|CWBorderPixel|CWColormap, &ourwinattr); + ourvis.depth, InputOutput, ourvis.visual, + i, &ourwinattr); if (wind == 0) quiterr("cannot create window"); width = xmax; @@ -353,7 +357,6 @@ char **argv; XSetWMProtocols(thedisplay, wind, &closedownAtom, 1); XMapWindow(thedisplay, wind); - return; } /* end of init */ @@ -562,6 +565,10 @@ getevent() /* process the next event */ map_rcolors(ourras, wind); if (fast) make_rpixmap(ourras, wind); + if (!sequential & parent < 0 & sigrecv == 0) { + kill(getppid(), SIGCONT); + sigrecv--; + } break; case UnmapNotify: if (!fast)