--- ray/src/px/x11image.c 1993/11/22 11:33:18 2.35 +++ ray/src/px/x11image.c 1994/11/21 09:18:48 2.39 @@ -113,7 +113,7 @@ char *progname; char errmsg[128]; -extern BYTE clrtab[256][3]; /* global color map */ +BYTE clrtab[256][3]; /* global color map */ extern long ftell(); @@ -214,10 +214,6 @@ 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: @@ -276,7 +272,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 */ @@ -353,7 +349,6 @@ char **argv; XSetWMProtocols(thedisplay, wind, &closedownAtom, 1); XMapWindow(thedisplay, wind); - return; } /* end of init */ @@ -366,10 +361,9 @@ char *err; if (es = err != NULL) fprintf(stderr, "%s: %s: %s\n", progname, fname==NULL?"":fname, err); - if (parent > 0 & wind != 0) { - XDestroyWindow(thedisplay, wind); - XFlush(thedisplay); - } else if (parent < 0 & sigrecv == 0) + if (thedisplay != NULL) + XCloseDisplay(thedisplay); + if (parent < 0 & sigrecv == 0) kill(getppid(), SIGCONT); while (parent > 0 && wait(&cs) != -1) { /* wait for any children */ if (es == 0) @@ -563,6 +557,10 @@ getevent() /* process the next event */ map_rcolors(ourras, wind); if (fast) make_rpixmap(ourras, wind); + if (parent < 0 & sigrecv == 0) { /* notify parent */ + kill(getppid(), SIGCONT); + sigrecv--; + } break; case UnmapNotify: if (!fast) @@ -1000,7 +998,8 @@ getmapped() /* get color-mapped data */ /* set gamma correction */ setcolrgam(gamcor); /* make histogram */ - new_histo(); + if (new_histo((long)xmax*ymax) == -1) + quiterr("cannot initialize histogram"); for (y = 0; y < ymax; y++) { if (getscan(y) < 0) break;