ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/x11.c
(Generate patch)

Comparing ray/src/rt/x11.c (file contents):
Revision 1.7 by greg, Fri Feb 23 14:50:38 1990 UTC vs.
Revision 1.11 by greg, Thu Mar 8 09:47:23 1990 UTC

# Line 84 | Line 84 | char  *name, *id;
84   {
85          int  nplanes;
86          XVisualInfo  ourvinfo;
87 +        XSetWindowAttributes    ourwinattr;
88          XWMHints  ourxwmhints;
88        Pixmap  bmCursorSrc, bmCursorMsk;
89  
90          ourdisplay = XOpenDisplay(NULL);
91          if (ourdisplay == NULL) {
# Line 109 | Line 109 | char  *name, *id;
109          }
110          ourvisual = ourvinfo.visual;
111          make_gmap(GAMMA);
112        /* create a cursor */
113        pickcursor = XCreateFontCursor (ourdisplay, XC_diamond_cross);
112          /* open window */
113 <        gwind = XCreateSimpleWindow(ourdisplay, ourroot, 0, 0,
113 >        ourwinattr.background_pixel = ourwhite;
114 >        ourwinattr.border_pixel = ourblack;
115 >        gwind = XCreateWindow(ourdisplay, ourroot, 0, 0,
116                  DisplayWidth(ourdisplay,ourscreen)-2*BORWIDTH,
117                  DisplayHeight(ourdisplay,ourscreen)-2*BORWIDTH,
118 <                BORWIDTH, ourblack, ourwhite);
118 >                BORWIDTH, nplanes, InputOutput, ourvisual,
119 >                CWBackPixel|CWBorderPixel, &ourwinattr);
120          if (gwind == 0) {
121                  stderr_v("cannot create window\n");
122                  return(NULL);
123          }
124          XStoreName(ourdisplay, gwind, id);
125 +        /* create a cursor */
126 +        pickcursor = XCreateFontCursor(ourdisplay, XC_diamond_cross);
127          ourgc = XCreateGC(ourdisplay, gwind, 0, NULL);
128          ourxwmhints.flags = InputHint;
129          ourxwmhints.input = True;
# Line 152 | Line 155 | x11_close()                    /* close our display */
155                  xt_close(comline);
156                  comline = NULL;
157          }
158 <        if (gwind != 0) {
159 <                freepixels();
160 <                XFreeGC(ourdisplay, ourgc);
161 <                XDestroyWindow(ourdisplay, gwind);
162 <                gwind = 0;
160 <                ourgc = 0;
161 <        }
158 >        freepixels();
159 >        XFreeGC(ourdisplay, ourgc);
160 >        XDestroyWindow(ourdisplay, gwind);
161 >        gwind = 0;
162 >        ourgc = 0;
163          XFreeCursor(ourdisplay, pickcursor);
164          XCloseDisplay(ourdisplay);
165          ourdisplay = NULL;
# Line 184 | Line 185 | int  xres, yres;
185                  XSelectInput(ourdisplay, comline->w, ExposureMask);
186                  gwidth = xres;
187                  gheight = yres;
188 <                XSync(ourdisplay, 1);           /* discard input */
188 >                XFlush(ourdisplay);
189                  sleep(2);                       /* wait for window manager */
190 +                XSync(ourdisplay, 1);           /* discard input */
191          }
192          XClearWindow(ourdisplay, gwind);
193          if (ourvisual->class == PseudoColor)    /* reinitialize color table */
# Line 223 | Line 225 | int  xmin, ymin, xmax, ymax;
225   static
226   x11_flush()                     /* flush output */
227   {
228 <        if (ncolors <= 0)       /* output necessary for death */
227 <                XFillRectangle(ourdisplay, gwind, ourgc, 0, 0, 1 ,1);
228 >        XNoOp(ourdisplay);
229          while (XPending(ourdisplay) > 0)
230                  getevent();
231   }
# Line 251 | Line 252 | static
252   x11_comout(out)                 /* output a string to command line */
253   char  *out;
254   {
255 <        if (comline != NULL)
256 <                xt_puts(out, comline);
257 <        XFlush(ourdisplay);
255 >        if (comline == NULL)
256 >                return;
257 >        xt_puts(out, comline);
258 >        if (out[strlen(out)-1] == '\n')
259 >                XFlush(ourdisplay);
260   }
261  
262  
# Line 261 | Line 264 | static
264   x11_errout(msg)                 /* output an error message */
265   char  *msg;
266   {
264        x11_comout(msg);
267          stderr_v(msg);          /* send to stderr also! */
268 +        x11_comout(msg);
269   }
270  
271  
# Line 375 | Line 378 | freepixels()                           /* free our pixels */
378                  return;
379          XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L);
380          ncolors = 0;
381 <        if (ourmap != 0 && ourmap != DefaultColormap(ourdisplay,ourscreen))
381 >        if (ourmap != DefaultColormap(ourdisplay,ourscreen))
382                  XFreeColormap(ourdisplay, ourmap);
383          ourmap = 0;
384   }
# Line 442 | Line 445 | static
445   getkey(ekey)                            /* get input key */
446   register XKeyPressedEvent  *ekey;
447   {
448 <        int  n;
448 >        register int  n;
449  
450          n = XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last,
451                                  NULL, NULL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines