--- ray/src/px/x11image.c 1994/09/20 15:48:15 2.38 +++ ray/src/px/x11image.c 1994/11/23 14:24:34 2.40 @@ -147,6 +147,7 @@ char *argv[]; greyscale = !greyscale; break; case 'm': + greyscale = 1; maxcolors = 2; break; case 'd': @@ -214,10 +215,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: @@ -305,17 +302,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 +353,6 @@ char **argv; XSetWMProtocols(thedisplay, wind, &closedownAtom, 1); XMapWindow(thedisplay, wind); - return; } /* end of init */ @@ -562,6 +561,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)