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 2.20 by greg, Mon Oct 3 12:58:58 1994 UTC vs.
Revision 2.24 by greg, Tue Mar 7 14:18:34 1995 UTC

# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ LBL";
14   #include  <math.h>
15   #include  <sys/ioctl.h>
16   #include  <fcntl.h>
17 + #ifdef sparc
18 + #include  <sys/conf.h>
19 + #include  <sys/file.h>
20 + #include  <sys/filio.h>
21 + #endif
22  
23   #include  <X11/Xlib.h>
24   #include  <X11/cursorfont.h>
# Line 76 | Line 81 | static Colormap ourmap = 0;            /* our color map */
81  
82   static int  inpcheck;                   /* whence to check input */
83  
84 < extern char  *malloc(), *getcombuf();
84 > extern char  *malloc();
85  
86   static int  x11_close(), x11_clear(), x11_paintr(), x11_errout(),
87                  x11_getcur(), x11_comout(), x11_comin(), x11_flush();
# Line 298 | Line 303 | x11_flush()                    /* flush output */
303          n = XPending(ourdisplay);                       /* from X server */
304          while (n-- > 0)
305                  getevent();
306 + #ifdef FNDELAY
307          if (inpcheck == IC_IOCTL) {                     /* from stdin */
308 + #ifdef FIONREAD
309                  if (ioctl(fileno(stdin), FIONREAD, &n) < 0) {
310 + #else
311 +                if (1) {
312 + #endif
313                          if (fcntl(fileno(stdin), F_SETFL, FNDELAY) < 0) {
314                                  stderr_v("Cannot change input mode\n");
315                                  quit(1);
# Line 312 | Line 322 | x11_flush()                    /* flush output */
322                  n = read(fileno(stdin), buf, sizeof(buf)-1);
323                  if (n > 0) {
324                          buf[n] = '\0';
325 <                        strcpy(getcombuf(&x11_driver), buf);
325 >                        tocombuf(buf, &x11_driver);
326                  }
327          }
328 + #endif
329   }
330  
331  
# Line 367 | Line 378 | char  *inp, *prompt;
378                  if (!x11_driver.inpready)
379                          fputs(prompt, stdout);
380          }
381 + #ifdef FNDELAY
382 +        if (inpcheck == IC_READ) {      /* turn off FNDELAY */
383 +                if (fcntl(fileno(stdin), F_SETFL, 0) < 0) {
384 +                        stderr_v("Cannot change input mode\n");
385 +                        quit(1);
386 +                }
387 +                inpcheck = IC_IOCTL;
388 +        }
389 + #endif
390          if (gets(inp) == NULL) {
391                  strcpy(inp, "quit");
392                  return;
# Line 576 | Line 596 | static
596   fixwindow(eexp)                         /* repair damage to window */
597   register XExposeEvent  *eexp;
598   {
599 +        char  buf[80];
600 +
601          if (eexp->window == gwind) {
602 <                sprintf(getcombuf(&x11_driver), "repaint %d %d %d %d\n",
602 >                sprintf(buf, "repaint %d %d %d %d\n",
603                          eexp->x, gheight - eexp->y - eexp->height,
604                          eexp->x + eexp->width, gheight - eexp->y);
605 +                tocombuf(buf, &x11_driver);
606          } else if (eexp->window == comline->w) {
607                  if (eexp->count == 0)
608                          xt_redraw(comline);
# Line 599 | Line 622 | register XConfigureEvent  *ersz;
622          x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth;
623          x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight;
624  
625 <        strcpy(getcombuf(&x11_driver), "new\n");
625 >        tocombuf("new\n", &x11_driver);
626   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines