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

Comparing ray/src/rt/x10.c (file contents):
Revision 1.3 by greg, Thu May 25 14:53:13 1989 UTC vs.
Revision 1.11 by greg, Fri Sep 29 13:23:59 1989 UTC

# Line 41 | Line 41 | static char SCCSid[] = "$SunId$ LBL";
41  
42   #define  hashcolr(c)    ((67*(c)[RED]+59*(c)[GRN]+71*(c)[BLU])%ncolors)
43  
44 < #define  flush()        while (XPending() > 0) getevent()
44 > #define  checkinp()     while (XPending() > 0) getevent()
45  
46   #define  levptr(etype)  ((etype *)&thisevent)
47  
# Line 67 | Line 67 | static int  gheight = 0;               /* graphics window height */
67  
68   static TEXTWIND  *comline = NULL;       /* our command line */
69  
70 static int  c_erase, c_kill;            /* erase and kill characters */
71
70   static char  c_queue[64];               /* input queue */
71   static int  c_first = 0;                /* first character in queue */
72   static int  c_last = 0;                 /* last character in queue */
# Line 89 | Line 87 | struct driver *
87   x_init(name)                    /* initialize driver */
88   char  *name;
89   {
92        struct sgttyb  ttymode;
93        
94        if (isatty(0)) {
95                ioctl(0, TIOCGETP, &ttymode);
96                c_erase = ttymode.sg_erase;
97                c_kill = ttymode.sg_kill;
98        } else {
99                c_erase = 'H'-'@';
100                c_kill = 'U'-'@';
101        }
90          ourdisplay = XOpenDisplay(NULL);
91          if (ourdisplay == NULL) {
92                  stderr_v("cannot open X-windows; DISPLAY variable set?\n");
# Line 117 | Line 105 | char  *name;
105                          BlackPixel, WhitePixel, GXcopy);
106          clientname = name;
107          x_driver.inpready = 0;
108 <        errvec = x_errout;                      /* set error vectors */
121 <        cmdvec = x_comout;
108 >        cmdvec = x_comout;                      /* set error vectors */
109          if (wrnvec != NULL)
110                  wrnvec = x_errout;
111          return(&x_driver);
# Line 128 | Line 115 | char  *name;
115   static
116   x_close()                       /* close our display */
117   {
118 <        errvec = stderr_v;                      /* reset error vectors */
132 <        cmdvec = NULL;
118 >        cmdvec = NULL;                          /* reset error vectors */
119          if (wrnvec != NULL)
120                  wrnvec = stderr_v;
121          if (ourdisplay == NULL)
# Line 176 | Line 162 | int  xres, yres;
162          } else                                          /* just clear */
163                  XClear(gwind);
164          newmap();
165 <        flush();
165 >        checkinp();
166          return;
167   fail:
168          stderr_v("Failure opening window in x_clear\n");
# Line 203 | Line 189 | int  xmin, ymin, xmax, ymax;
189                                  pixval[ndx]);
190          }
191          if (nrays - lastflush >= WFLUSH) {
192 <                flush();
192 >                if (ncolors <= 0)       /* output necessary for death */
193 >                        XPixSet(gwind,0,0,1,1,BlackPixel);
194 >                checkinp();
195                  lastflush = nrays;
196          }
197   }
# Line 216 | Line 204 | char  *inp;
204          int  x_getc(), x_comout();
205  
206          xt_cursor(comline, TBLKCURS);
207 <        editline(inp, x_getc, x_comout, c_erase, c_kill);
207 >        editline(inp, x_getc, x_comout);
208          xt_cursor(comline, TNOCURS);
209   }
210  
# Line 254 | Line 242 | int  *xp, *yp;
242          *yp = gheight-1 - levptr(XKeyOrButtonEvent)->y;
243          XFocusKeyboard(RootWindow);
244          XUngrabMouse();
245 <        flush();                                /* insure release */
245 >        XFlush();                               /* insure release */
246          if (c_last > c_first)                   /* key pressed */
247                  return(x_getc());
248                                                  /* button pressed */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines