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.5 by greg, Thu Jun 18 14:55:24 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 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 95 | Line 94 | char  *name, *id;
94          }
95                                          /* find a usable visual */
96          nplanes = DisplayPlanes(ourdisplay, ourscreen);
97 <        if (    !XMatchVisualInfo(ourdisplay,ourscreen,
98 <                        24,TrueColor,&ourvinfo) &&
99 <                !XMatchVisualInfo(ourdisplay,ourscreen,
100 <                        24,DirectColor,&ourvinfo)       )
97 >        if (XMatchVisualInfo(ourdisplay,ourscreen,
98 >                                24,TrueColor,&ourvinfo) ||
99 >                        XMatchVisualInfo(ourdisplay,ourscreen,
100 >                                24,DirectColor,&ourvinfo)) {
101 >                ourblack = 0;
102 >                ourwhite = ourvinfo.red_mask |
103 >                                ourvinfo.green_mask |
104 >                                ourvinfo.blue_mask ;
105 >        } else {
106                  if (nplanes < 4) {
107                          stderr_v("not enough colors\n");
108                          return(NULL);
109 <                } else if (!XMatchVisualInfo(ourdisplay,ourscreen,
109 >                }
110 >                if (!XMatchVisualInfo(ourdisplay,ourscreen,
111                                          nplanes,PseudoColor,&ourvinfo) &&
112                                  !XMatchVisualInfo(ourdisplay,ourscreen,
113                                          nplanes,GrayScale,&ourvinfo)) {
114                          stderr_v("unsupported visual type\n");
115                          return(NULL);
116                  }
117 +                ourblack = BlackPixel(ourdisplay,ourscreen);
118 +                ourwhite = WhitePixel(ourdisplay,ourscreen);
119 +        }
120          make_gmap(GAMMA);
121          /* open window */
122          ourwinattr.background_pixel = ourblack;
123          ourwinattr.border_pixel = ourblack;
124 <                                        /* this is a waste! */
124 >                                        /* this is stupid */
125          ourwinattr.colormap = XCreateColormap(ourdisplay, ourroot,
126                                  ourvinfo.visual, AllocNone);
127          gwind = XCreateWindow(ourdisplay, ourroot, 0, 0,
# Line 125 | Line 133 | char  *name, *id;
133                  stderr_v("cannot create window\n");
134                  return(NULL);
135          }
136 <        XStoreName(ourdisplay, gwind, id);
136 >        XStoreName(ourdisplay, gwind, id);
137          /* create a cursor */
138          pickcursor = XCreateFontCursor(ourdisplay, XC_diamond_cross);
139          ourgc = XCreateGC(ourdisplay, gwind, 0, NULL);
# Line 205 | Line 213 | int  xres, yres;
213                                                  /* get new command line */
214          if (comline != NULL)
215                  xt_close(comline);
216 <        comline = xt_open(ourdisplay,
217 <                        DefaultGC(ourdisplay,ourscreen),
210 <                        gwind, 0, gheight, gwidth, COMHEIGHT, 0, COMFN);
216 >        comline = xt_open(ourdisplay, gwind, 0, gheight,
217 >                        gwidth, COMHEIGHT, 0, ourblack, ourwhite, COMFN);
218          if (comline == NULL) {
219                  stderr_v("Cannot open command line window\n");
220                  quit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines