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.4 by greg, Sat May 30 09:32:18 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 */
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 >        int  nplanes;
86 >        XSetWindowAttributes    ourwinattr;
87 >        XWMHints  ourxwmhints;
88 >        XSizeHints      oursizhints;
89  
90          ourdisplay = XOpenDisplay(NULL);
91          if (ourdisplay == NULL) {
92                  stderr_v("cannot open X-windows; DISPLAY variable set?\n");
93                  return(NULL);
94          }
95 <        if (DisplayPlanes(ourdisplay, DefaultScreen(ourdisplay)) < 4) {
96 <                stderr_v("not enough colors\n");
95 >                                        /* find a usable visual */
96 >        nplanes = DisplayPlanes(ourdisplay, ourscreen);
97 >        if (XMatchVisualInfo(ourdisplay,ourscreen,
98 >                                24,TrueColor,&ourvinfo) ||
99 >                        XMatchVisualInfo(ourdisplay,ourscreen,
100 >                                24,DirectColor,&ourvinfo)) {
101 >                ourblack = 0;
102 >                ourwhite = ourvinfo.red_mask |
103 >                                ourvinfo.green_mask |
104 >                                ourvinfo.blue_mask ;
105 >        } else {
106 >                if (nplanes < 4) {
107 >                        stderr_v("not enough colors\n");
108 >                        return(NULL);
109 >                }
110 >                if (!XMatchVisualInfo(ourdisplay,ourscreen,
111 >                                        nplanes,PseudoColor,&ourvinfo) &&
112 >                                !XMatchVisualInfo(ourdisplay,ourscreen,
113 >                                        nplanes,GrayScale,&ourvinfo)) {
114 >                        stderr_v("unsupported visual type\n");
115 >                        return(NULL);
116 >                }
117 >                ourblack = BlackPixel(ourdisplay,ourscreen);
118 >                ourwhite = WhitePixel(ourdisplay,ourscreen);
119 >        }
120 >        make_gmap(GAMMA);
121 >        /* open window */
122 >        ourwinattr.background_pixel = ourblack;
123 >        ourwinattr.border_pixel = ourblack;
124 >                                        /* this is stupid */
125 >        ourwinattr.colormap = XCreateColormap(ourdisplay, ourroot,
126 >                                ourvinfo.visual, AllocNone);
127 >        gwind = XCreateWindow(ourdisplay, ourroot, 0, 0,
128 >                DisplayWidth(ourdisplay,ourscreen)-2*BORWIDTH,
129 >                DisplayHeight(ourdisplay,ourscreen)-2*BORWIDTH,
130 >                BORWIDTH, ourvinfo.depth, InputOutput, ourvinfo.visual,
131 >                CWBackPixel|CWBorderPixel|CWColormap, &ourwinattr);
132 >        if (gwind == 0) {
133 >                stderr_v("cannot create window\n");
134                  return(NULL);
135          }
136 <        ourmap = DefaultColormap(ourdisplay,DefaultScreen(ourdisplay));
137 <        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 <        */
136 >        XFreeColormap(ourdisplay, ourwinattr.colormap);
137 >        XStoreName(ourdisplay, gwind, id);
138          /* create a cursor */
139 <        pickcursor = XCreateFontCursor (ourdisplay, XC_diamond_cross);
140 <        /*  new */
141 <        clientname = id;
139 >        pickcursor = XCreateFontCursor(ourdisplay, XC_diamond_cross);
140 >        ourgc = XCreateGC(ourdisplay, gwind, 0, NULL);
141 >        ourxwmhints.flags = InputHint|IconPixmapHint;
142 >        ourxwmhints.input = True;
143 >        ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay,
144 >                        gwind, x11icon_bits, x11icon_width, x11icon_height);
145 >        XSetWMHints(ourdisplay, gwind, &ourxwmhints);
146 >        oursizhints.min_width = MINWIDTH;
147 >        oursizhints.min_height = MINHEIGHT+COMHEIGHT;
148 >        oursizhints.flags = PMinSize;
149 >        XSetNormalHints(ourdisplay, gwind, &oursizhints);
150 >        XSelectInput(ourdisplay, gwind, ExposureMask);
151 >        XMapWindow(ourdisplay, gwind);
152 >        XWindowEvent(ourdisplay, gwind, ExposureMask, levptr(XEvent));
153 >        gwidth = levptr(XExposeEvent)->width;
154 >        gheight = levptr(XExposeEvent)->height - COMHEIGHT;
155 >        x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth;
156 >        x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight;
157          x11_driver.inpready = 0;
158          cmdvec = x11_comout;                    /* set error vectors */
159          if (wrnvec != NULL)
# Line 144 | Line 174 | x11_close()                    /* close our display */
174                  xt_close(comline);
175                  comline = NULL;
176          }
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);
177          freepixels();
178 +        XFreeGC(ourdisplay, ourgc);
179 +        XDestroyWindow(ourdisplay, gwind);
180 +        gwind = 0;
181 +        ourgc = 0;
182 +        XFreeCursor(ourdisplay, pickcursor);
183          XCloseDisplay(ourdisplay);
184          ourdisplay = NULL;
185   }
# Line 162 | Line 189 | static
189   x11_clear(xres, yres)                   /* clear our display */
190   int  xres, yres;
191   {
192 <        XWMHints  ourxwmhints;
193 <        XSetWindowAttributes ourwindowattr;
194 <
195 <        if (xres != gwidth || yres != gheight) {        /* change window */
196 <                if (comline != NULL)
197 <                        xt_close(comline);
198 <                if (gwind == 0) {                       /* new window */
199 <                        ourwindowattr.backing_store = Always;
200 <                        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;
192 >                                                /* check limits */
193 >        if (xres < MINWIDTH)
194 >                xres = MINWIDTH;
195 >        if (yres < MINHEIGHT)
196 >                yres = MINHEIGHT;
197 >                                                /* resize window */
198 >        if (xres != gwidth || yres != gheight) {
199 >                XSelectInput(ourdisplay, gwind, 0);
200 >                XResizeWindow(ourdisplay, gwind, xres, yres+COMHEIGHT);
201                  gwidth = xres;
202                  gheight = yres;
203                  XFlush(ourdisplay);
204 <                sleep(10);
205 <        } else                                          /* just clear */
206 <                XClearWindow(ourdisplay, gwind);
204 >                sleep(2);                       /* wait for window manager */
205 >                XSync(ourdisplay, 1);           /* discard input */
206 >        }
207 >        XClearWindow(ourdisplay, gwind);
208                                                  /* reinitialize color table */
209 <        if (ncolors == 0 && getpixels() == 0)
210 <                stderr_v("cannot allocate colors\n");
211 <        else
212 <                new_ctab(ncolors);
213 <        return;
214 < fail:
215 <        stderr_v("Failure opening window in x11_clear\n");
216 <        quit(1);
209 >        if (ourvinfo.class == PseudoColor || ourvinfo.class == GrayScale)
210 >                if (getpixels() == 0)
211 >                        stderr_v("cannot allocate colors\n");
212 >                else
213 >                        new_ctab(ncolors);
214 >                                                /* get new command line */
215 >        if (comline != NULL)
216 >                xt_close(comline);
217 >        comline = xt_open(ourdisplay, gwind, 0, gheight,
218 >                        gwidth, COMHEIGHT, 0, ourblack, ourwhite, COMFN);
219 >        if (comline == NULL) {
220 >                stderr_v("Cannot open command line window\n");
221 >                quit(1);
222 >        }
223 >        XSelectInput(ourdisplay, comline->w, ExposureMask);
224 >                                                /* remove earmuffs */
225 >        XSelectInput(ourdisplay, gwind,
226 >                StructureNotifyMask|ExposureMask|KeyPressMask|ButtonPressMask);
227   }
228  
229  
# Line 221 | Line 232 | x11_paintr(col, xmin, ymin, xmax, ymax)                /* fill a rec
232   COLOR  col;
233   int  xmin, ymin, xmax, ymax;
234   {
224        extern long  nrays;             /* global ray count */
235          extern int  xnewcolr();         /* pixel assignment routine */
236 <        static long  lastflush = 0;     /* ray count at last flush */
236 >        extern unsigned long  true_pixel();
237 >        unsigned long  pixel;
238  
239 <        if (ncolors > 0) {
240 <                XSetForeground(ourdisplay, ourgc,
241 <                                pixval[get_pixel(col, xnewcolr)]);
242 <                XFillRectangle(ourdisplay, gwind,
243 <                        ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin);
244 <        }
245 <        if (nrays - lastflush >= WFLUSH) {
246 <                if (ncolors <= 0)       /* output necessary for death */
247 <                        XFillRectangle(ourdisplay, gwind,
237 <                                        ourgc, 0, 0, 1 ,1);
238 <                checkinp();
239 <                lastflush = nrays;
240 <        }
239 >        if (ncolors > 0)
240 >                pixel = pixval[get_pixel(col, xnewcolr)];
241 >        else if (ourvinfo.class == TrueColor || ourvinfo.class == DirectColor)
242 >                pixel = true_pixel(col);
243 >        else
244 >                return;
245 >        XSetForeground(ourdisplay, ourgc, pixel);
246 >        XFillRectangle(ourdisplay, gwind,
247 >                ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin);
248   }
249  
250  
251   static
252 < x11_comin(inp)                  /* read in a command line */
246 < char  *inp;
252 > x11_flush()                     /* flush output */
253   {
254 <        int  x11_getc(), x11_comout();
254 >        XNoOp(ourdisplay);
255 >        while (XPending(ourdisplay) > 0)
256 >                getevent();
257 > }
258  
259 +
260 + static
261 + x11_comin(inp, prompt)          /* read in a command line */
262 + char  *inp, *prompt;
263 + {
264 +        extern int  x11_getc();
265 +
266 +        if (prompt != NULL)
267 +                if (fromcombuf(inp, &x11_driver))
268 +                        return;
269 +                else
270 +                        xt_puts(prompt, comline);
271          xt_cursor(comline, TBLKCURS);
272          editline(inp, x11_getc, x11_comout);
273          xt_cursor(comline, TNOCURS);
# Line 257 | Line 278 | static
278   x11_comout(out)                 /* output a string to command line */
279   char  *out;
280   {
281 <        if (comline != NULL)
282 <                xt_puts(out, comline);
283 <        XFlush(ourdisplay);
281 >        if (comline == NULL)
282 >                return;
283 >        xt_puts(out, comline);
284 >        if (out[strlen(out)-1] == '\n')
285 >                XFlush(ourdisplay);
286   }
287  
288  
# Line 267 | Line 290 | static
290   x11_errout(msg)                 /* output an error message */
291   char  *msg;
292   {
270        x11_comout(msg);
293          stderr_v(msg);          /* send to stderr also! */
294 +        x11_comout(msg);
295   }
296  
297  
# Line 323 | Line 346 | int  r, g, b;
346   static int
347   getpixels()                             /* get the color map */
348   {
349 <        Visual  *ourvis = DefaultVisual(ourdisplay,DefaultScreen(ourdisplay));
349 >        XColor  thiscolor;
350 >        register int  i, j;
351  
352 <        freepixels();
353 <        for (ncolors=(ourvis->map_entries)-3; ncolors>12; ncolors=ncolors*.937){
354 <                pixval = (int *)malloc(ncolors*sizeof(int));
352 >        if (ncolors > 0)
353 >                return(ncolors);
354 >        if (ourvinfo.visual == DefaultVisual(ourdisplay,ourscreen)) {
355 >                ourmap = DefaultColormap(ourdisplay,ourscreen);
356 >                goto loop;
357 >        }
358 > newmap:
359 >        ourmap = XCreateColormap(ourdisplay,gwind,ourvinfo.visual,AllocNone);
360 > loop:
361 >        for (ncolors = ourvinfo.colormap_size;
362 >                        ncolors > ourvinfo.colormap_size/3;
363 >                        ncolors = ncolors*.937) {
364 >                pixval = (unsigned long *)malloc(ncolors*sizeof(unsigned long));
365                  if (pixval == NULL)
366 <                        break;
366 >                        return(ncolors = 0);
367                  if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,
368                                  pixval,ncolors) != 0)
369 <                        return(ncolors);
369 >                        break;
370                  free((char *)pixval);
371 +                pixval = NULL;
372          }
373 <        return(ncolors = 0);
373 >        if (pixval == NULL) {
374 >                if (ourmap == DefaultColormap(ourdisplay,ourscreen))
375 >                        goto newmap;            /* try it with our map */
376 >                else
377 >                        return(ncolors = 0);    /* failed */
378 >        }
379 >        if (ourmap != DefaultColormap(ourdisplay,ourscreen))
380 >                for (i = 0; i < ncolors; i++) { /* reset black and white */
381 >                        if (pixval[i] != ourblack && pixval[i] != ourwhite)
382 >                                continue;
383 >                        thiscolor.pixel = pixval[i];
384 >                        thiscolor.flags = DoRed|DoGreen|DoBlue;
385 >                        XQueryColor(ourdisplay,
386 >                                        DefaultColormap(ourdisplay,ourscreen),
387 >                                        &thiscolor);
388 >                        XStoreColor(ourdisplay, ourmap, &thiscolor);
389 >                        for (j = i; j+1 < ncolors; j++)
390 >                                pixval[j] = pixval[j+1];
391 >                        ncolors--;
392 >                        i--;
393 >                }
394 >        XSetWindowColormap(ourdisplay, gwind, ourmap);
395 >        return(ncolors);
396   }
397  
398  
# Line 346 | Line 403 | freepixels()                           /* free our pixels */
403                  return;
404          XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L);
405          ncolors = 0;
406 +        if (ourmap != DefaultColormap(ourdisplay,ourscreen))
407 +                XFreeColormap(ourdisplay, ourmap);
408 +        ourmap = 0;
409   }
410  
411  
412 + static unsigned long
413 + true_pixel(col)                 /* return true pixel value for color */
414 + COLOR  col;
415 + {
416 +        unsigned long  rval;
417 +        BYTE  rgb[3];
418 +
419 +        map_color(rgb, col);
420 +        rval = ourvinfo.red_mask*rgb[RED]/255 & ourvinfo.red_mask;
421 +        rval |= ourvinfo.green_mask*rgb[GRN]/255 & ourvinfo.green_mask;
422 +        rval |= ourvinfo.blue_mask*rgb[BLU]/255 & ourvinfo.blue_mask;
423 +        return(rval);
424 + }
425 +
426 +
427   static int
428   x11_getc()                      /* get a command character */
429   {
# Line 366 | Line 441 | getevent()                     /* get next event */
441   {
442          XNextEvent(ourdisplay, levptr(XEvent));
443          switch (levptr(XEvent)->type) {
444 +        case ConfigureNotify:
445 +                resizewindow(levptr(XConfigureEvent));
446 +                break;
447 +        case UnmapNotify:
448 +                freepixels();
449 +                break;
450 +        case MapNotify:
451 +                if (ourvinfo.class == PseudoColor ||
452 +                                ourvinfo.class == GrayScale)
453 +                        if (getpixels() == 0)
454 +                                stderr_v("Cannot allocate colors\n");
455 +                        else
456 +                                new_ctab(ncolors);
457 +                break;
458 +        case Expose:
459 +                fixwindow(levptr(XExposeEvent));
460 +                break;
461          case KeyPress:
462                  getkey(levptr(XKeyPressedEvent));
463                  break;
# Line 379 | Line 471 | static
471   getkey(ekey)                            /* get input key */
472   register XKeyPressedEvent  *ekey;
473   {
474 <        c_last += XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last,
474 >        register int  n;
475 >
476 >        n = XLookupString(ekey, c_queue+c_last, sizeof(c_queue)-c_last,
477                                  NULL, NULL);
478 <        x11_driver.inpready = c_last-c_first;
478 >        c_last += n;
479 >        x11_driver.inpready += n;
480   }
481  
482  
388 #ifdef notdef
483   static
484   fixwindow(eexp)                         /* repair damage to window */
485   register XExposeEvent  *eexp;
486   {
487 <        if (eexp->subwindow == 0)
488 <                repaint(eexp->x, gheight - eexp->y - eexp->height,
487 >        if (eexp->window == gwind) {
488 >                sprintf(getcombuf(&x11_driver), "repaint %d %d %d %d\n",
489 >                        eexp->x, gheight - eexp->y - eexp->height,
490                          eexp->x + eexp->width, gheight - eexp->y);
491 <        else if (eexp->subwindow == comline->w)
492 <                xt_redraw(comline);
491 >        } else if (eexp->window == comline->w) {
492 >                if (eexp->count == 0)
493 >                        xt_redraw(comline);
494 >        }
495   }
496 < #endif
496 >
497 >
498 > static
499 > resizewindow(ersz)                      /* resize window */
500 > register XConfigureEvent  *ersz;
501 > {
502 >        if (ersz->width == gwidth && ersz->height-COMHEIGHT == gheight)
503 >                return;
504 >
505 >        gwidth = ersz->width;
506 >        gheight = ersz->height-COMHEIGHT;
507 >        x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth;
508 >        x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight;
509 >
510 >        strcpy(getcombuf(&x11_driver), "new\n");
511 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines