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.28 by gregl, Tue Dec 2 15:57:45 1997 UTC vs.
Revision 2.29 by greg, Sat Feb 22 02:07:29 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
6 + */
7 +
8 + /* ====================================================================
9 + * The Radiance Software License, Version 1.0
10   *
11 < *     Jan 1990
11 > * Copyright (c) 1990 - 2002 The Regents of the University of California,
12 > * through Lawrence Berkeley National Laboratory.   All rights reserved.
13 > *
14 > * Redistribution and use in source and binary forms, with or without
15 > * modification, are permitted provided that the following conditions
16 > * are met:
17 > *
18 > * 1. Redistributions of source code must retain the above copyright
19 > *         notice, this list of conditions and the following disclaimer.
20 > *
21 > * 2. Redistributions in binary form must reproduce the above copyright
22 > *       notice, this list of conditions and the following disclaimer in
23 > *       the documentation and/or other materials provided with the
24 > *       distribution.
25 > *
26 > * 3. The end-user documentation included with the redistribution,
27 > *           if any, must include the following acknowledgment:
28 > *             "This product includes Radiance software
29 > *                 (http://radsite.lbl.gov/)
30 > *                 developed by the Lawrence Berkeley National Laboratory
31 > *               (http://www.lbl.gov/)."
32 > *       Alternately, this acknowledgment may appear in the software itself,
33 > *       if and wherever such third-party acknowledgments normally appear.
34 > *
35 > * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
36 > *       and "The Regents of the University of California" must
37 > *       not be used to endorse or promote products derived from this
38 > *       software without prior written permission. For written
39 > *       permission, please contact [email protected].
40 > *
41 > * 5. Products derived from this software may not be called "Radiance",
42 > *       nor may "Radiance" appear in their name, without prior written
43 > *       permission of Lawrence Berkeley National Laboratory.
44 > *
45 > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
46 > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
47 > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48 > * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
49 > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
52 > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
53 > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54 > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
55 > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 > * SUCH DAMAGE.
57 > * ====================================================================
58 > *
59 > * This software consists of voluntary contributions made by many
60 > * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
61 > * information on Lawrence Berkeley National Laboratory, please see
62 > * <http://www.lbl.gov/>.
63   */
64  
65   #include  "standard.h"
# Line 82 | Line 134 | static Colormap ourmap = 0;            /* our color map */
134  
135   static int  inpcheck;                   /* whence to check input */
136  
137 < extern char  *malloc();
137 > static int      x11_getcur();
138  
139 < static int  x11_close(), x11_clear(), x11_paintr(), x11_errout(),
140 <                x11_getcur(), x11_comout(), x11_comin(), x11_flush();
139 > static void  x11_close(), x11_clear(), x11_paintr(), x11_errout(),
140 >                x11_comout(), x11_comin(), x11_flush();
141  
142 < static int  std_comin(), std_comout();
142 > static void  std_comin(), std_comout();
143  
144   static struct driver  x11_driver = {
145          x11_close, x11_clear, x11_paintr, x11_getcur,
146          NULL, NULL, x11_flush, 1.0
147   };
148  
149 < static int  getpixels(), xnewcolr(), freepixels(), resizewindow(),
150 <                getevent(), getkey(), fixwindow(), x11_getc();
149 > static int  getpixels(), x11_getc();
150 > static void  xnewcolr(), freepixels(), resizewindow(),
151 >                getevent(), getkey(), fixwindow();
152   static unsigned long  true_pixel();
153  
154  
# Line 103 | Line 156 | struct driver *
156   x11_init(name, id)              /* initialize driver */
157   char  *name, *id;
158   {
106        extern char  *getenv();
159          char  *gv;
160          int  nplanes;
161          XSetWindowAttributes    ourwinattr;
# Line 210 | Line 262 | char  *name, *id;
262   }
263  
264  
265 < static
265 > static void
266   x11_close()                     /* close our display */
267   {
268          erract[COMMAND].pf = NULL;              /* reset error vectors */
# Line 233 | Line 285 | x11_close()                    /* close our display */
285   }
286  
287  
288 < static
288 > static void
289   x11_clear(xres, yres)                   /* clear our display */
290   int  xres, yres;
291   {
# Line 279 | Line 331 | int  xres, yres;
331   }
332  
333  
334 < static
334 > static void
335   x11_paintr(col, xmin, ymin, xmax, ymax)         /* fill a rectangle */
336   COLOR  col;
337   int  xmin, ymin, xmax, ymax;
# Line 298 | Line 350 | int  xmin, ymin, xmax, ymax;
350   }
351  
352  
353 < static
353 > static void
354   x11_flush()                     /* flush output */
355   {
356          char    buf[256];
# Line 334 | Line 386 | x11_flush()                    /* flush output */
386   }
387  
388  
389 < static
389 > static void
390   x11_comin(inp, prompt)          /* read in a command line */
391   char  *inp, *prompt;
392   {
# Line 350 | Line 402 | char  *inp, *prompt;
402   }
403  
404  
405 < static
405 > static void
406   x11_comout(outp)                /* output a string to command line */
407   char  *outp;
408   {
# Line 362 | Line 414 | char  *outp;
414   }
415  
416  
417 < static
417 > static void
418   x11_errout(msg)                 /* output an error message */
419   char  *msg;
420   {
# Line 371 | Line 423 | char  *msg;
423   }
424  
425  
426 < static
426 > static void
427   std_comin(inp, prompt)          /* read in command line from stdin */
428   char  *inp, *prompt;
429   {
378        extern char     *gets();
379
430          if (prompt != NULL) {
431                  if (fromcombuf(inp, &x11_driver))
432                          return;
# Line 402 | Line 452 | char  *inp, *prompt;
452   }
453  
454  
455 < static
455 > static void
456   std_comout(outp)                /* write out string to stdout */
457   char    *outp;
458   {
# Line 440 | Line 490 | int  *xp, *yp;
490   }
491  
492  
493 < static
493 > static void
494   xnewcolr(ndx, r, g, b)          /* enter a color into hardware table */
495   int  ndx;
496   int  r, g, b;
# Line 480 | Line 530 | loop:
530                          return(ncolors = 0);
531                  if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,pixval,ncolors))
532                          break;
533 <                free((char *)pixval);
533 >                free((void *)pixval);
534                  pixval = NULL;
535          }
536          if (pixval == NULL) {
# Line 509 | Line 559 | loop:
559   }
560  
561  
562 < static
562 > static void
563   freepixels()                            /* free our pixels */
564   {
565          if (ncolors == 0)
566                  return;
567          XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L);
568 <        free((char *)pixval);
568 >        free((void *)pixval);
569          pixval = NULL;
570          ncolors = 0;
571          if (ourmap != DefaultColormap(ourdisplay,ourscreen))
# Line 551 | Line 601 | x11_getc()                     /* get a command character */
601   }
602  
603  
604 < static
604 > static void
605   getevent()                      /* get next event */
606   {
607          XNextEvent(ourdisplay, levptr(XEvent));
# Line 584 | Line 634 | getevent()                     /* get next event */
634   }
635  
636  
637 < static
637 > static void
638   getkey(ekey)                            /* get input key */
639   register XKeyPressedEvent  *ekey;
640   {
# Line 597 | Line 647 | register XKeyPressedEvent  *ekey;
647   }
648  
649  
650 < static
650 > static void
651   fixwindow(eexp)                         /* repair damage to window */
652   register XExposeEvent  *eexp;
653   {
# Line 615 | Line 665 | register XExposeEvent  *eexp;
665   }
666  
667  
668 < static
668 > static void
669   resizewindow(ersz)                      /* resize window */
670   register XConfigureEvent  *ersz;
671   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines