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 |
|
*/ |
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)) { |
116 |
|
} |
117 |
|
ourblack = BlackPixel(ourdisplay,ourscreen); |
118 |
|
ourwhite = WhitePixel(ourdisplay,ourscreen); |
113 |
– |
} else { |
114 |
– |
ourblack = 0; |
115 |
– |
ourwhite = ~0; |
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, |
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); |