ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/x11.c
(Generate patch)

Comparing ray/src/rt/x11.c (file contents):
Revision 1.1 by greg, Tue Dec 19 12:54:30 1989 UTC vs.
Revision 2.6 by greg, Wed Jun 24 09:12:50 1992 UTC

# Line 1 | Line 1
1 + /* Copyright (c) 1992 Regents of the University of California */
2 +
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
5   #endif
6  
5 /* Copyright (c) 1989 Regents of the University of California */
6
7   /*
8 < *  x11.c - driver for X-windows version 11R4
8 > *  x11.c - driver for X-windows version 11
9   *
10 < *     1989
10 > *     Jan 1990
11   */
12  
13   #include  <stdio.h>
# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #include  <sys/ioctl.h>
16  
17   #include  <X11/Xlib.h>
18 < #include <X11/cursorfont.h>
19 < #include <X11/Xutil.h>
20 < #ifdef notdef
21 < #include  "bcross.cursor"
22 < #include  "bcross_mask.cu"
23 < #endif
18 > #include  <X11/cursorfont.h>
19 > #include  <X11/Xutil.h>
20  
21   #include  "color.h"
26
22   #include  "driver.h"
28
23   #include  "x11twind.h"
24 + #include  "x11icon.h"
25  
26 < #define GAMMA           2.2             /* exponent for color correction */
26 > #define GAMMA           2.2             /* default exponent correction */
27  
28 + #define MINWIDTH        (32*COMCW)      /* minimum graphics window width */
29 + #define MINHEIGHT       MINWIDTH        /* minimum graphics window height */
30 +
31   #define BORWIDTH        5               /* border width */
34 #define BARHEIGHT       25              /* menu bar size */
32   #define COMHEIGHT       (COMLH*COMCH)   /* command line height (pixels) */
33  
34   #define COMFN           "8x13"          /* command line font name */
# Line 39 | Line 36 | static char SCCSid[] = "$SunId$ LBL";
36   #define COMCW           8               /* approx. character width (pixels) */
37   #define COMCH           14              /* approx. character height (pixels) */
38  
39 < #ifndef WFLUSH
40 < #define WFLUSH          30              /* flush after this many rays */
44 < #endif
39 > #define  ourscreen      DefaultScreen(ourdisplay)
40 > #define  ourroot        RootWindow(ourdisplay,ourscreen)
41  
42 < #define  checkinp()     while (XPending(ourdisplay) > 0) getevent()
42 > #define  levptr(etype)  ((etype *)&currentevent)
43  
44 < #define  levptr(etype)  ((etype *)&thisevent)
44 > static XEvent  currentevent;            /* current event */
45  
50 static char  *clientname;               /* calling client's name */
51
52 static XEvent  thisevent;               /* current event */
53
46   static int  ncolors = 0;                /* color table size */
47 < static int  *pixval = NULL;             /* allocated pixels */
47 > static unsigned long  *pixval = NULL;   /* allocated pixels */
48 > static unsigned long  ourblack=0, ourwhite=1;
49  
50   static Display  *ourdisplay = NULL;     /* our display */
51  
52 + static XVisualInfo  ourvinfo;           /* our visual information */
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 */
64 < 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  
# Line 71 | Line 65 | static int  c_last = 0;                        /* last character in queue *
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();
70 > extern char  *malloc(), *getcombuf();
71  
72 < int  x11_close(), x11_clear(), x11_paintr(), x11_errout(),
73 <                x11_getcur(), x11_comout(), x11_comin();
72 > static int  x11_close(), x11_clear(), x11_paintr(), x11_errout(),
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,
84 <        MAXRES, MAXRES
77 >        x11_comout, x11_comin, x11_flush, 1.0
78   };
79  
80  
# Line 89 | Line 82 | struct driver *
82   x11_init(name, id)              /* initialize driver */
83   char  *name, *id;
84   {
85 <        Pixmap  bmCursorSrc, bmCursorMsk;
85 >        extern char  *getenv();
86 >        char  *gv;
87 >        int  nplanes;
88 >        XSetWindowAttributes    ourwinattr;
89 >        XWMHints  ourxwmhints;
90 >        XSizeHints      oursizhints;
91  
92          ourdisplay = XOpenDisplay(NULL);
93          if (ourdisplay == NULL) {
94                  stderr_v("cannot open X-windows; DISPLAY variable set?\n");
95                  return(NULL);
96          }
97 <        if (DisplayPlanes(ourdisplay, DefaultScreen(ourdisplay)) < 4) {
98 <                stderr_v("not enough colors\n");
97 >                                        /* find a usable visual */
98 >        nplanes = DisplayPlanes(ourdisplay, ourscreen);
99 >        if (XMatchVisualInfo(ourdisplay,ourscreen,
100 >                                24,TrueColor,&ourvinfo) ||
101 >                        XMatchVisualInfo(ourdisplay,ourscreen,
102 >                                24,DirectColor,&ourvinfo)) {
103 >                ourblack = 0;
104 >                ourwhite = ourvinfo.red_mask |
105 >                                ourvinfo.green_mask |
106 >                                ourvinfo.blue_mask ;
107 >        } else {
108 >                if (nplanes < 4) {
109 >                        stderr_v("not enough colors\n");
110 >                        return(NULL);
111 >                }
112 >                if (!XMatchVisualInfo(ourdisplay,ourscreen,
113 >                                        nplanes,PseudoColor,&ourvinfo) &&
114 >                                !XMatchVisualInfo(ourdisplay,ourscreen,
115 >                                        nplanes,GrayScale,&ourvinfo)) {
116 >                        stderr_v("unsupported visual type\n");
117 >                        return(NULL);
118 >                }
119 >                ourblack = BlackPixel(ourdisplay,ourscreen);
120 >                ourwhite = WhitePixel(ourdisplay,ourscreen);
121 >        }
122 >                                        /* set gamma */
123 >        if ((gv = getenv("GAMMA")) != NULL)
124 >                make_gmap(atof(gv));
125 >        else
126 >                make_gmap(GAMMA);
127 >                                        /* open window */
128 >        ourwinattr.background_pixel = ourblack;
129 >        ourwinattr.border_pixel = ourblack;
130 >                                        /* this is stupid */
131 >        ourwinattr.colormap = XCreateColormap(ourdisplay, ourroot,
132 >                                ourvinfo.visual, AllocNone);
133 >        gwind = XCreateWindow(ourdisplay, ourroot, 0, 0,
134 >                DisplayWidth(ourdisplay,ourscreen)-2*BORWIDTH,
135 >                DisplayHeight(ourdisplay,ourscreen)-2*BORWIDTH,
136 >                BORWIDTH, ourvinfo.depth, InputOutput, ourvinfo.visual,
137 >                CWBackPixel|CWBorderPixel|CWColormap, &ourwinattr);
138 >        if (gwind == 0) {
139 >                stderr_v("cannot create window\n");
140                  return(NULL);
141          }
142 <        ourmap = DefaultColormap(ourdisplay,DefaultScreen(ourdisplay));
104 <        make_gmap(GAMMA);                       /* make color map */
105 <        /*
106 <        bmCursorSrc = XCreateBitmapFromData(ourdisplay,
107 <                        gwind, bcross_bits,
108 <                        bcross_width, bcross_height);
109 <        bmCursorMsk = XCreateBitmapFromData(ourdisplay,
110 <                        gwind, bcross_mask_bits,
111 <                        bcross_width, bcross_height);
112 <
113 <        pickcursor = XCreatePixmapCursor(ourdisplay,
114 <                        bmCursorSrc, bmCursorMsk,
115 <                        BlackPixel(ourdisplay,
116 <                        DefaultScreen(ourdisplay)),
117 <                        WhitePixel(ourdisplay,
118 <                        DefaultScreen(ourdisplay)),
119 <                        bcross_x_hot, bcross_y_hot);
120 <        XFreePixmap(ourdisplay, bmCursorSrc);
121 <        XFreePixmap(ourdisplay, bmCursorMsk);
122 <        */
142 >        XStoreName(ourdisplay, gwind, id);
143          /* create a cursor */
144 <        pickcursor = XCreateFontCursor (ourdisplay, XC_diamond_cross);
145 <        /*  new */
146 <        clientname = id;
144 >        pickcursor = XCreateFontCursor(ourdisplay, XC_diamond_cross);
145 >        ourgc = XCreateGC(ourdisplay, gwind, 0, NULL);
146 >        ourxwmhints.flags = InputHint|IconPixmapHint;
147 >        ourxwmhints.input = True;
148 >        ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay,
149 >                        gwind, x11icon_bits, x11icon_width, x11icon_height);
150 >        XSetWMHints(ourdisplay, gwind, &ourxwmhints);
151 >        oursizhints.min_width = MINWIDTH;
152 >        oursizhints.min_height = MINHEIGHT+COMHEIGHT;
153 >        oursizhints.flags = PMinSize;
154 >        XSetNormalHints(ourdisplay, gwind, &oursizhints);
155 >        XSelectInput(ourdisplay, gwind, ExposureMask);
156 >        XMapWindow(ourdisplay, gwind);
157 >        XWindowEvent(ourdisplay, gwind, ExposureMask, levptr(XEvent));
158 >        gwidth = levptr(XExposeEvent)->width;
159 >        gheight = levptr(XExposeEvent)->height - COMHEIGHT;
160 >        x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth;
161 >        x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight;
162          x11_driver.inpready = 0;
163          cmdvec = x11_comout;                    /* set error vectors */
164          if (wrnvec != NULL)
# Line 144 | Line 179 | x11_close()                    /* close our display */
179                  xt_close(comline);
180                  comline = NULL;
181          }
147        if (gwind != 0) {
148                XFreeGC(ourdisplay, ourgc);
149                XDestroyWindow(ourdisplay, gwind);
150                gwind = 0;
151                gwidth = gheight = 0;
152                ourgc = 0;
153        }
154        XFreeCursor(ourdisplay, pickcursor);
182          freepixels();
183 +        XFreeGC(ourdisplay, ourgc);
184 +        XDestroyWindow(ourdisplay, gwind);
185 +        gwind = 0;
186 +        ourgc = 0;
187 +        XFreeCursor(ourdisplay, pickcursor);
188          XCloseDisplay(ourdisplay);
189          ourdisplay = NULL;
190   }
# Line 162 | Line 194 | static
194   x11_clear(xres, yres)                   /* clear our display */
195   int  xres, yres;
196   {
197 <        XWMHints  ourxwmhints;
198 <        XSetWindowAttributes ourwindowattr;
199 <
200 <        if (xres != gwidth || yres != gheight) {        /* change window */
201 <                if (comline != NULL)
202 <                        xt_close(comline);
203 <                if (gwind == 0) {                       /* new window */
204 <                        ourwindowattr.backing_store = Always;
205 <                        ourwindowattr.background_pixel =
174 <                        WhitePixel(ourdisplay, DefaultScreen(ourdisplay));
175 <                        ourwindowattr.border_pixel =
176 <                        BlackPixel(ourdisplay, DefaultScreen(ourdisplay));
177 <                        gwind = XCreateWindow(ourdisplay,
178 <                                RootWindow(ourdisplay,
179 <                                DefaultScreen(ourdisplay)),
180 <                                0, 0, xres, yres+COMHEIGHT, BORWIDTH,
181 <                                0, InputOutput, CopyFromParent,
182 <                                CWBackingStore|CWBackPixel|CWBorderPixel,
183 <                                &ourwindowattr);
184 <                        if (gwind == 0)
185 <                                goto fail;
186 <                        XStoreName(ourdisplay, gwind, clientname);
187 <                        ourgc = XCreateGC(ourdisplay, gwind, 0, NULL);
188 <                        ourxwmhints.flags = InputHint;
189 <                        ourxwmhints.input = True;
190 <                        XSetWMHints(ourdisplay, gwind, &ourxwmhints);
191 <                        XSelectInput(ourdisplay, gwind,
192 <                                     KeyPressMask|ButtonPressMask);
193 <                        XMapWindow(ourdisplay, gwind);
194 <                } else                                  /* resize window */
195 <                        XResizeWindow(ourdisplay, gwind, xres, yres+COMHEIGHT);
196 <                comline = xt_open(ourdisplay,
197 <                                DefaultGC(ourdisplay,DefaultScreen(ourdisplay)),
198 <                                gwind, 0, yres, xres, COMHEIGHT, 0, COMFN);
199 <                if (comline == NULL)
200 <                        goto fail;
197 >                                                /* check limits */
198 >        if (xres < MINWIDTH)
199 >                xres = MINWIDTH;
200 >        if (yres < MINHEIGHT)
201 >                yres = MINHEIGHT;
202 >                                                /* resize window */
203 >        if (xres != gwidth || yres != gheight) {
204 >                XSelectInput(ourdisplay, gwind, 0);
205 >                XResizeWindow(ourdisplay, gwind, xres, yres+COMHEIGHT);
206                  gwidth = xres;
207                  gheight = yres;
208                  XFlush(ourdisplay);
209 <                sleep(10);
210 <        } else                                          /* just clear */
211 <                XClearWindow(ourdisplay, gwind);
209 >                sleep(2);                       /* wait for window manager */
210 >                XSync(ourdisplay, 1);           /* discard input */
211 >        }
212 >        XClearWindow(ourdisplay, gwind);
213                                                  /* reinitialize color table */
214 <        if (ncolors == 0 && getpixels() == 0)
215 <                stderr_v("cannot allocate colors\n");
216 <        else
217 <                new_ctab(ncolors);
218 <        return;
219 < fail:
220 <        stderr_v("Failure opening window in x11_clear\n");
221 <        quit(1);
214 >        if (ourvinfo.class == PseudoColor || ourvinfo.class == GrayScale)
215 >                if (getpixels() == 0)
216 >                        stderr_v("cannot allocate colors\n");
217 >                else
218 >                        new_ctab(ncolors);
219 >                                                /* get new command line */
220 >        if (comline != NULL)
221 >                xt_close(comline);
222 >        comline = xt_open(ourdisplay, gwind, 0, gheight,
223 >                        gwidth, COMHEIGHT, 0, ourblack, ourwhite, COMFN);
224 >        if (comline == NULL) {
225 >                stderr_v("Cannot open command line window\n");
226 >                quit(1);
227 >        }
228 >        XSelectInput(ourdisplay, comline->w, ExposureMask);
229 >                                                /* remove earmuffs */
230 >        XSelectInput(ourdisplay, gwind,
231 >                StructureNotifyMask|ExposureMask|KeyPressMask|ButtonPressMask);
232   }
233  
234  
# Line 221 | Line 237 | x11_paintr(col, xmin, ymin, xmax, ymax)                /* fill a rec
237   COLOR  col;
238   int  xmin, ymin, xmax, ymax;
239   {
224        extern long  nrays;             /* global ray count */
240          extern int  xnewcolr();         /* pixel assignment routine */
241 <        static long  lastflush = 0;     /* ray count at last flush */
241 >        extern unsigned long  true_pixel();
242 >        unsigned long  pixel;
243  
244 <        if (ncolors > 0) {
245 <                XSetForeground(ourdisplay, ourgc,
246 <                                pixval[get_pixel(col, xnewcolr)]);
247 <                XFillRectangle(ourdisplay, gwind,
248 <                        ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin);
249 <        }
250 <        if (nrays - lastflush >= WFLUSH) {
251 <                if (ncolors <= 0)       /* output necessary for death */
252 <                        XFillRectangle(ourdisplay, gwind,
237 <                                        ourgc, 0, 0, 1 ,1);
238 <                checkinp();
239 <                lastflush = nrays;
240 <        }
244 >        if (ncolors > 0)
245 >                pixel = pixval[get_pixel(col, xnewcolr)];
246 >        else if (ourvinfo.class == TrueColor || ourvinfo.class == DirectColor)
247 >                pixel = true_pixel(col);
248 >        else
249 >                return;
250 >        XSetForeground(ourdisplay, ourgc, pixel);
251 >        XFillRectangle(ourdisplay, gwind,
252 >                ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin);
253   }
254  
255  
256   static
257 < x11_comin(inp)                  /* read in a command line */
246 < char  *inp;
257 > x11_flush()                     /* flush output */
258   {
259 <        int  x11_getc(), x11_comout();
259 >        XNoOp(ourdisplay);
260 >        while (XPending(ourdisplay) > 0)
261 >                getevent();
262 > }
263  
264 +
265 + static
266 + x11_comin(inp, prompt)          /* read in a command line */
267 + char  *inp, *prompt;
268 + {
269 +        extern int  x11_getc();
270 +
271 +        if (prompt != NULL)
272 +                if (fromcombuf(inp, &x11_driver))
273 +                        return;
274 +                else
275 +                        xt_puts(prompt, comline);
276          xt_cursor(comline, TBLKCURS);
277          editline(inp, x11_getc, x11_comout);
278          xt_cursor(comline, TNOCURS);
# Line 257 | Line 283 | static
283   x11_comout(out)                 /* output a string to command line */
284   char  *out;
285   {
286 <        if (comline != NULL)
287 <                xt_puts(out, comline);
288 <        XFlush(ourdisplay);
286 >        if (comline == NULL)
287 >                return;
288 >        xt_puts(out, comline);
289 >        if (out[strlen(out)-1] == '\n')
290 >                XFlush(ourdisplay);
291   }
292  
293  
# Line 267 | Line 295 | static
295   x11_errout(msg)                 /* output an error message */
296   char  *msg;
297   {
270        x11_comout(msg);
298          stderr_v(msg);          /* send to stderr also! */
299 +        x11_comout(msg);
300   }
301  
302  
# Line 323 | Line 351 | int  r, g, b;
351   static int
352   getpixels()                             /* get the color map */
353   {
354 <        Visual  *ourvis = DefaultVisual(ourdisplay,DefaultScreen(ourdisplay));
354 >        XColor  thiscolor;
355 >        register int  i, j;
356  
357 <        freepixels();
358 <        for (ncolors=(ourvis->map_entries)-3; ncolors>12; ncolors=ncolors*.937){
359 <                pixval = (int *)malloc(ncolors*sizeof(int));
357 >        if (ncolors > 0)
358 >                return(ncolors);
359 >        if (ourvinfo.visual == DefaultVisual(ourdisplay,ourscreen)) {
360 >                ourmap = DefaultColormap(ourdisplay,ourscreen);
361 >                goto loop;
362 >        }
363 > newmap:
364 >        ourmap = XCreateColormap(ourdisplay,gwind,ourvinfo.visual,AllocNone);
365 > loop:
366 >        for (ncolors = ourvinfo.colormap_size;
367 >                        ncolors > ourvinfo.colormap_size/3;
368 >                        ncolors = ncolors*.937) {
369 >                pixval = (unsigned long *)malloc(ncolors*sizeof(unsigned long));
370                  if (pixval == NULL)
371 <                        break;
371 >                        return(ncolors = 0);
372                  if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,
373                                  pixval,ncolors) != 0)
374 <                        return(ncolors);
374 >                        break;
375                  free((char *)pixval);
376 +                pixval = NULL;
377          }
378 <        return(ncolors = 0);
378 >        if (pixval == NULL) {
379 >                if (ourmap == DefaultColormap(ourdisplay,ourscreen))
380 >                        goto newmap;            /* try it with our map */
381 >                else
382 >                        return(ncolors = 0);    /* failed */
383 >        }
384 >        if (ourmap != DefaultColormap(ourdisplay,ourscreen))
385 >                for (i = 0; i < ncolors; i++) { /* reset black and white */
386 >                        if (pixval[i] != ourblack && pixval[i] != ourwhite)
387 >                                continue;
388 >                        thiscolor.pixel = pixval[i];
389 >                        thiscolor.flags = DoRed|DoGreen|DoBlue;
390 >                        XQueryColor(ourdisplay,
391 >                                        DefaultColormap(ourdisplay,ourscreen),
392 >                                        &thiscolor);
393 >                        XStoreColor(ourdisplay, ourmap, &thiscolor);
394 >                        for (j = i; j+1 < ncolors; j++)
395 >                                pixval[j] = pixval[j+1];
396 >                        ncolors--;
397 >                        i--;
398 >                }
399 >        XSetWindowColormap(ourdisplay, gwind, ourmap);
400 >        return(ncolors);
401   }
402  
403  
# Line 346 | Line 408 | freepixels()                           /* free our pixels */
408                  return;
409          XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L);
410          ncolors = 0;
411 +        if (ourmap != DefaultColormap(ourdisplay,ourscreen))
412 +                XFreeColormap(ourdisplay, ourmap);
413 +        ourmap = 0;
414   }
415  
416  
417 + static unsigned long
418 + true_pixel(col)                 /* return true pixel value for color */
419 + COLOR  col;
420 + {
421 +        unsigned long  rval;
422 +        BYTE  rgb[3];
423 +
424 +        map_color(rgb, col);
425 +        rval = ourvinfo.red_mask*rgb[RED]/255 & ourvinfo.red_mask;
426 +        rval |= ourvinfo.green_mask*rgb[GRN]/255 & ourvinfo.green_mask;
427 +        rval |= ourvinfo.blue_mask*rgb[BLU]/255 & ourvinfo.blue_mask;
428 +        return(rval);
429 + }
430 +
431 +
432   static int
433   x11_getc()                      /* get a command character */
434   {
# Line 366 | Line 446 | getevent()                     /* get next event */
446   {
447          XNextEvent(ourdisplay, levptr(XEvent));
448          switch (levptr(XEvent)->type) {
449 +        case ConfigureNotify:
450 +                resizewindow(levptr(XConfigureEvent));
451 +                break;
452 +        case UnmapNotify:
453 +                freepixels();
454 +                break;
455 +        case MapNotify:
456 +                if (ourvinfo.class == PseudoColor ||
457 +                                ourvinfo.class == GrayScale)
458 +                        if (getpixels() == 0)
459 +                                stderr_v("Cannot allocate colors\n");
460 +                        else
461 +                                new_ctab(ncolors);
462 +                break;
463 +        case Expose:
464 +                fixwindow(levptr(XExposeEvent));
465 +                break;
466          case KeyPress:
467                  getkey(levptr(XKeyPressedEvent));
468                  break;
# Line 379 | Line 476 | static
476   getkey(ekey)                            /* get input key */
477   register XKeyPressedEvent  *ekey;
478   {
479 <        c_last += XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last,
479 >        register int  n;
480 >
481 >        n = XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last,
482                                  NULL, NULL);
483 <        x11_driver.inpready = c_last-c_first;
483 >        c_last += n;
484 >        x11_driver.inpready += n;
485   }
486  
487  
388 #ifdef notdef
488   static
489   fixwindow(eexp)                         /* repair damage to window */
490   register XExposeEvent  *eexp;
491   {
492 <        if (eexp->subwindow == 0)
493 <                repaint(eexp->x, gheight - eexp->y - eexp->height,
492 >        if (eexp->window == gwind) {
493 >                sprintf(getcombuf(&x11_driver), "repaint %d %d %d %d\n",
494 >                        eexp->x, gheight - eexp->y - eexp->height,
495                          eexp->x + eexp->width, gheight - eexp->y);
496 <        else if (eexp->subwindow == comline->w)
497 <                xt_redraw(comline);
496 >        } else if (eexp->window == comline->w) {
497 >                if (eexp->count == 0)
498 >                        xt_redraw(comline);
499 >        }
500   }
501 < #endif
501 >
502 >
503 > static
504 > resizewindow(ersz)                      /* resize window */
505 > register XConfigureEvent  *ersz;
506 > {
507 >        if (ersz->width == gwidth && ersz->height-COMHEIGHT == gheight)
508 >                return;
509 >
510 >        gwidth = ersz->width;
511 >        gheight = ersz->height-COMHEIGHT;
512 >        x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth;
513 >        x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight;
514 >
515 >        strcpy(getcombuf(&x11_driver), "new\n");
516 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines