ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/x11.c
Revision: 2.21
Committed: Wed Oct 26 10:04:15 1994 UTC (29 years, 6 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.20: +7 -4 lines
Log Message:
changed getcombuf() to tocombuf() for multiple commands

File Contents

# User Rev Content
1 greg 2.4 /* Copyright (c) 1992 Regents of the University of California */
2    
3 greg 1.1 #ifndef lint
4     static char SCCSid[] = "$SunId$ LBL";
5     #endif
6    
7     /*
8 greg 2.4 * x11.c - driver for X-windows version 11
9 greg 1.1 *
10 greg 1.4 * Jan 1990
11 greg 1.1 */
12    
13     #include <stdio.h>
14 greg 2.12 #include <math.h>
15 greg 1.1 #include <sys/ioctl.h>
16 greg 2.19 #include <fcntl.h>
17 greg 1.1
18     #include <X11/Xlib.h>
19 greg 1.4 #include <X11/cursorfont.h>
20     #include <X11/Xutil.h>
21 greg 1.1
22     #include "color.h"
23     #include "driver.h"
24     #include "x11twind.h"
25 greg 1.18 #include "x11icon.h"
26 greg 1.1
27 greg 2.6 #define GAMMA 2.2 /* default exponent correction */
28 greg 1.1
29 greg 1.6 #define MINWIDTH (32*COMCW) /* minimum graphics window width */
30 greg 2.9 #define MINHEIGHT (MINWIDTH/2) /* minimum graphics window height */
31 greg 1.4
32 greg 1.1 #define BORWIDTH 5 /* border width */
33     #define COMHEIGHT (COMLH*COMCH) /* command line height (pixels) */
34    
35     #define COMFN "8x13" /* command line font name */
36     #define COMLH 3 /* number of command lines */
37     #define COMCW 8 /* approx. character width (pixels) */
38     #define COMCH 14 /* approx. character height (pixels) */
39    
40 greg 1.4 #define ourscreen DefaultScreen(ourdisplay)
41     #define ourroot RootWindow(ourdisplay,ourscreen)
42    
43     #define levptr(etype) ((etype *)&currentevent)
44 greg 1.1
45 greg 1.4 static XEvent currentevent; /* current event */
46 greg 1.1
47     static int ncolors = 0; /* color table size */
48 greg 2.8 static int mapped = 0; /* window is mapped? */
49 greg 1.17 static unsigned long *pixval = NULL; /* allocated pixels */
50 greg 2.3 static unsigned long ourblack=0, ourwhite=1;
51 greg 1.1
52     static Display *ourdisplay = NULL; /* our display */
53    
54 greg 2.2 static XVisualInfo ourvinfo; /* our visual information */
55 greg 1.6
56 greg 1.1 static Window gwind = 0; /* our graphics window */
57    
58     static Cursor pickcursor = 0; /* cursor used for picking */
59    
60 greg 1.4 static int gwidth, gheight; /* graphics window size */
61 greg 1.1
62 greg 2.17 static int comheight; /* desired comline height */
63 greg 1.1 static TEXTWIND *comline = NULL; /* our command line */
64    
65     static char c_queue[64]; /* input queue */
66     static int c_first = 0; /* first character in queue */
67     static int c_last = 0; /* last character in queue */
68    
69     static GC ourgc = 0; /* our graphics context for drawing */
70    
71 greg 1.6 static Colormap ourmap = 0; /* our color map */
72 greg 1.1
73 greg 2.19 #define IC_X11 0
74     #define IC_IOCTL 1
75     #define IC_READ 2
76    
77     static int inpcheck; /* whence to check input */
78    
79 greg 2.21 extern char *malloc();
80 greg 1.1
81 greg 1.14 static int x11_close(), x11_clear(), x11_paintr(), x11_errout(),
82 greg 1.5 x11_getcur(), x11_comout(), x11_comin(), x11_flush();
83 greg 1.1
84 greg 2.17 static int std_comin(), std_comout();
85    
86 greg 1.1 static struct driver x11_driver = {
87     x11_close, x11_clear, x11_paintr, x11_getcur,
88 greg 2.17 NULL, NULL, x11_flush, 1.0
89 greg 1.1 };
90    
91 greg 2.13 static int getpixels(), xnewcolr(), freepixels(), resizewindow(),
92     getevent(), getkey(), fixwindow(), x11_getc();
93 greg 2.11 static unsigned long true_pixel();
94 greg 1.1
95 greg 2.11
96 greg 1.1 struct driver *
97     x11_init(name, id) /* initialize driver */
98     char *name, *id;
99     {
100 greg 2.6 extern char *getenv();
101     char *gv;
102 greg 1.6 int nplanes;
103 greg 1.10 XSetWindowAttributes ourwinattr;
104 greg 1.4 XWMHints ourxwmhints;
105 greg 1.12 XSizeHints oursizhints;
106 greg 2.17 /* open display server */
107 greg 1.1 ourdisplay = XOpenDisplay(NULL);
108     if (ourdisplay == NULL) {
109     stderr_v("cannot open X-windows; DISPLAY variable set?\n");
110     return(NULL);
111     }
112 greg 2.2 /* find a usable visual */
113 greg 1.6 nplanes = DisplayPlanes(ourdisplay, ourscreen);
114 greg 2.4 if (XMatchVisualInfo(ourdisplay,ourscreen,
115     24,TrueColor,&ourvinfo) ||
116     XMatchVisualInfo(ourdisplay,ourscreen,
117     24,DirectColor,&ourvinfo)) {
118     ourblack = 0;
119     ourwhite = ourvinfo.red_mask |
120     ourvinfo.green_mask |
121     ourvinfo.blue_mask ;
122     } else {
123 greg 2.2 if (nplanes < 4) {
124     stderr_v("not enough colors\n");
125 greg 1.6 return(NULL);
126 greg 2.4 }
127     if (!XMatchVisualInfo(ourdisplay,ourscreen,
128 greg 2.2 nplanes,PseudoColor,&ourvinfo) &&
129     !XMatchVisualInfo(ourdisplay,ourscreen,
130     nplanes,GrayScale,&ourvinfo)) {
131     stderr_v("unsupported visual type\n");
132     return(NULL);
133 greg 1.6 }
134 greg 2.3 ourblack = BlackPixel(ourdisplay,ourscreen);
135     ourwhite = WhitePixel(ourdisplay,ourscreen);
136     }
137 greg 2.6 /* set gamma */
138 greg 2.14 if ((gv = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL
139 greg 2.18 || (gv = getenv("DISPLAY_GAMMA")) != NULL)
140 greg 2.6 make_gmap(atof(gv));
141     else
142     make_gmap(GAMMA);
143 greg 2.17 /* X11 command line or no? */
144     if (!strcmp(name, "x11"))
145     comheight = COMHEIGHT;
146     else /* "x11d" */
147     comheight = 0;
148 greg 2.6 /* open window */
149 greg 1.12 ourwinattr.background_pixel = ourblack;
150 greg 1.10 ourwinattr.border_pixel = ourblack;
151 greg 2.4 /* this is stupid */
152 greg 2.2 ourwinattr.colormap = XCreateColormap(ourdisplay, ourroot,
153     ourvinfo.visual, AllocNone);
154 greg 1.10 gwind = XCreateWindow(ourdisplay, ourroot, 0, 0,
155 greg 1.4 DisplayWidth(ourdisplay,ourscreen)-2*BORWIDTH,
156     DisplayHeight(ourdisplay,ourscreen)-2*BORWIDTH,
157 greg 2.2 BORWIDTH, ourvinfo.depth, InputOutput, ourvinfo.visual,
158     CWBackPixel|CWBorderPixel|CWColormap, &ourwinattr);
159 greg 1.4 if (gwind == 0) {
160     stderr_v("cannot create window\n");
161     return(NULL);
162     }
163 greg 2.4 XStoreName(ourdisplay, gwind, id);
164 greg 1.10 /* create a cursor */
165     pickcursor = XCreateFontCursor(ourdisplay, XC_diamond_cross);
166 greg 1.4 ourgc = XCreateGC(ourdisplay, gwind, 0, NULL);
167 greg 1.18 ourxwmhints.flags = InputHint|IconPixmapHint;
168 greg 1.4 ourxwmhints.input = True;
169 greg 1.18 ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay,
170     gwind, x11icon_bits, x11icon_width, x11icon_height);
171 greg 1.4 XSetWMHints(ourdisplay, gwind, &ourxwmhints);
172 greg 1.12 oursizhints.min_width = MINWIDTH;
173 greg 2.17 oursizhints.min_height = MINHEIGHT+comheight;
174 greg 1.12 oursizhints.flags = PMinSize;
175     XSetNormalHints(ourdisplay, gwind, &oursizhints);
176 greg 1.4 XSelectInput(ourdisplay, gwind, ExposureMask);
177     XMapWindow(ourdisplay, gwind);
178 greg 1.17 XWindowEvent(ourdisplay, gwind, ExposureMask, levptr(XEvent));
179 greg 1.4 gwidth = levptr(XExposeEvent)->width;
180 greg 2.17 gheight = levptr(XExposeEvent)->height - comheight;
181 greg 1.4 x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth;
182     x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight;
183 greg 1.1 x11_driver.inpready = 0;
184 greg 2.8 mapped = 1;
185 greg 2.17 /* set i/o vectors */
186     if (comheight) {
187     x11_driver.comin = x11_comin;
188     x11_driver.comout = x11_comout;
189     cmdvec = x11_comout;
190     if (wrnvec != NULL)
191     wrnvec = x11_errout;
192 greg 2.19 inpcheck = IC_X11;
193 greg 2.17 } else {
194     x11_driver.comin = std_comin;
195     x11_driver.comout = std_comout;
196     cmdvec = std_comout;
197 greg 2.19 inpcheck = IC_IOCTL;
198 greg 2.17 }
199 greg 1.1 return(&x11_driver);
200     }
201    
202    
203     static
204     x11_close() /* close our display */
205     {
206     cmdvec = NULL; /* reset error vectors */
207     if (wrnvec != NULL)
208     wrnvec = stderr_v;
209     if (ourdisplay == NULL)
210     return;
211     if (comline != NULL) {
212     xt_close(comline);
213     comline = NULL;
214     }
215 greg 1.8 freepixels();
216     XFreeGC(ourdisplay, ourgc);
217     XDestroyWindow(ourdisplay, gwind);
218     gwind = 0;
219     ourgc = 0;
220 greg 1.1 XFreeCursor(ourdisplay, pickcursor);
221     XCloseDisplay(ourdisplay);
222     ourdisplay = NULL;
223     }
224    
225    
226     static
227     x11_clear(xres, yres) /* clear our display */
228     int xres, yres;
229     {
230 greg 1.12 /* check limits */
231     if (xres < MINWIDTH)
232     xres = MINWIDTH;
233     if (yres < MINHEIGHT)
234     yres = MINHEIGHT;
235     /* resize window */
236     if (xres != gwidth || yres != gheight) {
237 greg 1.4 XSelectInput(ourdisplay, gwind, 0);
238 greg 2.17 XResizeWindow(ourdisplay, gwind, xres, yres+comheight);
239 greg 1.1 gwidth = xres;
240     gheight = yres;
241 greg 1.8 XFlush(ourdisplay);
242     sleep(2); /* wait for window manager */
243 greg 1.4 XSync(ourdisplay, 1); /* discard input */
244     }
245 greg 1.13 XClearWindow(ourdisplay, gwind);
246     /* reinitialize color table */
247 greg 2.2 if (ourvinfo.class == PseudoColor || ourvinfo.class == GrayScale)
248 greg 1.13 if (getpixels() == 0)
249     stderr_v("cannot allocate colors\n");
250     else
251     new_ctab(ncolors);
252 greg 1.12 /* get new command line */
253 greg 1.13 if (comline != NULL)
254     xt_close(comline);
255 greg 2.17 if (comheight) {
256     comline = xt_open(ourdisplay, gwind, 0, gheight, gwidth,
257     comheight, 0, ourblack, ourwhite, COMFN);
258     if (comline == NULL) {
259     stderr_v("Cannot open command line window\n");
260     quit(1);
261     }
262     XSelectInput(ourdisplay, comline->w, ExposureMask);
263 greg 1.12 /* remove earmuffs */
264 greg 2.17 XSelectInput(ourdisplay, gwind,
265 greg 1.4 StructureNotifyMask|ExposureMask|KeyPressMask|ButtonPressMask);
266 greg 2.17 } else /* remove earmuffs */
267     XSelectInput(ourdisplay, gwind,
268     StructureNotifyMask|ExposureMask|ButtonPressMask);
269 greg 1.1 }
270    
271    
272     static
273     x11_paintr(col, xmin, ymin, xmax, ymax) /* fill a rectangle */
274     COLOR col;
275     int xmin, ymin, xmax, ymax;
276     {
277 greg 1.6 unsigned long pixel;
278 greg 1.1
279 greg 2.8 if (!mapped)
280     return;
281 greg 1.6 if (ncolors > 0)
282     pixel = pixval[get_pixel(col, xnewcolr)];
283 greg 2.8 else
284 greg 1.6 pixel = true_pixel(col);
285     XSetForeground(ourdisplay, ourgc, pixel);
286     XFillRectangle(ourdisplay, gwind,
287     ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin);
288 greg 1.5 }
289    
290    
291     static
292     x11_flush() /* flush output */
293     {
294 greg 2.19 char buf[256];
295 greg 2.15 int n;
296 greg 2.16 /* check for input */
297 greg 1.10 XNoOp(ourdisplay);
298 greg 2.16 n = XPending(ourdisplay); /* from X server */
299     while (n-- > 0)
300 greg 1.5 getevent();
301 greg 2.19 if (inpcheck == IC_IOCTL) { /* from stdin */
302 greg 2.17 if (ioctl(fileno(stdin), FIONREAD, &n) < 0) {
303 greg 2.19 if (fcntl(fileno(stdin), F_SETFL, FNDELAY) < 0) {
304     stderr_v("Cannot change input mode\n");
305     quit(1);
306     }
307     inpcheck = IC_READ;
308     } else
309     x11_driver.inpready += n;
310     }
311     if (inpcheck == IC_READ) {
312     n = read(fileno(stdin), buf, sizeof(buf)-1);
313     if (n > 0) {
314     buf[n] = '\0';
315 greg 2.21 tocombuf(buf, &x11_driver);
316 greg 2.17 }
317 greg 2.15 }
318 greg 1.1 }
319    
320    
321     static
322 greg 1.3 x11_comin(inp, prompt) /* read in a command line */
323     char *inp, *prompt;
324 greg 1.1 {
325 greg 2.15 if (prompt != NULL) {
326     x11_flush(); /* make sure we get everything */
327 greg 1.4 if (fromcombuf(inp, &x11_driver))
328     return;
329 greg 2.15 xt_puts(prompt, comline);
330     }
331 greg 1.1 xt_cursor(comline, TBLKCURS);
332     editline(inp, x11_getc, x11_comout);
333     xt_cursor(comline, TNOCURS);
334     }
335    
336    
337     static
338 greg 2.17 x11_comout(outp) /* output a string to command line */
339     char *outp;
340 greg 1.1 {
341 greg 1.11 if (comline == NULL)
342     return;
343 greg 2.17 xt_puts(outp, comline);
344     if (outp[strlen(outp)-1] == '\n')
345 greg 1.11 XFlush(ourdisplay);
346 greg 1.1 }
347    
348    
349     static
350     x11_errout(msg) /* output an error message */
351     char *msg;
352     {
353 greg 1.9 stderr_v(msg); /* send to stderr also! */
354 greg 1.1 x11_comout(msg);
355     }
356    
357    
358 greg 2.17 static
359     std_comin(inp, prompt) /* read in command line from stdin */
360     char *inp, *prompt;
361     {
362     extern char *gets();
363    
364     if (prompt != NULL) {
365     if (fromcombuf(inp, &x11_driver))
366     return;
367     if (!x11_driver.inpready)
368     fputs(prompt, stdout);
369     }
370     if (gets(inp) == NULL) {
371     strcpy(inp, "quit");
372     return;
373     }
374     x11_driver.inpready -= strlen(inp) + 1;
375     if (x11_driver.inpready < 0)
376     x11_driver.inpready = 0;
377     }
378    
379    
380     static
381     std_comout(outp) /* write out string to stdout */
382     char *outp;
383     {
384     fputs(outp, stdout);
385 greg 2.20 fflush(stdout);
386 greg 2.17 }
387    
388    
389 greg 1.1 static int
390     x11_getcur(xp, yp) /* get cursor position */
391     int *xp, *yp;
392     {
393     while (XGrabPointer(ourdisplay, gwind, True, ButtonPressMask,
394     GrabModeAsync, GrabModeAsync, None, pickcursor,
395     CurrentTime) != GrabSuccess)
396     sleep(2);
397    
398     do
399     getevent();
400     while (c_last <= c_first && levptr(XEvent)->type != ButtonPress);
401     *xp = levptr(XButtonPressedEvent)->x;
402     *yp = gheight-1 - levptr(XButtonPressedEvent)->y;
403     XUngrabPointer(ourdisplay, CurrentTime);
404     XFlush(ourdisplay); /* insure release */
405     if (c_last > c_first) /* key pressed */
406     return(x11_getc());
407     /* button pressed */
408 greg 2.10 if (levptr(XButtonPressedEvent)->button == Button1)
409 greg 1.1 return(MB1);
410 greg 2.10 if (levptr(XButtonPressedEvent)->button == Button2)
411 greg 1.1 return(MB2);
412 greg 2.10 if (levptr(XButtonPressedEvent)->button == Button3)
413 greg 1.1 return(MB3);
414     return(ABORT);
415     }
416    
417    
418     static
419     xnewcolr(ndx, r, g, b) /* enter a color into hardware table */
420     int ndx;
421     int r, g, b;
422     {
423     XColor xcolor;
424    
425     xcolor.pixel = pixval[ndx];
426     xcolor.red = r << 8;
427     xcolor.green = g << 8;
428     xcolor.blue = b << 8;
429     xcolor.flags = DoRed|DoGreen|DoBlue;
430    
431     XStoreColor(ourdisplay, ourmap, &xcolor);
432     }
433    
434    
435     static int
436     getpixels() /* get the color map */
437     {
438 greg 1.16 XColor thiscolor;
439     register int i, j;
440    
441 greg 1.4 if (ncolors > 0)
442 greg 2.2 return(ncolors);
443     if (ourvinfo.visual == DefaultVisual(ourdisplay,ourscreen)) {
444 greg 1.6 ourmap = DefaultColormap(ourdisplay,ourscreen);
445     goto loop;
446     }
447     newmap:
448 greg 2.2 ourmap = XCreateColormap(ourdisplay,gwind,ourvinfo.visual,AllocNone);
449 greg 1.6 loop:
450 greg 2.2 for (ncolors = ourvinfo.colormap_size;
451     ncolors > ourvinfo.colormap_size/3;
452 greg 1.6 ncolors = ncolors*.937) {
453 greg 1.17 pixval = (unsigned long *)malloc(ncolors*sizeof(unsigned long));
454 greg 1.1 if (pixval == NULL)
455 greg 1.6 return(ncolors = 0);
456 greg 2.8 if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,pixval,ncolors))
457 greg 1.6 break;
458 greg 1.1 free((char *)pixval);
459 greg 1.6 pixval = NULL;
460 greg 1.1 }
461 greg 1.6 if (pixval == NULL) {
462     if (ourmap == DefaultColormap(ourdisplay,ourscreen))
463     goto newmap; /* try it with our map */
464     else
465     return(ncolors = 0); /* failed */
466     }
467 greg 1.16 if (ourmap != DefaultColormap(ourdisplay,ourscreen))
468     for (i = 0; i < ncolors; i++) { /* reset black and white */
469 greg 1.6 if (pixval[i] != ourblack && pixval[i] != ourwhite)
470     continue;
471     thiscolor.pixel = pixval[i];
472     thiscolor.flags = DoRed|DoGreen|DoBlue;
473     XQueryColor(ourdisplay,
474     DefaultColormap(ourdisplay,ourscreen),
475     &thiscolor);
476     XStoreColor(ourdisplay, ourmap, &thiscolor);
477     for (j = i; j+1 < ncolors; j++)
478     pixval[j] = pixval[j+1];
479     ncolors--;
480     i--;
481     }
482 greg 1.16 XSetWindowColormap(ourdisplay, gwind, ourmap);
483 greg 1.6 return(ncolors);
484 greg 1.1 }
485    
486    
487     static
488     freepixels() /* free our pixels */
489     {
490     if (ncolors == 0)
491     return;
492     XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L);
493 greg 2.7 free((char *)pixval);
494     pixval = NULL;
495 greg 1.1 ncolors = 0;
496 greg 1.8 if (ourmap != DefaultColormap(ourdisplay,ourscreen))
497 greg 1.6 XFreeColormap(ourdisplay, ourmap);
498     ourmap = 0;
499 greg 1.1 }
500    
501    
502 greg 1.6 static unsigned long
503     true_pixel(col) /* return true pixel value for color */
504     COLOR col;
505     {
506     unsigned long rval;
507     BYTE rgb[3];
508    
509     map_color(rgb, col);
510 greg 2.2 rval = ourvinfo.red_mask*rgb[RED]/255 & ourvinfo.red_mask;
511     rval |= ourvinfo.green_mask*rgb[GRN]/255 & ourvinfo.green_mask;
512     rval |= ourvinfo.blue_mask*rgb[BLU]/255 & ourvinfo.blue_mask;
513 greg 1.6 return(rval);
514     }
515    
516    
517 greg 1.1 static int
518     x11_getc() /* get a command character */
519     {
520     while (c_last <= c_first) {
521     c_first = c_last = 0; /* reset */
522     getevent(); /* wait for key */
523     }
524     x11_driver.inpready--;
525     return(c_queue[c_first++]);
526     }
527    
528    
529     static
530     getevent() /* get next event */
531     {
532     XNextEvent(ourdisplay, levptr(XEvent));
533     switch (levptr(XEvent)->type) {
534 greg 1.4 case ConfigureNotify:
535     resizewindow(levptr(XConfigureEvent));
536     break;
537     case UnmapNotify:
538 greg 2.8 mapped = 0;
539 greg 1.4 freepixels();
540     break;
541     case MapNotify:
542 greg 2.2 if (ourvinfo.class == PseudoColor ||
543     ourvinfo.class == GrayScale)
544 greg 1.6 if (getpixels() == 0)
545     stderr_v("Cannot allocate colors\n");
546     else
547     new_ctab(ncolors);
548 greg 2.8 mapped = 1;
549 greg 1.4 break;
550     case Expose:
551     fixwindow(levptr(XExposeEvent));
552     break;
553 greg 1.1 case KeyPress:
554     getkey(levptr(XKeyPressedEvent));
555     break;
556     case ButtonPress:
557     break;
558     }
559     }
560    
561    
562     static
563     getkey(ekey) /* get input key */
564     register XKeyPressedEvent *ekey;
565     {
566 greg 1.8 register int n;
567 greg 1.7
568     n = XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last,
569 greg 1.1 NULL, NULL);
570 greg 1.7 c_last += n;
571     x11_driver.inpready += n;
572 greg 1.1 }
573    
574    
575     static
576     fixwindow(eexp) /* repair damage to window */
577     register XExposeEvent *eexp;
578     {
579 greg 2.21 char buf[80];
580    
581 greg 1.4 if (eexp->window == gwind) {
582 greg 2.21 sprintf(buf, "repaint %d %d %d %d\n",
583 greg 1.4 eexp->x, gheight - eexp->y - eexp->height,
584 greg 1.1 eexp->x + eexp->width, gheight - eexp->y);
585 greg 2.21 tocombuf(buf, &x11_driver);
586 greg 1.4 } else if (eexp->window == comline->w) {
587     if (eexp->count == 0)
588     xt_redraw(comline);
589     }
590 greg 1.1 }
591 greg 1.4
592    
593     static
594     resizewindow(ersz) /* resize window */
595     register XConfigureEvent *ersz;
596     {
597 greg 2.17 if (ersz->width == gwidth && ersz->height-comheight == gheight)
598 greg 1.4 return;
599    
600     gwidth = ersz->width;
601 greg 2.17 gheight = ersz->height-comheight;
602 greg 1.4 x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth;
603     x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight;
604    
605 greg 2.21 tocombuf("new\n", &x11_driver);
606 greg 1.4 }