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.6 by greg, Fri Feb 23 10:26:30 1990 UTC vs.
Revision 1.10 by greg, Fri Mar 2 15:05:26 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 253 | Line 254 | char  *out;
254   {
255          if (comline != NULL)
256                  xt_puts(out, comline);
256        XFlush(ourdisplay);
257   }
258  
259  
# Line 261 | Line 261 | static
261   x11_errout(msg)                 /* output an error message */
262   char  *msg;
263   {
264        x11_comout(msg);
264          stderr_v(msg);          /* send to stderr also! */
265 +        x11_comout(msg);
266 +        x11_flush();
267   }
268  
269  
# Line 375 | Line 376 | freepixels()                           /* free our pixels */
376                  return;
377          XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L);
378          ncolors = 0;
379 <        if (ourmap != 0 && ourmap != DefaultColormap(ourdisplay,ourscreen))
379 >        if (ourmap != DefaultColormap(ourdisplay,ourscreen))
380                  XFreeColormap(ourdisplay, ourmap);
381          ourmap = 0;
382   }
# Line 442 | Line 443 | static
443   getkey(ekey)                            /* get input key */
444   register XKeyPressedEvent  *ekey;
445   {
446 <        c_last += XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last,
446 >        register int  n;
447 >
448 >        n = XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last,
449                                  NULL, NULL);
450 <        x11_driver.inpready = c_last-c_first;
450 >        c_last += n;
451 >        x11_driver.inpready += n;
452   }
453  
454  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines