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.27 by gregl, Tue Nov 11 20:03:02 1997 UTC vs.
Revision 2.31 by schorsch, Mon Jul 21 22:30:19 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1995 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  x11.c - driver for X-windows version 11
9 *
10 *     Jan 1990
6   */
7  
8 + #include "copyright.h"
9 +
10   #include  "standard.h"
11   #include  <sys/ioctl.h>
12   #ifdef sparc
# Line 82 | Line 79 | static Colormap ourmap = 0;            /* our color map */
79  
80   static int  inpcheck;                   /* whence to check input */
81  
82 < extern char  *malloc();
82 > static int      x11_getcur();
83  
84 < static int  x11_close(), x11_clear(), x11_paintr(), x11_errout(),
85 <                x11_getcur(), x11_comout(), x11_comin(), x11_flush();
84 > static void  x11_close(), x11_clear(), x11_paintr(), x11_errout(),
85 >                x11_comout(), x11_comin(), x11_flush();
86  
87 < static int  std_comin(), std_comout();
87 > static void  std_comin(), std_comout();
88  
89   static struct driver  x11_driver = {
90          x11_close, x11_clear, x11_paintr, x11_getcur,
91          NULL, NULL, x11_flush, 1.0
92   };
93  
94 < static int  getpixels(), xnewcolr(), freepixels(), resizewindow(),
95 <                getevent(), getkey(), fixwindow(), x11_getc();
94 > static int  getpixels(), x11_getc();
95 > static void  xnewcolr(), freepixels(), resizewindow(),
96 >                getevent(), getkey(), fixwindow();
97   static unsigned long  true_pixel();
98  
99  
# Line 103 | Line 101 | struct driver *
101   x11_init(name, id)              /* initialize driver */
102   char  *name, *id;
103   {
106        extern char  *getenv();
104          char  *gv;
105          int  nplanes;
106          XSetWindowAttributes    ourwinattr;
# Line 210 | Line 207 | char  *name, *id;
207   }
208  
209  
210 < static
210 > static void
211   x11_close()                     /* close our display */
212   {
213          erract[COMMAND].pf = NULL;              /* reset error vectors */
# Line 233 | Line 230 | x11_close()                    /* close our display */
230   }
231  
232  
233 < static
233 > static void
234   x11_clear(xres, yres)                   /* clear our display */
235   int  xres, yres;
236   {
# Line 254 | Line 251 | int  xres, yres;
251          }
252          XClearWindow(ourdisplay, gwind);
253                                                  /* reinitialize color table */
254 <        if (ourvinfo.class == PseudoColor || ourvinfo.class == GrayScale)
254 >        if (ourvinfo.class == PseudoColor || ourvinfo.class == GrayScale) {
255                  if (getpixels() == 0)
256                          eputs("cannot allocate colors\n");
257                  else
258                          new_ctab(ncolors);
259 +        }
260                                                  /* get new command line */
261          if (comline != NULL)
262                  xt_close(comline);
# Line 279 | Line 277 | int  xres, yres;
277   }
278  
279  
280 < static
280 > static void
281   x11_paintr(col, xmin, ymin, xmax, ymax)         /* fill a rectangle */
282   COLOR  col;
283   int  xmin, ymin, xmax, ymax;
# Line 298 | Line 296 | int  xmin, ymin, xmax, ymax;
296   }
297  
298  
299 < static
299 > static void
300   x11_flush()                     /* flush output */
301   {
302          char    buf[256];
# Line 334 | Line 332 | x11_flush()                    /* flush output */
332   }
333  
334  
335 < static
335 > static void
336   x11_comin(inp, prompt)          /* read in a command line */
337   char  *inp, *prompt;
338   {
# Line 350 | Line 348 | char  *inp, *prompt;
348   }
349  
350  
351 < static
351 > static void
352   x11_comout(outp)                /* output a string to command line */
353   char  *outp;
354   {
355 <        if (comline == NULL)
355 >        if (comline == NULL || outp == NULL || !outp[0])
356                  return;
357          xt_puts(outp, comline);
358          if (outp[strlen(outp)-1] == '\n')
# Line 362 | Line 360 | char  *outp;
360   }
361  
362  
363 < static
363 > static void
364   x11_errout(msg)                 /* output an error message */
365   char  *msg;
366   {
# Line 371 | Line 369 | char  *msg;
369   }
370  
371  
372 < static
372 > static void
373   std_comin(inp, prompt)          /* read in command line from stdin */
374   char  *inp, *prompt;
375   {
378        extern char     *gets();
379
376          if (prompt != NULL) {
377                  if (fromcombuf(inp, &x11_driver))
378                          return;
# Line 402 | Line 398 | char  *inp, *prompt;
398   }
399  
400  
401 < static
401 > static void
402   std_comout(outp)                /* write out string to stdout */
403   char    *outp;
404   {
# Line 440 | Line 436 | int  *xp, *yp;
436   }
437  
438  
439 < static
439 > static void
440   xnewcolr(ndx, r, g, b)          /* enter a color into hardware table */
441   int  ndx;
442   int  r, g, b;
# Line 480 | Line 476 | loop:
476                          return(ncolors = 0);
477                  if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,pixval,ncolors))
478                          break;
479 <                free((char *)pixval);
479 >                free((void *)pixval);
480                  pixval = NULL;
481          }
482          if (pixval == NULL) {
# Line 509 | Line 505 | loop:
505   }
506  
507  
508 < static
508 > static void
509   freepixels()                            /* free our pixels */
510   {
511          if (ncolors == 0)
512                  return;
513          XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L);
514 <        free((char *)pixval);
514 >        free((void *)pixval);
515          pixval = NULL;
516          ncolors = 0;
517          if (ourmap != DefaultColormap(ourdisplay,ourscreen))
# Line 551 | Line 547 | x11_getc()                     /* get a command character */
547   }
548  
549  
550 < static
550 > static void
551   getevent()                      /* get next event */
552   {
553          XNextEvent(ourdisplay, levptr(XEvent));
# Line 565 | Line 561 | getevent()                     /* get next event */
561                  break;
562          case MapNotify:
563                  if (ourvinfo.class == PseudoColor ||
564 <                                ourvinfo.class == GrayScale)
564 >                                ourvinfo.class == GrayScale) {
565                          if (getpixels() == 0)
566                                  eputs("cannot allocate colors\n");
567                          else
568                                  new_ctab(ncolors);
569 +                }
570                  mapped = 1;
571                  break;
572          case Expose:
# Line 584 | Line 581 | getevent()                     /* get next event */
581   }
582  
583  
584 < static
584 > static void
585   getkey(ekey)                            /* get input key */
586   register XKeyPressedEvent  *ekey;
587   {
# Line 597 | Line 594 | register XKeyPressedEvent  *ekey;
594   }
595  
596  
597 < static
597 > static void
598   fixwindow(eexp)                         /* repair damage to window */
599   register XExposeEvent  *eexp;
600   {
# Line 615 | Line 612 | register XExposeEvent  *eexp;
612   }
613  
614  
615 < static
615 > static void
616   resizewindow(ersz)                      /* resize window */
617   register XConfigureEvent  *ersz;
618   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines