84 |
|
{ |
85 |
|
int nplanes; |
86 |
|
XVisualInfo ourvinfo; |
87 |
+ |
XSetWindowAttributes ourwinattr; |
88 |
|
XWMHints ourxwmhints; |
88 |
– |
Pixmap bmCursorSrc, bmCursorMsk; |
89 |
|
|
90 |
|
ourdisplay = XOpenDisplay(NULL); |
91 |
|
if (ourdisplay == NULL) { |
109 |
|
} |
110 |
|
ourvisual = ourvinfo.visual; |
111 |
|
make_gmap(GAMMA); |
112 |
– |
/* create a cursor */ |
113 |
– |
pickcursor = XCreateFontCursor (ourdisplay, XC_diamond_cross); |
112 |
|
/* open window */ |
113 |
< |
gwind = XCreateSimpleWindow(ourdisplay, ourroot, 0, 0, |
113 |
> |
ourwinattr.background_pixel = ourwhite; |
114 |
> |
ourwinattr.border_pixel = ourblack; |
115 |
> |
gwind = XCreateWindow(ourdisplay, ourroot, 0, 0, |
116 |
|
DisplayWidth(ourdisplay,ourscreen)-2*BORWIDTH, |
117 |
|
DisplayHeight(ourdisplay,ourscreen)-2*BORWIDTH, |
118 |
< |
BORWIDTH, ourblack, ourwhite); |
118 |
> |
BORWIDTH, nplanes, InputOutput, ourvisual, |
119 |
> |
CWBackPixel|CWBorderPixel, &ourwinattr); |
120 |
|
if (gwind == 0) { |
121 |
|
stderr_v("cannot create window\n"); |
122 |
|
return(NULL); |
123 |
|
} |
124 |
|
XStoreName(ourdisplay, gwind, id); |
125 |
+ |
/* create a cursor */ |
126 |
+ |
pickcursor = XCreateFontCursor(ourdisplay, XC_diamond_cross); |
127 |
|
ourgc = XCreateGC(ourdisplay, gwind, 0, NULL); |
128 |
|
ourxwmhints.flags = InputHint; |
129 |
|
ourxwmhints.input = True; |
155 |
|
xt_close(comline); |
156 |
|
comline = NULL; |
157 |
|
} |
158 |
< |
if (gwind != 0) { |
159 |
< |
freepixels(); |
160 |
< |
XFreeGC(ourdisplay, ourgc); |
161 |
< |
XDestroyWindow(ourdisplay, gwind); |
162 |
< |
gwind = 0; |
160 |
< |
ourgc = 0; |
161 |
< |
} |
158 |
> |
freepixels(); |
159 |
> |
XFreeGC(ourdisplay, ourgc); |
160 |
> |
XDestroyWindow(ourdisplay, gwind); |
161 |
> |
gwind = 0; |
162 |
> |
ourgc = 0; |
163 |
|
XFreeCursor(ourdisplay, pickcursor); |
164 |
|
XCloseDisplay(ourdisplay); |
165 |
|
ourdisplay = NULL; |
185 |
|
XSelectInput(ourdisplay, comline->w, ExposureMask); |
186 |
|
gwidth = xres; |
187 |
|
gheight = yres; |
188 |
< |
XSync(ourdisplay, 1); /* discard input */ |
188 |
> |
XFlush(ourdisplay); |
189 |
|
sleep(2); /* wait for window manager */ |
190 |
+ |
XSync(ourdisplay, 1); /* discard input */ |
191 |
|
} |
192 |
|
XClearWindow(ourdisplay, gwind); |
193 |
|
if (ourvisual->class == PseudoColor) /* reinitialize color table */ |
225 |
|
static |
226 |
|
x11_flush() /* flush output */ |
227 |
|
{ |
228 |
< |
if (ncolors <= 0) /* output necessary for death */ |
227 |
< |
XFillRectangle(ourdisplay, gwind, ourgc, 0, 0, 1 ,1); |
228 |
> |
XNoOp(ourdisplay); |
229 |
|
while (XPending(ourdisplay) > 0) |
230 |
|
getevent(); |
231 |
|
} |
254 |
|
{ |
255 |
|
if (comline != NULL) |
256 |
|
xt_puts(out, comline); |
256 |
– |
XFlush(ourdisplay); |
257 |
|
} |
258 |
|
|
259 |
|
|
261 |
|
x11_errout(msg) /* output an error message */ |
262 |
|
char *msg; |
263 |
|
{ |
264 |
– |
x11_comout(msg); |
264 |
|
stderr_v(msg); /* send to stderr also! */ |
265 |
+ |
x11_comout(msg); |
266 |
+ |
x11_flush(); |
267 |
|
} |
268 |
|
|
269 |
|
|
376 |
|
return; |
377 |
|
XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L); |
378 |
|
ncolors = 0; |
379 |
< |
if (ourmap != 0 && ourmap != DefaultColormap(ourdisplay,ourscreen)) |
379 |
> |
if (ourmap != DefaultColormap(ourdisplay,ourscreen)) |
380 |
|
XFreeColormap(ourdisplay, ourmap); |
381 |
|
ourmap = 0; |
382 |
|
} |
443 |
|
getkey(ekey) /* get input key */ |
444 |
|
register XKeyPressedEvent *ekey; |
445 |
|
{ |
446 |
< |
int n; |
446 |
> |
register int n; |
447 |
|
|
448 |
|
n = XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last, |
449 |
|
NULL, NULL); |