194 |
|
|
195 |
|
init() /* get data and open window */ |
196 |
|
{ |
197 |
+ |
XSetWindowAttributes ourwinattr; |
198 |
|
XSizeHints oursizhints; |
199 |
|
register int i; |
200 |
|
|
207 |
|
} |
208 |
|
if ((thedisplay = XOpenDisplay(NULL)) == NULL) |
209 |
|
quiterr("can't open display; DISPLAY variable set?"); |
209 |
– |
wind = XCreateSimpleWindow(thedisplay, |
210 |
– |
ourroot, 0, 0, xmax, ymax, BORWIDTH, ourblack, ourwhite); |
211 |
– |
if (wind == 0) |
212 |
– |
quiterr("can't create window"); |
210 |
|
if (maxcolors == 0) { /* get number of available colors */ |
211 |
|
i = DisplayPlanes(thedisplay,ourscreen); |
212 |
|
maxcolors = i > 8 ? 256 : 1<<i; |
213 |
|
if (maxcolors > 4) maxcolors -= 2; |
214 |
|
} |
215 |
+ |
/* store image */ |
216 |
+ |
getras(); |
217 |
+ |
/* open window */ |
218 |
+ |
ourwinattr.border_pixel = ourblack; |
219 |
+ |
ourwinattr.background_pixel = ourwhite; |
220 |
+ |
wind = XCreateWindow(thedisplay, ourroot, 0, 0, xmax, ymax, BORWIDTH, |
221 |
+ |
0, InputOutput, ourras->visual, |
222 |
+ |
CWBackPixel|CWBorderPixel, &ourwinattr); |
223 |
+ |
if (wind == 0) |
224 |
+ |
quiterr("can't create window"); |
225 |
|
fontid = XLoadFont(thedisplay, FONTNAME); |
226 |
|
if (fontid == 0) |
227 |
|
quiterr("can't get font"); |
251 |
|
} |
252 |
|
XSetNormalHints(thedisplay, wind, &oursizhints); |
253 |
|
} |
247 |
– |
/* store image */ |
248 |
– |
getras(); |
254 |
|
XSelectInput(thedisplay, wind, ButtonPressMask|ButtonReleaseMask |
255 |
|
|ButtonMotionMask|StructureNotifyMask |
256 |
|
|KeyPressMask|ExposureMask); |