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.2 by greg, Fri May 29 10:57:15 1992 UTC vs.
Revision 2.6 by greg, Wed Jun 24 09:12:50 1992 UTC

# Line 1 | Line 1
1 + /* Copyright (c) 1992 Regents of the University of California */
2 +
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
5   #endif
6  
5 /* Copyright (c) 1989 Regents of the University of California */
6
7   /*
8 < *  x11.c - driver for X-windows version 11.3
8 > *  x11.c - driver for X-windows version 11
9   *
10   *     Jan 1990
11   */
# Line 23 | Line 23 | static char SCCSid[] = "$SunId$ LBL";
23   #include  "x11twind.h"
24   #include  "x11icon.h"
25  
26 < #define GAMMA           2.2             /* exponent for color correction */
26 > #define GAMMA           2.2             /* default exponent correction */
27  
28   #define MINWIDTH        (32*COMCW)      /* minimum graphics window width */
29   #define MINHEIGHT       MINWIDTH        /* minimum graphics window height */
# Line 38 | Line 38 | static char SCCSid[] = "$SunId$ LBL";
38  
39   #define  ourscreen      DefaultScreen(ourdisplay)
40   #define  ourroot        RootWindow(ourdisplay,ourscreen)
41 #define  ourwhite       WhitePixel(ourdisplay,ourscreen)
42 #define  ourblack       BlackPixel(ourdisplay,ourscreen)
41  
42   #define  levptr(etype)  ((etype *)&currentevent)
43  
# Line 47 | Line 45 | static XEvent  currentevent;           /* current event */
45  
46   static int  ncolors = 0;                /* color table size */
47   static unsigned long  *pixval = NULL;   /* allocated pixels */
48 + static unsigned long  ourblack=0, ourwhite=1;
49  
50   static Display  *ourdisplay = NULL;     /* our display */
51  
# Line 83 | Line 82 | struct driver *
82   x11_init(name, id)              /* initialize driver */
83   char  *name, *id;
84   {
85 +        extern char  *getenv();
86 +        char  *gv;
87          int  nplanes;
88          XSetWindowAttributes    ourwinattr;
89          XWMHints  ourxwmhints;
# Line 95 | Line 96 | char  *name, *id;
96          }
97                                          /* find a usable visual */
98          nplanes = DisplayPlanes(ourdisplay, ourscreen);
99 <        if (    !XMatchVisualInfo(ourdisplay,ourscreen,
100 <                        24,TrueColor,&ourvinfo) &&
101 <                !XMatchVisualInfo(ourdisplay,ourscreen,
102 <                        24,DirectColor,&ourvinfo)       )
99 >        if (XMatchVisualInfo(ourdisplay,ourscreen,
100 >                                24,TrueColor,&ourvinfo) ||
101 >                        XMatchVisualInfo(ourdisplay,ourscreen,
102 >                                24,DirectColor,&ourvinfo)) {
103 >                ourblack = 0;
104 >                ourwhite = ourvinfo.red_mask |
105 >                                ourvinfo.green_mask |
106 >                                ourvinfo.blue_mask ;
107 >        } else {
108                  if (nplanes < 4) {
109                          stderr_v("not enough colors\n");
110                          return(NULL);
111 <                } else if (!XMatchVisualInfo(ourdisplay,ourscreen,
111 >                }
112 >                if (!XMatchVisualInfo(ourdisplay,ourscreen,
113                                          nplanes,PseudoColor,&ourvinfo) &&
114                                  !XMatchVisualInfo(ourdisplay,ourscreen,
115                                          nplanes,GrayScale,&ourvinfo)) {
116                          stderr_v("unsupported visual type\n");
117                          return(NULL);
118                  }
119 <        make_gmap(GAMMA);
120 <        /* open window */
119 >                ourblack = BlackPixel(ourdisplay,ourscreen);
120 >                ourwhite = WhitePixel(ourdisplay,ourscreen);
121 >        }
122 >                                        /* set gamma */
123 >        if ((gv = getenv("GAMMA")) != NULL)
124 >                make_gmap(atof(gv));
125 >        else
126 >                make_gmap(GAMMA);
127 >                                        /* open window */
128          ourwinattr.background_pixel = ourblack;
129          ourwinattr.border_pixel = ourblack;
130 <                                        /* this is a waste! */
130 >                                        /* this is stupid */
131          ourwinattr.colormap = XCreateColormap(ourdisplay, ourroot,
132                                  ourvinfo.visual, AllocNone);
133          gwind = XCreateWindow(ourdisplay, ourroot, 0, 0,
# Line 125 | Line 139 | char  *name, *id;
139                  stderr_v("cannot create window\n");
140                  return(NULL);
141          }
142 <        XStoreName(ourdisplay, gwind, id);
142 >        XStoreName(ourdisplay, gwind, id);
143          /* create a cursor */
144          pickcursor = XCreateFontCursor(ourdisplay, XC_diamond_cross);
145          ourgc = XCreateGC(ourdisplay, gwind, 0, NULL);
# Line 205 | Line 219 | int  xres, yres;
219                                                  /* get new command line */
220          if (comline != NULL)
221                  xt_close(comline);
222 <        comline = xt_open(ourdisplay,
223 <                        DefaultGC(ourdisplay,ourscreen),
210 <                        gwind, 0, gheight, gwidth, COMHEIGHT, 0, COMFN);
222 >        comline = xt_open(ourdisplay, gwind, 0, gheight,
223 >                        gwidth, COMHEIGHT, 0, ourblack, ourwhite, COMFN);
224          if (comline == NULL) {
225                  stderr_v("Cannot open command line window\n");
226                  quit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines