1 |
– |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* x11.c - driver for X-windows version 11 |
9 |
– |
* |
10 |
– |
* Jan 1990 |
6 |
|
*/ |
7 |
|
|
8 |
< |
#include <stdio.h> |
8 |
> |
#include "copyright.h" |
9 |
|
|
10 |
+ |
#include "standard.h" |
11 |
|
#include <sys/ioctl.h> |
12 |
+ |
#ifdef sparc |
13 |
+ |
#include <sys/conf.h> |
14 |
+ |
#include <sys/file.h> |
15 |
+ |
#include <sys/filio.h> |
16 |
+ |
#endif |
17 |
+ |
#if !defined(FNDELAY) && defined(O_NONBLOCK) |
18 |
+ |
#define FNDELAY O_NONBLOCK |
19 |
+ |
#endif |
20 |
|
|
21 |
|
#include <X11/Xlib.h> |
22 |
|
#include <X11/cursorfont.h> |
30 |
|
#define GAMMA 2.2 /* default exponent correction */ |
31 |
|
|
32 |
|
#define MINWIDTH (32*COMCW) /* minimum graphics window width */ |
33 |
< |
#define MINHEIGHT MINWIDTH /* minimum graphics window height */ |
33 |
> |
#define MINHEIGHT (MINWIDTH/2) /* minimum graphics window height */ |
34 |
|
|
35 |
|
#define BORWIDTH 5 /* border width */ |
36 |
|
#define COMHEIGHT (COMLH*COMCH) /* command line height (pixels) */ |
48 |
|
static XEvent currentevent; /* current event */ |
49 |
|
|
50 |
|
static int ncolors = 0; /* color table size */ |
51 |
+ |
static int mapped = 0; /* window is mapped? */ |
52 |
|
static unsigned long *pixval = NULL; /* allocated pixels */ |
53 |
|
static unsigned long ourblack=0, ourwhite=1; |
54 |
|
|
62 |
|
|
63 |
|
static int gwidth, gheight; /* graphics window size */ |
64 |
|
|
65 |
+ |
static int comheight; /* desired comline height */ |
66 |
|
static TEXTWIND *comline = NULL; /* our command line */ |
67 |
|
|
68 |
|
static char c_queue[64]; /* input queue */ |
73 |
|
|
74 |
|
static Colormap ourmap = 0; /* our color map */ |
75 |
|
|
76 |
< |
extern char *malloc(), *getcombuf(); |
76 |
> |
#define IC_X11 0 |
77 |
> |
#define IC_IOCTL 1 |
78 |
> |
#define IC_READ 2 |
79 |
|
|
80 |
< |
static int x11_close(), x11_clear(), x11_paintr(), x11_errout(), |
73 |
< |
x11_getcur(), x11_comout(), x11_comin(), x11_flush(); |
80 |
> |
static int inpcheck; /* whence to check input */ |
81 |
|
|
82 |
+ |
static int x11_getcur(); |
83 |
+ |
|
84 |
+ |
static void x11_close(), x11_clear(), x11_paintr(), x11_errout(), |
85 |
+ |
x11_comout(), x11_comin(), x11_flush(); |
86 |
+ |
|
87 |
+ |
static void std_comin(), std_comout(); |
88 |
+ |
|
89 |
|
static struct driver x11_driver = { |
90 |
|
x11_close, x11_clear, x11_paintr, x11_getcur, |
91 |
< |
x11_comout, x11_comin, x11_flush, 1.0 |
91 |
> |
NULL, NULL, x11_flush, 1.0 |
92 |
|
}; |
93 |
|
|
94 |
+ |
static int getpixels(), x11_getc(); |
95 |
+ |
static void xnewcolr(), freepixels(), resizewindow(), |
96 |
+ |
getevent(), getkey(), fixwindow(); |
97 |
+ |
static unsigned long true_pixel(); |
98 |
|
|
99 |
+ |
|
100 |
|
struct driver * |
101 |
|
x11_init(name, id) /* initialize driver */ |
102 |
|
char *name, *id; |
103 |
|
{ |
85 |
– |
extern char *getenv(); |
104 |
|
char *gv; |
105 |
|
int nplanes; |
106 |
|
XSetWindowAttributes ourwinattr; |
107 |
|
XWMHints ourxwmhints; |
108 |
|
XSizeHints oursizhints; |
109 |
< |
|
109 |
> |
/* open display server */ |
110 |
|
ourdisplay = XOpenDisplay(NULL); |
111 |
|
if (ourdisplay == NULL) { |
112 |
< |
stderr_v("cannot open X-windows; DISPLAY variable set?\n"); |
112 |
> |
eputs("cannot open X-windows; DISPLAY variable set?\n"); |
113 |
|
return(NULL); |
114 |
|
} |
115 |
|
/* find a usable visual */ |
116 |
|
nplanes = DisplayPlanes(ourdisplay, ourscreen); |
117 |
|
if (XMatchVisualInfo(ourdisplay,ourscreen, |
118 |
< |
24,TrueColor,&ourvinfo) || |
118 |
> |
nplanes>12?nplanes:24,TrueColor,&ourvinfo) || |
119 |
|
XMatchVisualInfo(ourdisplay,ourscreen, |
120 |
< |
24,DirectColor,&ourvinfo)) { |
120 |
> |
nplanes>12?nplanes:24,DirectColor,&ourvinfo)) { |
121 |
|
ourblack = 0; |
122 |
|
ourwhite = ourvinfo.red_mask | |
123 |
|
ourvinfo.green_mask | |
124 |
|
ourvinfo.blue_mask ; |
125 |
|
} else { |
126 |
|
if (nplanes < 4) { |
127 |
< |
stderr_v("not enough colors\n"); |
127 |
> |
eputs("not enough colors\n"); |
128 |
|
return(NULL); |
129 |
|
} |
130 |
|
if (!XMatchVisualInfo(ourdisplay,ourscreen, |
131 |
|
nplanes,PseudoColor,&ourvinfo) && |
132 |
|
!XMatchVisualInfo(ourdisplay,ourscreen, |
133 |
|
nplanes,GrayScale,&ourvinfo)) { |
134 |
< |
stderr_v("unsupported visual type\n"); |
134 |
> |
eputs("unsupported visual type\n"); |
135 |
|
return(NULL); |
136 |
|
} |
137 |
|
ourblack = BlackPixel(ourdisplay,ourscreen); |
138 |
|
ourwhite = WhitePixel(ourdisplay,ourscreen); |
139 |
|
} |
140 |
|
/* set gamma */ |
141 |
< |
if ((gv = getenv("GAMMA")) != NULL) |
141 |
> |
if ((gv = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL |
142 |
> |
|| (gv = getenv("DISPLAY_GAMMA")) != NULL) |
143 |
|
make_gmap(atof(gv)); |
144 |
|
else |
145 |
|
make_gmap(GAMMA); |
146 |
+ |
/* X11 command line or no? */ |
147 |
+ |
if (!strcmp(name, "x11")) |
148 |
+ |
comheight = COMHEIGHT; |
149 |
+ |
else /* "x11d" */ { |
150 |
+ |
comheight = 0; |
151 |
+ |
#ifndef FNDELAY |
152 |
+ |
eputs("warning: x11d driver not fully functional on this machine\n"); |
153 |
+ |
#endif |
154 |
+ |
} |
155 |
|
/* open window */ |
156 |
|
ourwinattr.background_pixel = ourblack; |
157 |
|
ourwinattr.border_pixel = ourblack; |
164 |
|
BORWIDTH, ourvinfo.depth, InputOutput, ourvinfo.visual, |
165 |
|
CWBackPixel|CWBorderPixel|CWColormap, &ourwinattr); |
166 |
|
if (gwind == 0) { |
167 |
< |
stderr_v("cannot create window\n"); |
167 |
> |
eputs("cannot create window\n"); |
168 |
|
return(NULL); |
169 |
|
} |
170 |
|
XStoreName(ourdisplay, gwind, id); |
177 |
|
gwind, x11icon_bits, x11icon_width, x11icon_height); |
178 |
|
XSetWMHints(ourdisplay, gwind, &ourxwmhints); |
179 |
|
oursizhints.min_width = MINWIDTH; |
180 |
< |
oursizhints.min_height = MINHEIGHT+COMHEIGHT; |
180 |
> |
oursizhints.min_height = MINHEIGHT+comheight; |
181 |
|
oursizhints.flags = PMinSize; |
182 |
|
XSetNormalHints(ourdisplay, gwind, &oursizhints); |
183 |
|
XSelectInput(ourdisplay, gwind, ExposureMask); |
184 |
|
XMapWindow(ourdisplay, gwind); |
185 |
|
XWindowEvent(ourdisplay, gwind, ExposureMask, levptr(XEvent)); |
186 |
|
gwidth = levptr(XExposeEvent)->width; |
187 |
< |
gheight = levptr(XExposeEvent)->height - COMHEIGHT; |
187 |
> |
gheight = levptr(XExposeEvent)->height - comheight; |
188 |
|
x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth; |
189 |
|
x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight; |
190 |
|
x11_driver.inpready = 0; |
191 |
< |
cmdvec = x11_comout; /* set error vectors */ |
192 |
< |
if (wrnvec != NULL) |
193 |
< |
wrnvec = x11_errout; |
191 |
> |
mapped = 1; |
192 |
> |
/* set i/o vectors */ |
193 |
> |
if (comheight) { |
194 |
> |
x11_driver.comin = x11_comin; |
195 |
> |
x11_driver.comout = x11_comout; |
196 |
> |
erract[COMMAND].pf = x11_comout; |
197 |
> |
if (erract[WARNING].pf != NULL) |
198 |
> |
erract[WARNING].pf = x11_errout; |
199 |
> |
inpcheck = IC_X11; |
200 |
> |
} else { |
201 |
> |
x11_driver.comin = std_comin; |
202 |
> |
x11_driver.comout = std_comout; |
203 |
> |
erract[COMMAND].pf = std_comout; |
204 |
> |
inpcheck = IC_IOCTL; |
205 |
> |
} |
206 |
|
return(&x11_driver); |
207 |
|
} |
208 |
|
|
209 |
|
|
210 |
< |
static |
210 |
> |
static void |
211 |
|
x11_close() /* close our display */ |
212 |
|
{ |
213 |
< |
cmdvec = NULL; /* reset error vectors */ |
214 |
< |
if (wrnvec != NULL) |
215 |
< |
wrnvec = stderr_v; |
213 |
> |
erract[COMMAND].pf = NULL; /* reset error vectors */ |
214 |
> |
if (erract[WARNING].pf != NULL) |
215 |
> |
erract[WARNING].pf = wputs; |
216 |
|
if (ourdisplay == NULL) |
217 |
|
return; |
218 |
|
if (comline != NULL) { |
230 |
|
} |
231 |
|
|
232 |
|
|
233 |
< |
static |
233 |
> |
static void |
234 |
|
x11_clear(xres, yres) /* clear our display */ |
235 |
|
int xres, yres; |
236 |
|
{ |
242 |
|
/* resize window */ |
243 |
|
if (xres != gwidth || yres != gheight) { |
244 |
|
XSelectInput(ourdisplay, gwind, 0); |
245 |
< |
XResizeWindow(ourdisplay, gwind, xres, yres+COMHEIGHT); |
245 |
> |
XResizeWindow(ourdisplay, gwind, xres, yres+comheight); |
246 |
|
gwidth = xres; |
247 |
|
gheight = yres; |
248 |
|
XFlush(ourdisplay); |
253 |
|
/* reinitialize color table */ |
254 |
|
if (ourvinfo.class == PseudoColor || ourvinfo.class == GrayScale) |
255 |
|
if (getpixels() == 0) |
256 |
< |
stderr_v("cannot allocate colors\n"); |
256 |
> |
eputs("cannot allocate colors\n"); |
257 |
|
else |
258 |
|
new_ctab(ncolors); |
259 |
|
/* get new command line */ |
260 |
|
if (comline != NULL) |
261 |
|
xt_close(comline); |
262 |
< |
comline = xt_open(ourdisplay, gwind, 0, gheight, |
263 |
< |
gwidth, COMHEIGHT, 0, ourblack, ourwhite, COMFN); |
264 |
< |
if (comline == NULL) { |
265 |
< |
stderr_v("Cannot open command line window\n"); |
266 |
< |
quit(1); |
267 |
< |
} |
268 |
< |
XSelectInput(ourdisplay, comline->w, ExposureMask); |
262 |
> |
if (comheight) { |
263 |
> |
comline = xt_open(ourdisplay, gwind, 0, gheight, gwidth, |
264 |
> |
comheight, 0, ourblack, ourwhite, COMFN); |
265 |
> |
if (comline == NULL) { |
266 |
> |
eputs("cannot open command line window\n"); |
267 |
> |
quit(1); |
268 |
> |
} |
269 |
> |
XSelectInput(ourdisplay, comline->w, ExposureMask); |
270 |
|
/* remove earmuffs */ |
271 |
< |
XSelectInput(ourdisplay, gwind, |
271 |
> |
XSelectInput(ourdisplay, gwind, |
272 |
|
StructureNotifyMask|ExposureMask|KeyPressMask|ButtonPressMask); |
273 |
+ |
} else /* remove earmuffs */ |
274 |
+ |
XSelectInput(ourdisplay, gwind, |
275 |
+ |
StructureNotifyMask|ExposureMask|ButtonPressMask); |
276 |
|
} |
277 |
|
|
278 |
|
|
279 |
< |
static |
279 |
> |
static void |
280 |
|
x11_paintr(col, xmin, ymin, xmax, ymax) /* fill a rectangle */ |
281 |
|
COLOR col; |
282 |
|
int xmin, ymin, xmax, ymax; |
283 |
|
{ |
240 |
– |
extern int xnewcolr(); /* pixel assignment routine */ |
241 |
– |
extern unsigned long true_pixel(); |
284 |
|
unsigned long pixel; |
285 |
|
|
286 |
+ |
if (!mapped) |
287 |
+ |
return; |
288 |
|
if (ncolors > 0) |
289 |
|
pixel = pixval[get_pixel(col, xnewcolr)]; |
246 |
– |
else if (ourvinfo.class == TrueColor || ourvinfo.class == DirectColor) |
247 |
– |
pixel = true_pixel(col); |
290 |
|
else |
291 |
< |
return; |
291 |
> |
pixel = true_pixel(col); |
292 |
|
XSetForeground(ourdisplay, ourgc, pixel); |
293 |
|
XFillRectangle(ourdisplay, gwind, |
294 |
|
ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin); |
295 |
|
} |
296 |
|
|
297 |
|
|
298 |
< |
static |
298 |
> |
static void |
299 |
|
x11_flush() /* flush output */ |
300 |
|
{ |
301 |
+ |
char buf[256]; |
302 |
+ |
int n; |
303 |
+ |
/* check for input */ |
304 |
|
XNoOp(ourdisplay); |
305 |
< |
while (XPending(ourdisplay) > 0) |
305 |
> |
n = XPending(ourdisplay); /* from X server */ |
306 |
> |
while (n-- > 0) |
307 |
|
getevent(); |
308 |
+ |
#ifdef FNDELAY |
309 |
+ |
if (inpcheck == IC_IOCTL) { /* from stdin */ |
310 |
+ |
#ifdef FIONREAD |
311 |
+ |
if (ioctl(fileno(stdin), FIONREAD, &n) < 0) { |
312 |
+ |
#else |
313 |
+ |
if (1) { |
314 |
+ |
#endif |
315 |
+ |
if (fcntl(fileno(stdin), F_SETFL, FNDELAY) < 0) { |
316 |
+ |
eputs("cannot change input mode\n"); |
317 |
+ |
quit(1); |
318 |
+ |
} |
319 |
+ |
inpcheck = IC_READ; |
320 |
+ |
} else |
321 |
+ |
x11_driver.inpready += n; |
322 |
+ |
} |
323 |
+ |
if (inpcheck == IC_READ) { |
324 |
+ |
n = read(fileno(stdin), buf, sizeof(buf)-1); |
325 |
+ |
if (n > 0) { |
326 |
+ |
buf[n] = '\0'; |
327 |
+ |
tocombuf(buf, &x11_driver); |
328 |
+ |
} |
329 |
+ |
} |
330 |
+ |
#endif |
331 |
|
} |
332 |
|
|
333 |
|
|
334 |
< |
static |
334 |
> |
static void |
335 |
|
x11_comin(inp, prompt) /* read in a command line */ |
336 |
|
char *inp, *prompt; |
337 |
|
{ |
338 |
< |
extern int x11_getc(); |
339 |
< |
|
271 |
< |
if (prompt != NULL) |
338 |
> |
if (prompt != NULL) { |
339 |
> |
x11_flush(); /* make sure we get everything */ |
340 |
|
if (fromcombuf(inp, &x11_driver)) |
341 |
|
return; |
342 |
< |
else |
343 |
< |
xt_puts(prompt, comline); |
342 |
> |
xt_puts(prompt, comline); |
343 |
> |
} |
344 |
|
xt_cursor(comline, TBLKCURS); |
345 |
|
editline(inp, x11_getc, x11_comout); |
346 |
|
xt_cursor(comline, TNOCURS); |
347 |
|
} |
348 |
|
|
349 |
|
|
350 |
< |
static |
351 |
< |
x11_comout(out) /* output a string to command line */ |
352 |
< |
char *out; |
350 |
> |
static void |
351 |
> |
x11_comout(outp) /* output a string to command line */ |
352 |
> |
char *outp; |
353 |
|
{ |
354 |
< |
if (comline == NULL) |
354 |
> |
if (comline == NULL || outp == NULL || !outp[0]) |
355 |
|
return; |
356 |
< |
xt_puts(out, comline); |
357 |
< |
if (out[strlen(out)-1] == '\n') |
356 |
> |
xt_puts(outp, comline); |
357 |
> |
if (outp[strlen(outp)-1] == '\n') |
358 |
|
XFlush(ourdisplay); |
359 |
|
} |
360 |
|
|
361 |
|
|
362 |
< |
static |
362 |
> |
static void |
363 |
|
x11_errout(msg) /* output an error message */ |
364 |
|
char *msg; |
365 |
|
{ |
366 |
< |
stderr_v(msg); /* send to stderr also! */ |
366 |
> |
eputs(msg); /* send to stderr also! */ |
367 |
|
x11_comout(msg); |
368 |
|
} |
369 |
|
|
370 |
|
|
371 |
+ |
static void |
372 |
+ |
std_comin(inp, prompt) /* read in command line from stdin */ |
373 |
+ |
char *inp, *prompt; |
374 |
+ |
{ |
375 |
+ |
if (prompt != NULL) { |
376 |
+ |
if (fromcombuf(inp, &x11_driver)) |
377 |
+ |
return; |
378 |
+ |
if (!x11_driver.inpready) |
379 |
+ |
std_comout(prompt); |
380 |
+ |
} |
381 |
+ |
#ifdef FNDELAY |
382 |
+ |
if (inpcheck == IC_READ) { /* turn off FNDELAY */ |
383 |
+ |
if (fcntl(fileno(stdin), F_SETFL, 0) < 0) { |
384 |
+ |
eputs("cannot change input mode\n"); |
385 |
+ |
quit(1); |
386 |
+ |
} |
387 |
+ |
inpcheck = IC_IOCTL; |
388 |
+ |
} |
389 |
+ |
#endif |
390 |
+ |
if (gets(inp) == NULL) { |
391 |
+ |
strcpy(inp, "quit"); |
392 |
+ |
return; |
393 |
+ |
} |
394 |
+ |
x11_driver.inpready -= strlen(inp) + 1; |
395 |
+ |
if (x11_driver.inpready < 0) |
396 |
+ |
x11_driver.inpready = 0; |
397 |
+ |
} |
398 |
+ |
|
399 |
+ |
|
400 |
+ |
static void |
401 |
+ |
std_comout(outp) /* write out string to stdout */ |
402 |
+ |
char *outp; |
403 |
+ |
{ |
404 |
+ |
fputs(outp, stdout); |
405 |
+ |
fflush(stdout); |
406 |
+ |
} |
407 |
+ |
|
408 |
+ |
|
409 |
|
static int |
410 |
|
x11_getcur(xp, yp) /* get cursor position */ |
411 |
|
int *xp, *yp; |
425 |
|
if (c_last > c_first) /* key pressed */ |
426 |
|
return(x11_getc()); |
427 |
|
/* button pressed */ |
428 |
< |
if (levptr(XButtonPressedEvent)->button & Button1) |
428 |
> |
if (levptr(XButtonPressedEvent)->button == Button1) |
429 |
|
return(MB1); |
430 |
< |
if (levptr(XButtonPressedEvent)->button & Button2) |
430 |
> |
if (levptr(XButtonPressedEvent)->button == Button2) |
431 |
|
return(MB2); |
432 |
< |
if (levptr(XButtonPressedEvent)->button & Button3) |
432 |
> |
if (levptr(XButtonPressedEvent)->button == Button3) |
433 |
|
return(MB3); |
328 |
– |
if (levptr(XButtonPressedEvent)->button & (Button4|Button5)) |
329 |
– |
return(MB1); |
434 |
|
return(ABORT); |
435 |
|
} |
436 |
|
|
437 |
|
|
438 |
< |
static |
438 |
> |
static void |
439 |
|
xnewcolr(ndx, r, g, b) /* enter a color into hardware table */ |
440 |
|
int ndx; |
441 |
|
int r, g, b; |
473 |
|
pixval = (unsigned long *)malloc(ncolors*sizeof(unsigned long)); |
474 |
|
if (pixval == NULL) |
475 |
|
return(ncolors = 0); |
476 |
< |
if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0, |
373 |
< |
pixval,ncolors) != 0) |
476 |
> |
if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,pixval,ncolors)) |
477 |
|
break; |
478 |
< |
free((char *)pixval); |
478 |
> |
free((void *)pixval); |
479 |
|
pixval = NULL; |
480 |
|
} |
481 |
|
if (pixval == NULL) { |
504 |
|
} |
505 |
|
|
506 |
|
|
507 |
< |
static |
507 |
> |
static void |
508 |
|
freepixels() /* free our pixels */ |
509 |
|
{ |
510 |
|
if (ncolors == 0) |
511 |
|
return; |
512 |
|
XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L); |
513 |
< |
free((char *)pixval); |
513 |
> |
free((void *)pixval); |
514 |
|
pixval = NULL; |
515 |
|
ncolors = 0; |
516 |
|
if (ourmap != DefaultColormap(ourdisplay,ourscreen)) |
546 |
|
} |
547 |
|
|
548 |
|
|
549 |
< |
static |
549 |
> |
static void |
550 |
|
getevent() /* get next event */ |
551 |
|
{ |
552 |
|
XNextEvent(ourdisplay, levptr(XEvent)); |
555 |
|
resizewindow(levptr(XConfigureEvent)); |
556 |
|
break; |
557 |
|
case UnmapNotify: |
558 |
+ |
mapped = 0; |
559 |
|
freepixels(); |
560 |
|
break; |
561 |
|
case MapNotify: |
562 |
|
if (ourvinfo.class == PseudoColor || |
563 |
|
ourvinfo.class == GrayScale) |
564 |
|
if (getpixels() == 0) |
565 |
< |
stderr_v("Cannot allocate colors\n"); |
565 |
> |
eputs("cannot allocate colors\n"); |
566 |
|
else |
567 |
|
new_ctab(ncolors); |
568 |
+ |
mapped = 1; |
569 |
|
break; |
570 |
|
case Expose: |
571 |
|
fixwindow(levptr(XExposeEvent)); |
579 |
|
} |
580 |
|
|
581 |
|
|
582 |
< |
static |
582 |
> |
static void |
583 |
|
getkey(ekey) /* get input key */ |
584 |
|
register XKeyPressedEvent *ekey; |
585 |
|
{ |
592 |
|
} |
593 |
|
|
594 |
|
|
595 |
< |
static |
595 |
> |
static void |
596 |
|
fixwindow(eexp) /* repair damage to window */ |
597 |
|
register XExposeEvent *eexp; |
598 |
|
{ |
599 |
+ |
char buf[80]; |
600 |
+ |
|
601 |
|
if (eexp->window == gwind) { |
602 |
< |
sprintf(getcombuf(&x11_driver), "repaint %d %d %d %d\n", |
602 |
> |
sprintf(buf, "repaint %d %d %d %d\n", |
603 |
|
eexp->x, gheight - eexp->y - eexp->height, |
604 |
|
eexp->x + eexp->width, gheight - eexp->y); |
605 |
+ |
tocombuf(buf, &x11_driver); |
606 |
|
} else if (eexp->window == comline->w) { |
607 |
|
if (eexp->count == 0) |
608 |
|
xt_redraw(comline); |
610 |
|
} |
611 |
|
|
612 |
|
|
613 |
< |
static |
613 |
> |
static void |
614 |
|
resizewindow(ersz) /* resize window */ |
615 |
|
register XConfigureEvent *ersz; |
616 |
|
{ |
617 |
< |
if (ersz->width == gwidth && ersz->height-COMHEIGHT == gheight) |
617 |
> |
if (ersz->width == gwidth && ersz->height-comheight == gheight) |
618 |
|
return; |
619 |
|
|
620 |
|
gwidth = ersz->width; |
621 |
< |
gheight = ersz->height-COMHEIGHT; |
621 |
> |
gheight = ersz->height-comheight; |
622 |
|
x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth; |
623 |
|
x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight; |
624 |
|
|
625 |
< |
strcpy(getcombuf(&x11_driver), "new\n"); |
625 |
> |
tocombuf("new\n", &x11_driver); |
626 |
|
} |