5 |
|
/* Copyright (c) 1989 Regents of the University of California */ |
6 |
|
|
7 |
|
/* |
8 |
< |
* x11.c - driver for X-windows version 10.4 |
8 |
> |
* x11.c - driver for X-windows version 11.3 |
9 |
|
* |
10 |
< |
* 1989 |
10 |
> |
* Jan 1990 |
11 |
|
*/ |
12 |
|
|
13 |
|
#include <stdio.h> |
15 |
|
#include <sys/ioctl.h> |
16 |
|
|
17 |
|
#include <X11/Xlib.h> |
18 |
< |
#include <X11/cursorfont.h> |
19 |
< |
#include <X11/Xutil.h> |
18 |
> |
#include <X11/cursorfont.h> |
19 |
> |
#include <X11/Xutil.h> |
20 |
|
|
21 |
|
#include "color.h" |
22 |
|
#include "driver.h" |
24 |
|
|
25 |
|
#define GAMMA 2.2 /* exponent for color correction */ |
26 |
|
|
27 |
+ |
#define MINWIDTH (32*COMCW) /* minimum graphics window width */ |
28 |
+ |
#define MINHEIGHT MINWIDTH /* minimum graphics window height */ |
29 |
+ |
|
30 |
|
#define BORWIDTH 5 /* border width */ |
31 |
|
#define COMHEIGHT (COMLH*COMCH) /* command line height (pixels) */ |
32 |
|
|
35 |
|
#define COMCW 8 /* approx. character width (pixels) */ |
36 |
|
#define COMCH 14 /* approx. character height (pixels) */ |
37 |
|
|
38 |
< |
#ifndef WFLUSH |
39 |
< |
#define WFLUSH 30 /* flush after this many rays */ |
40 |
< |
#endif |
38 |
> |
#define ourscreen DefaultScreen(ourdisplay) |
39 |
> |
#define ourroot RootWindow(ourdisplay,ourscreen) |
40 |
> |
#define ourwhite WhitePixel(ourdisplay,ourscreen) |
41 |
> |
#define ourblack BlackPixel(ourdisplay,ourscreen) |
42 |
|
|
43 |
< |
#define checkinp() while (XPending(ourdisplay) > 0) getevent() |
43 |
> |
#define levptr(etype) ((etype *)¤tevent) |
44 |
|
|
45 |
< |
#define levptr(etype) ((etype *)&thisevent) |
45 |
> |
static XEvent currentevent; /* current event */ |
46 |
|
|
43 |
– |
static char *clientname; /* calling client's name */ |
44 |
– |
|
45 |
– |
static XEvent thisevent; /* current event */ |
46 |
– |
|
47 |
|
static int ncolors = 0; /* color table size */ |
48 |
|
static int *pixval = NULL; /* allocated pixels */ |
49 |
|
|
50 |
|
static Display *ourdisplay = NULL; /* our display */ |
51 |
|
|
52 |
+ |
static Visual *ourvisual; /* our visual structure */ |
53 |
+ |
|
54 |
|
static Window gwind = 0; /* our graphics window */ |
55 |
|
|
56 |
|
static Cursor pickcursor = 0; /* cursor used for picking */ |
57 |
|
|
58 |
< |
static int gwidth = 0; /* graphics window width */ |
57 |
< |
static int gheight = 0; /* graphics window height */ |
58 |
> |
static int gwidth, gheight; /* graphics window size */ |
59 |
|
|
60 |
|
static TEXTWIND *comline = NULL; /* our command line */ |
61 |
|
|
65 |
|
|
66 |
|
static GC ourgc = 0; /* our graphics context for drawing */ |
67 |
|
|
68 |
< |
static Colormap ourmap; /* our color map */ |
68 |
> |
static Colormap ourmap = 0; /* our color map */ |
69 |
|
|
70 |
|
extern char *malloc(); |
71 |
|
|
72 |
|
int x11_close(), x11_clear(), x11_paintr(), x11_errout(), |
73 |
< |
x11_getcur(), x11_comout(), x11_comin(); |
73 |
> |
x11_getcur(), x11_comout(), x11_comin(), x11_flush(); |
74 |
|
|
75 |
|
static struct driver x11_driver = { |
76 |
|
x11_close, x11_clear, x11_paintr, x11_getcur, |
77 |
< |
x11_comout, x11_comin, 1.0 |
77 |
> |
x11_comout, x11_comin, x11_flush, 1.0 |
78 |
|
}; |
79 |
|
|
80 |
|
|
82 |
|
x11_init(name, id) /* initialize driver */ |
83 |
|
char *name, *id; |
84 |
|
{ |
85 |
< |
Pixmap bmCursorSrc, bmCursorMsk; |
85 |
> |
int nplanes; |
86 |
> |
XVisualInfo ourvinfo; |
87 |
> |
XWMHints ourxwmhints; |
88 |
|
|
89 |
|
ourdisplay = XOpenDisplay(NULL); |
90 |
|
if (ourdisplay == NULL) { |
91 |
|
stderr_v("cannot open X-windows; DISPLAY variable set?\n"); |
92 |
|
return(NULL); |
93 |
|
} |
94 |
< |
if (DisplayPlanes(ourdisplay, DefaultScreen(ourdisplay)) < 4) { |
94 |
> |
nplanes = DisplayPlanes(ourdisplay, ourscreen); |
95 |
> |
if (nplanes < 4) { |
96 |
|
stderr_v("not enough colors\n"); |
97 |
|
return(NULL); |
98 |
+ |
} else if (nplanes <= 12) { |
99 |
+ |
if (!XMatchVisualInfo(ourdisplay,ourscreen, |
100 |
+ |
nplanes,PseudoColor,&ourvinfo)) { |
101 |
+ |
stderr_v("PseudoColor not supported\n"); |
102 |
+ |
return(NULL); |
103 |
+ |
} |
104 |
+ |
} else if (!XMatchVisualInfo(ourdisplay,ourscreen, |
105 |
+ |
nplanes,TrueColor,&ourvinfo)) { |
106 |
+ |
stderr_v("TrueColor not supported\n"); |
107 |
+ |
return(NULL); |
108 |
|
} |
109 |
< |
ourmap = DefaultColormap(ourdisplay,DefaultScreen(ourdisplay)); |
110 |
< |
make_gmap(GAMMA); /* make color map */ |
97 |
< |
/* |
98 |
< |
bmCursorSrc = XCreateBitmapFromData(ourdisplay, |
99 |
< |
gwind, bcross_bits, |
100 |
< |
bcross_width, bcross_height); |
101 |
< |
bmCursorMsk = XCreateBitmapFromData(ourdisplay, |
102 |
< |
gwind, bcross_mask_bits, |
103 |
< |
bcross_width, bcross_height); |
104 |
< |
|
105 |
< |
pickcursor = XCreatePixmapCursor(ourdisplay, |
106 |
< |
bmCursorSrc, bmCursorMsk, |
107 |
< |
BlackPixel(ourdisplay, |
108 |
< |
DefaultScreen(ourdisplay)), |
109 |
< |
WhitePixel(ourdisplay, |
110 |
< |
DefaultScreen(ourdisplay)), |
111 |
< |
bcross_x_hot, bcross_y_hot); |
112 |
< |
XFreePixmap(ourdisplay, bmCursorSrc); |
113 |
< |
XFreePixmap(ourdisplay, bmCursorMsk); |
114 |
< |
*/ |
109 |
> |
ourvisual = ourvinfo.visual; |
110 |
> |
make_gmap(GAMMA); |
111 |
|
/* create a cursor */ |
112 |
|
pickcursor = XCreateFontCursor (ourdisplay, XC_diamond_cross); |
113 |
< |
/* new */ |
114 |
< |
clientname = id; |
115 |
< |
x11_driver.xsiz = DisplayWidth(ourdisplay,DefaultScreen(ourdisplay)) |
116 |
< |
- 2*BORWIDTH; |
117 |
< |
x11_driver.ysiz = DisplayHeight(ourdisplay,DefaultScreen(ourdisplay)) |
118 |
< |
- (COMHEIGHT + 2*BORWIDTH); |
113 |
> |
/* open window */ |
114 |
> |
gwind = XCreateSimpleWindow(ourdisplay, ourroot, 0, 0, |
115 |
> |
DisplayWidth(ourdisplay,ourscreen)-2*BORWIDTH, |
116 |
> |
DisplayHeight(ourdisplay,ourscreen)-2*BORWIDTH, |
117 |
> |
BORWIDTH, ourblack, ourwhite); |
118 |
> |
if (gwind == 0) { |
119 |
> |
stderr_v("cannot create window\n"); |
120 |
> |
return(NULL); |
121 |
> |
} |
122 |
> |
XStoreName(ourdisplay, gwind, id); |
123 |
> |
ourgc = XCreateGC(ourdisplay, gwind, 0, NULL); |
124 |
> |
ourxwmhints.flags = InputHint; |
125 |
> |
ourxwmhints.input = True; |
126 |
> |
XSetWMHints(ourdisplay, gwind, &ourxwmhints); |
127 |
> |
XSelectInput(ourdisplay, gwind, ExposureMask); |
128 |
> |
XMapWindow(ourdisplay, gwind); |
129 |
> |
XWindowEvent(ourdisplay, gwind, ExposureMask, levptr(XExposeEvent)); |
130 |
> |
gwidth = levptr(XExposeEvent)->width; |
131 |
> |
gheight = levptr(XExposeEvent)->height - COMHEIGHT; |
132 |
> |
x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth; |
133 |
> |
x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight; |
134 |
|
x11_driver.inpready = 0; |
135 |
|
cmdvec = x11_comout; /* set error vectors */ |
136 |
|
if (wrnvec != NULL) |
151 |
|
xt_close(comline); |
152 |
|
comline = NULL; |
153 |
|
} |
143 |
– |
if (gwind != 0) { |
144 |
– |
XFreeGC(ourdisplay, ourgc); |
145 |
– |
XDestroyWindow(ourdisplay, gwind); |
146 |
– |
gwind = 0; |
147 |
– |
gwidth = gheight = 0; |
148 |
– |
ourgc = 0; |
149 |
– |
} |
150 |
– |
XFreeCursor(ourdisplay, pickcursor); |
154 |
|
freepixels(); |
155 |
+ |
XFreeGC(ourdisplay, ourgc); |
156 |
+ |
XDestroyWindow(ourdisplay, gwind); |
157 |
+ |
gwind = 0; |
158 |
+ |
ourgc = 0; |
159 |
+ |
XFreeCursor(ourdisplay, pickcursor); |
160 |
|
XCloseDisplay(ourdisplay); |
161 |
|
ourdisplay = NULL; |
162 |
|
} |
166 |
|
x11_clear(xres, yres) /* clear our display */ |
167 |
|
int xres, yres; |
168 |
|
{ |
161 |
– |
XWMHints ourxwmhints; |
162 |
– |
XSetWindowAttributes ourwindowattr; |
163 |
– |
|
169 |
|
if (xres != gwidth || yres != gheight) { /* change window */ |
170 |
|
if (comline != NULL) |
171 |
|
xt_close(comline); |
172 |
< |
if (gwind == 0) { /* new window */ |
173 |
< |
ourwindowattr.backing_store = Always; |
169 |
< |
ourwindowattr.background_pixel = |
170 |
< |
WhitePixel(ourdisplay, DefaultScreen(ourdisplay)); |
171 |
< |
ourwindowattr.border_pixel = |
172 |
< |
BlackPixel(ourdisplay, DefaultScreen(ourdisplay)); |
173 |
< |
gwind = XCreateWindow(ourdisplay, |
174 |
< |
RootWindow(ourdisplay, |
175 |
< |
DefaultScreen(ourdisplay)), |
176 |
< |
0, 0, xres, yres+COMHEIGHT, BORWIDTH, |
177 |
< |
0, InputOutput, CopyFromParent, |
178 |
< |
CWBackingStore|CWBackPixel|CWBorderPixel, |
179 |
< |
&ourwindowattr); |
180 |
< |
if (gwind == 0) |
181 |
< |
goto fail; |
182 |
< |
XStoreName(ourdisplay, gwind, clientname); |
183 |
< |
ourgc = XCreateGC(ourdisplay, gwind, 0, NULL); |
184 |
< |
ourxwmhints.flags = InputHint; |
185 |
< |
ourxwmhints.input = True; |
186 |
< |
XSetWMHints(ourdisplay, gwind, &ourxwmhints); |
187 |
< |
XSelectInput(ourdisplay, gwind, |
188 |
< |
KeyPressMask|ButtonPressMask); |
189 |
< |
XMapWindow(ourdisplay, gwind); |
190 |
< |
} else /* resize window */ |
191 |
< |
XResizeWindow(ourdisplay, gwind, xres, yres+COMHEIGHT); |
172 |
> |
XSelectInput(ourdisplay, gwind, 0); |
173 |
> |
XResizeWindow(ourdisplay, gwind, xres, yres+COMHEIGHT); |
174 |
|
comline = xt_open(ourdisplay, |
175 |
< |
DefaultGC(ourdisplay,DefaultScreen(ourdisplay)), |
175 |
> |
DefaultGC(ourdisplay,ourscreen), |
176 |
|
gwind, 0, yres, xres, COMHEIGHT, 0, COMFN); |
177 |
< |
if (comline == NULL) |
178 |
< |
goto fail; |
177 |
> |
if (comline == NULL) { |
178 |
> |
stderr_v("Cannot open command line window\n"); |
179 |
> |
quit(1); |
180 |
> |
} |
181 |
> |
XSelectInput(ourdisplay, comline->w, ExposureMask); |
182 |
|
gwidth = xres; |
183 |
|
gheight = yres; |
184 |
< |
} else /* just clear */ |
185 |
< |
XClearWindow(ourdisplay, gwind); |
186 |
< |
/* reinitialize color table */ |
187 |
< |
if (ncolors == 0 && getpixels() == 0) |
188 |
< |
stderr_v("cannot allocate colors\n"); |
189 |
< |
else |
190 |
< |
new_ctab(ncolors); |
191 |
< |
return; |
192 |
< |
fail: |
193 |
< |
stderr_v("Failure opening window in x11_clear\n"); |
194 |
< |
quit(1); |
184 |
> |
XFlush(ourdisplay); |
185 |
> |
sleep(2); /* wait for window manager */ |
186 |
> |
XSync(ourdisplay, 1); /* discard input */ |
187 |
> |
} |
188 |
> |
XClearWindow(ourdisplay, gwind); |
189 |
> |
if (ourvisual->class == PseudoColor) /* reinitialize color table */ |
190 |
> |
if (getpixels() == 0) |
191 |
> |
stderr_v("cannot allocate colors\n"); |
192 |
> |
else |
193 |
> |
new_ctab(ncolors); |
194 |
> |
|
195 |
> |
XSelectInput(ourdisplay, gwind, |
196 |
> |
StructureNotifyMask|ExposureMask|KeyPressMask|ButtonPressMask); |
197 |
|
} |
198 |
|
|
199 |
|
|
202 |
|
COLOR col; |
203 |
|
int xmin, ymin, xmax, ymax; |
204 |
|
{ |
218 |
– |
extern long nrays; /* global ray count */ |
205 |
|
extern int xnewcolr(); /* pixel assignment routine */ |
206 |
< |
static long lastflush = 0; /* ray count at last flush */ |
206 |
> |
extern unsigned long true_pixel(); |
207 |
> |
unsigned long pixel; |
208 |
|
|
209 |
< |
if (ncolors > 0) { |
210 |
< |
XSetForeground(ourdisplay, ourgc, |
211 |
< |
pixval[get_pixel(col, xnewcolr)]); |
212 |
< |
XFillRectangle(ourdisplay, gwind, |
213 |
< |
ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin); |
214 |
< |
} |
215 |
< |
if (nrays - lastflush >= WFLUSH) { |
216 |
< |
if (ncolors <= 0) /* output necessary for death */ |
217 |
< |
XFillRectangle(ourdisplay, gwind, |
231 |
< |
ourgc, 0, 0, 1 ,1); |
232 |
< |
checkinp(); |
233 |
< |
lastflush = nrays; |
234 |
< |
} |
209 |
> |
if (ncolors > 0) |
210 |
> |
pixel = pixval[get_pixel(col, xnewcolr)]; |
211 |
> |
else if (ourvisual->class == TrueColor) |
212 |
> |
pixel = true_pixel(col); |
213 |
> |
else |
214 |
> |
return; |
215 |
> |
XSetForeground(ourdisplay, ourgc, pixel); |
216 |
> |
XFillRectangle(ourdisplay, gwind, |
217 |
> |
ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin); |
218 |
|
} |
219 |
|
|
220 |
|
|
221 |
|
static |
222 |
+ |
x11_flush() /* flush output */ |
223 |
+ |
{ |
224 |
+ |
if (ncolors <= 0 && ourvisual->class != TrueColor) /* dummy */ |
225 |
+ |
XFillRectangle(ourdisplay, gwind, ourgc, 0, 0, 1 ,1); |
226 |
+ |
while (XPending(ourdisplay) > 0) |
227 |
+ |
getevent(); |
228 |
+ |
} |
229 |
+ |
|
230 |
+ |
|
231 |
+ |
static |
232 |
|
x11_comin(inp, prompt) /* read in a command line */ |
233 |
|
char *inp, *prompt; |
234 |
|
{ |
235 |
|
int x11_getc(), x11_comout(); |
236 |
|
|
237 |
|
if (prompt != NULL) |
238 |
< |
xt_puts(prompt, comline); |
238 |
> |
if (fromcombuf(inp, &x11_driver)) |
239 |
> |
return; |
240 |
> |
else |
241 |
> |
xt_puts(prompt, comline); |
242 |
|
xt_cursor(comline, TBLKCURS); |
243 |
|
editline(inp, x11_getc, x11_comout); |
244 |
|
xt_cursor(comline, TNOCURS); |
251 |
|
{ |
252 |
|
if (comline != NULL) |
253 |
|
xt_puts(out, comline); |
258 |
– |
XFlush(ourdisplay); |
254 |
|
} |
255 |
|
|
256 |
|
|
314 |
|
static int |
315 |
|
getpixels() /* get the color map */ |
316 |
|
{ |
317 |
< |
Visual *ourvis = DefaultVisual(ourdisplay,DefaultScreen(ourdisplay)); |
318 |
< |
|
319 |
< |
freepixels(); |
320 |
< |
for (ncolors=(ourvis->map_entries)-3; ncolors>12; ncolors=ncolors*.937){ |
317 |
> |
if (ncolors > 0) |
318 |
> |
return(ncolors); |
319 |
> |
if (ourvisual == DefaultVisual(ourdisplay,ourscreen)) { |
320 |
> |
ourmap = DefaultColormap(ourdisplay,ourscreen); |
321 |
> |
goto loop; |
322 |
> |
} |
323 |
> |
newmap: |
324 |
> |
ourmap = XCreateColormap(ourdisplay,gwind,ourvisual,AllocNone); |
325 |
> |
loop: |
326 |
> |
for (ncolors = ourvisual->map_entries; |
327 |
> |
ncolors > ourvisual->map_entries/3; |
328 |
> |
ncolors = ncolors*.937) { |
329 |
|
pixval = (int *)malloc(ncolors*sizeof(int)); |
330 |
|
if (pixval == NULL) |
331 |
< |
break; |
331 |
> |
return(ncolors = 0); |
332 |
|
if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0, |
333 |
|
pixval,ncolors) != 0) |
334 |
< |
return(ncolors); |
334 |
> |
break; |
335 |
|
free((char *)pixval); |
336 |
+ |
pixval = NULL; |
337 |
|
} |
338 |
< |
return(ncolors = 0); |
338 |
> |
if (pixval == NULL) { |
339 |
> |
if (ourmap == DefaultColormap(ourdisplay,ourscreen)) |
340 |
> |
goto newmap; /* try it with our map */ |
341 |
> |
else |
342 |
> |
return(ncolors = 0); /* failed */ |
343 |
> |
} |
344 |
> |
if (ourmap != DefaultColormap(ourdisplay,ourscreen)) { |
345 |
> |
XColor thiscolor; |
346 |
> |
register int i, j; |
347 |
> |
/* reset black and white */ |
348 |
> |
for (i = 0; i < ncolors; i++) { |
349 |
> |
if (pixval[i] != ourblack && pixval[i] != ourwhite) |
350 |
> |
continue; |
351 |
> |
thiscolor.pixel = pixval[i]; |
352 |
> |
thiscolor.flags = DoRed|DoGreen|DoBlue; |
353 |
> |
XQueryColor(ourdisplay, |
354 |
> |
DefaultColormap(ourdisplay,ourscreen), |
355 |
> |
&thiscolor); |
356 |
> |
XStoreColor(ourdisplay, ourmap, &thiscolor); |
357 |
> |
for (j = i; j+1 < ncolors; j++) |
358 |
> |
pixval[j] = pixval[j+1]; |
359 |
> |
ncolors--; |
360 |
> |
i--; |
361 |
> |
} |
362 |
> |
} |
363 |
> |
XSetWindowColormap(ourdisplay, gwind, ourmap); |
364 |
> |
return(ncolors); |
365 |
|
} |
366 |
|
|
367 |
|
|
372 |
|
return; |
373 |
|
XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L); |
374 |
|
ncolors = 0; |
375 |
+ |
if (ourmap != DefaultColormap(ourdisplay,ourscreen)) |
376 |
+ |
XFreeColormap(ourdisplay, ourmap); |
377 |
+ |
ourmap = 0; |
378 |
|
} |
379 |
|
|
380 |
|
|
381 |
+ |
static unsigned long |
382 |
+ |
true_pixel(col) /* return true pixel value for color */ |
383 |
+ |
COLOR col; |
384 |
+ |
{ |
385 |
+ |
unsigned long rval; |
386 |
+ |
BYTE rgb[3]; |
387 |
+ |
|
388 |
+ |
map_color(rgb, col); |
389 |
+ |
rval = ourvisual->red_mask*rgb[RED]/255 & ourvisual->red_mask; |
390 |
+ |
rval |= ourvisual->green_mask*rgb[GRN]/255 & ourvisual->green_mask; |
391 |
+ |
rval |= ourvisual->blue_mask*rgb[BLU]/255 & ourvisual->blue_mask; |
392 |
+ |
return(rval); |
393 |
+ |
} |
394 |
+ |
|
395 |
+ |
|
396 |
|
static int |
397 |
|
x11_getc() /* get a command character */ |
398 |
|
{ |
410 |
|
{ |
411 |
|
XNextEvent(ourdisplay, levptr(XEvent)); |
412 |
|
switch (levptr(XEvent)->type) { |
413 |
+ |
case ConfigureNotify: |
414 |
+ |
resizewindow(levptr(XConfigureEvent)); |
415 |
+ |
break; |
416 |
+ |
case UnmapNotify: |
417 |
+ |
freepixels(); |
418 |
+ |
break; |
419 |
+ |
case MapNotify: |
420 |
+ |
if (ourvisual->class == PseudoColor) |
421 |
+ |
if (getpixels() == 0) |
422 |
+ |
stderr_v("Cannot allocate colors\n"); |
423 |
+ |
else |
424 |
+ |
new_ctab(ncolors); |
425 |
+ |
break; |
426 |
+ |
case Expose: |
427 |
+ |
fixwindow(levptr(XExposeEvent)); |
428 |
+ |
break; |
429 |
|
case KeyPress: |
430 |
|
getkey(levptr(XKeyPressedEvent)); |
431 |
|
break; |
439 |
|
getkey(ekey) /* get input key */ |
440 |
|
register XKeyPressedEvent *ekey; |
441 |
|
{ |
442 |
< |
c_last += XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last, |
442 |
> |
register int n; |
443 |
> |
|
444 |
> |
n = XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last, |
445 |
|
NULL, NULL); |
446 |
< |
x11_driver.inpready = c_last-c_first; |
446 |
> |
c_last += n; |
447 |
> |
x11_driver.inpready += n; |
448 |
|
} |
449 |
|
|
450 |
|
|
384 |
– |
#ifdef notdef |
451 |
|
static |
452 |
|
fixwindow(eexp) /* repair damage to window */ |
453 |
|
register XExposeEvent *eexp; |
454 |
|
{ |
455 |
< |
if (eexp->subwindow == 0) |
456 |
< |
repaint(eexp->x, gheight - eexp->y - eexp->height, |
455 |
> |
if (eexp->window == gwind) { |
456 |
> |
sprintf(getcombuf(&x11_driver), "repaint %d %d %d %d\n", |
457 |
> |
eexp->x, gheight - eexp->y - eexp->height, |
458 |
|
eexp->x + eexp->width, gheight - eexp->y); |
459 |
< |
else if (eexp->subwindow == comline->w) |
460 |
< |
xt_redraw(comline); |
459 |
> |
} else if (eexp->window == comline->w) { |
460 |
> |
if (eexp->count == 0) |
461 |
> |
xt_redraw(comline); |
462 |
> |
} |
463 |
|
} |
464 |
< |
#endif |
464 |
> |
|
465 |
> |
|
466 |
> |
static |
467 |
> |
resizewindow(ersz) /* resize window */ |
468 |
> |
register XConfigureEvent *ersz; |
469 |
> |
{ |
470 |
> |
if (ersz->width == gwidth && ersz->height-COMHEIGHT == gheight) |
471 |
> |
return; |
472 |
> |
|
473 |
> |
gwidth = ersz->width; |
474 |
> |
gheight = ersz->height-COMHEIGHT; |
475 |
> |
x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth; |
476 |
> |
x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight; |
477 |
> |
|
478 |
> |
strcpy(getcombuf(&x11_driver), "new\n"); |
479 |
> |
} |