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 2.5 by greg, Thu Jun 18 14:55:24 1992 UTC vs.
Revision 2.33 by greg, Wed Nov 21 16:42:03 2007 UTC

# Line 1 | Line 1
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 + #if  !defined(FNDELAY) && defined(O_NONBLOCK)
13 + #define  FNDELAY  O_NONBLOCK
14 + #endif
15  
16   #include  <X11/Xlib.h>
17   #include  <X11/cursorfont.h>
18   #include  <X11/Xutil.h>
19  
20 + #include  "platform.h"
21   #include  "color.h"
22   #include  "driver.h"
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 */
29 > #define MINHEIGHT       (MINWIDTH/2)    /* minimum graphics window height */
30  
31   #define BORWIDTH        5               /* border width */
32   #define COMHEIGHT       (COMLH*COMCH)   /* command line height (pixels) */
# Line 44 | Line 44 | static char SCCSid[] = "$SunId$ LBL";
44   static XEvent  currentevent;            /* current event */
45  
46   static int  ncolors = 0;                /* color table size */
47 + static int  mapped = 0;                 /* window is mapped? */
48   static unsigned long  *pixval = NULL;   /* allocated pixels */
49   static unsigned long  ourblack=0, ourwhite=1;
50  
# Line 57 | Line 58 | static Cursor  pickcursor = 0;         /* cursor used for pic
58  
59   static int  gwidth, gheight;            /* graphics window size */
60  
61 + static int  comheight;                  /* desired comline height */
62   static TEXTWIND  *comline = NULL;       /* our command line */
63  
64   static char  c_queue[64];               /* input queue */
# Line 67 | Line 69 | static GC  ourgc = 0;                  /* our graphics context for dr
69  
70   static Colormap ourmap = 0;             /* our color map */
71  
72 < extern char  *malloc(), *getcombuf();
72 > #define IC_X11          0
73 > #define IC_IOCTL        1
74 > #define IC_READ         2
75  
76 < static int  x11_close(), x11_clear(), x11_paintr(), x11_errout(),
73 <                x11_getcur(), x11_comout(), x11_comin(), x11_flush();
76 > static int  inpcheck;                   /* whence to check input */
77  
78 + static void x11_errout(char  *msg);
79 +
80 + static dr_closef_t x11_close;
81 + static dr_clearf_t x11_clear;
82 + static dr_paintrf_t x11_paintr;
83 + static dr_getcurf_t x11_getcur;
84 + static dr_comoutf_t x11_comout;
85 + static dr_cominf_t x11_comin;
86 + static dr_flushf_t x11_flush;
87 +
88 + static dr_cominf_t std_comin;
89 + static dr_comoutf_t std_comout;
90 +
91   static struct driver  x11_driver = {
92          x11_close, x11_clear, x11_paintr, x11_getcur,
93 <        x11_comout, x11_comin, x11_flush, 1.0
93 >        NULL, NULL, x11_flush, 1.0
94   };
95  
96 + static dr_getchf_t x11_getc;
97  
98 < struct driver *
99 < x11_init(name, id)              /* initialize driver */
100 < char  *name, *id;
98 > static void freepixels(void);
99 > static int getpixels(void);
100 > static dr_newcolrf_t xnewcolr;
101 > static unsigned long true_pixel(COLOR  col);
102 > static void getevent(void);
103 > static void getkey(XKeyPressedEvent  *ekey);
104 > static void fixwindow(XExposeEvent  *eexp);
105 > static void resizewindow(XConfigureEvent  *ersz);
106 >
107 > extern dr_initf_t x11_init; /* XXX this should be in a seperate header file */
108 >
109 >
110 > extern struct driver *
111 > x11_init(               /* initialize driver */
112 >        char  *name,
113 >        char  *id
114 > )
115   {
116 +        char  *gv;
117          int  nplanes;
118          XSetWindowAttributes    ourwinattr;
119          XWMHints  ourxwmhints;
120          XSizeHints      oursizhints;
121 <
121 >                                        /* open display server */
122          ourdisplay = XOpenDisplay(NULL);
123          if (ourdisplay == NULL) {
124 <                stderr_v("cannot open X-windows; DISPLAY variable set?\n");
124 >                eputs("cannot open X-windows; DISPLAY variable set?\n");
125                  return(NULL);
126          }
127                                          /* find a usable visual */
128          nplanes = DisplayPlanes(ourdisplay, ourscreen);
129          if (XMatchVisualInfo(ourdisplay,ourscreen,
130 <                                24,TrueColor,&ourvinfo) ||
130 >                                nplanes>12?nplanes:24,TrueColor,&ourvinfo) ||
131                          XMatchVisualInfo(ourdisplay,ourscreen,
132 <                                24,DirectColor,&ourvinfo)) {
132 >                                nplanes>12?nplanes:24,DirectColor,&ourvinfo)) {
133                  ourblack = 0;
134                  ourwhite = ourvinfo.red_mask |
135                                  ourvinfo.green_mask |
136                                  ourvinfo.blue_mask ;
137          } else {
138                  if (nplanes < 4) {
139 <                        stderr_v("not enough colors\n");
139 >                        eputs("not enough colors\n");
140                          return(NULL);
141                  }
142                  if (!XMatchVisualInfo(ourdisplay,ourscreen,
143                                          nplanes,PseudoColor,&ourvinfo) &&
144                                  !XMatchVisualInfo(ourdisplay,ourscreen,
145                                          nplanes,GrayScale,&ourvinfo)) {
146 <                        stderr_v("unsupported visual type\n");
146 >                        eputs("unsupported visual type\n");
147                          return(NULL);
148                  }
149                  ourblack = BlackPixel(ourdisplay,ourscreen);
150                  ourwhite = WhitePixel(ourdisplay,ourscreen);
151          }
152 <        make_gmap(GAMMA);
153 <        /* open window */
152 >                                        /* set gamma */
153 >        if ((gv = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL
154 >                        || (gv = getenv("DISPLAY_GAMMA")) != NULL)
155 >                make_gmap(atof(gv));
156 >        else
157 >                make_gmap(GAMMA);
158 >                                        /* X11 command line or no? */
159 >        if (!strcmp(name, "x11"))
160 >                comheight = COMHEIGHT;
161 >        else /* "x11d" */ {
162 >                comheight = 0;
163 > #ifndef  FNDELAY
164 >                eputs("warning: x11d driver not fully functional on this machine\n");
165 > #endif
166 >        }
167 >                                        /* open window */
168          ourwinattr.background_pixel = ourblack;
169          ourwinattr.border_pixel = ourblack;
170                                          /* this is stupid */
# Line 130 | Line 176 | char  *name, *id;
176                  BORWIDTH, ourvinfo.depth, InputOutput, ourvinfo.visual,
177                  CWBackPixel|CWBorderPixel|CWColormap, &ourwinattr);
178          if (gwind == 0) {
179 <                stderr_v("cannot create window\n");
179 >                eputs("cannot create window\n");
180                  return(NULL);
181          }
182          XStoreName(ourdisplay, gwind, id);
# Line 143 | Line 189 | char  *name, *id;
189                          gwind, x11icon_bits, x11icon_width, x11icon_height);
190          XSetWMHints(ourdisplay, gwind, &ourxwmhints);
191          oursizhints.min_width = MINWIDTH;
192 <        oursizhints.min_height = MINHEIGHT+COMHEIGHT;
192 >        oursizhints.min_height = MINHEIGHT+comheight;
193          oursizhints.flags = PMinSize;
194          XSetNormalHints(ourdisplay, gwind, &oursizhints);
195          XSelectInput(ourdisplay, gwind, ExposureMask);
196          XMapWindow(ourdisplay, gwind);
197          XWindowEvent(ourdisplay, gwind, ExposureMask, levptr(XEvent));
198          gwidth = levptr(XExposeEvent)->width;
199 <        gheight = levptr(XExposeEvent)->height - COMHEIGHT;
199 >        gheight = levptr(XExposeEvent)->height - comheight;
200          x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth;
201          x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight;
202          x11_driver.inpready = 0;
203 <        cmdvec = x11_comout;                    /* set error vectors */
204 <        if (wrnvec != NULL)
205 <                wrnvec = x11_errout;
203 >        mapped = 1;
204 >                                        /* set i/o vectors */
205 >        if (comheight) {
206 >                x11_driver.comin = x11_comin;
207 >                x11_driver.comout = x11_comout;
208 >                erract[COMMAND].pf = x11_comout;
209 >                if (erract[WARNING].pf != NULL)
210 >                        erract[WARNING].pf = x11_errout;
211 >                inpcheck = IC_X11;
212 >        } else {
213 >                x11_driver.comin = std_comin;
214 >                x11_driver.comout = std_comout;
215 >                erract[COMMAND].pf = std_comout;
216 >                inpcheck = IC_IOCTL;
217 >        }
218          return(&x11_driver);
219   }
220  
221  
222 < static
223 < x11_close()                     /* close our display */
222 > static void
223 > x11_close(void)                 /* close our display */
224   {
225 <        cmdvec = NULL;                          /* reset error vectors */
226 <        if (wrnvec != NULL)
227 <                wrnvec = stderr_v;
225 >        erract[COMMAND].pf = NULL;              /* reset error vectors */
226 >        if (erract[WARNING].pf != NULL)
227 >                erract[WARNING].pf = wputs;
228          if (ourdisplay == NULL)
229                  return;
230          if (comline != NULL) {
# Line 184 | Line 242 | x11_close()                    /* close our display */
242   }
243  
244  
245 < static
246 < x11_clear(xres, yres)                   /* clear our display */
247 < int  xres, yres;
245 > static void
246 > x11_clear(                      /* clear our display */
247 >        int  xres,
248 >        int  yres
249 > )
250   {
251                                                  /* check limits */
252          if (xres < MINWIDTH)
# Line 196 | Line 256 | int  xres, yres;
256                                                  /* resize window */
257          if (xres != gwidth || yres != gheight) {
258                  XSelectInput(ourdisplay, gwind, 0);
259 <                XResizeWindow(ourdisplay, gwind, xres, yres+COMHEIGHT);
259 >                XResizeWindow(ourdisplay, gwind, xres, yres+comheight);
260                  gwidth = xres;
261                  gheight = yres;
262                  XFlush(ourdisplay);
# Line 205 | Line 265 | int  xres, yres;
265          }
266          XClearWindow(ourdisplay, gwind);
267                                                  /* reinitialize color table */
268 <        if (ourvinfo.class == PseudoColor || ourvinfo.class == GrayScale)
268 >        if (ourvinfo.class == PseudoColor || ourvinfo.class == GrayScale) {
269                  if (getpixels() == 0)
270 <                        stderr_v("cannot allocate colors\n");
270 >                        eputs("cannot allocate colors\n");
271                  else
272                          new_ctab(ncolors);
273 +        }
274                                                  /* get new command line */
275          if (comline != NULL)
276                  xt_close(comline);
277 <        comline = xt_open(ourdisplay, gwind, 0, gheight,
278 <                        gwidth, COMHEIGHT, 0, ourblack, ourwhite, COMFN);
279 <        if (comline == NULL) {
280 <                stderr_v("Cannot open command line window\n");
281 <                quit(1);
282 <        }
283 <        XSelectInput(ourdisplay, comline->w, ExposureMask);
277 >        if (comheight) {
278 >                comline = xt_open(ourdisplay, gwind, 0, gheight, gwidth,
279 >                                comheight, 0, ourblack, ourwhite, COMFN);
280 >                if (comline == NULL) {
281 >                        eputs("cannot open command line window\n");
282 >                        quit(1);
283 >                }
284 >                XSelectInput(ourdisplay, comline->w, ExposureMask);
285                                                  /* remove earmuffs */
286 <        XSelectInput(ourdisplay, gwind,
286 >                XSelectInput(ourdisplay, gwind,
287                  StructureNotifyMask|ExposureMask|KeyPressMask|ButtonPressMask);
288 +        } else                                  /* remove earmuffs */
289 +                XSelectInput(ourdisplay, gwind,
290 +                        StructureNotifyMask|ExposureMask|ButtonPressMask);
291   }
292  
293  
294 < static
295 < x11_paintr(col, xmin, ymin, xmax, ymax)         /* fill a rectangle */
296 < COLOR  col;
297 < int  xmin, ymin, xmax, ymax;
294 > static void
295 > x11_paintr(             /* fill a rectangle */
296 >        COLOR  col,
297 >        int  xmin,
298 >        int  ymin,
299 >        int  xmax,
300 >        int  ymax
301 > )
302   {
234        extern int  xnewcolr();         /* pixel assignment routine */
235        extern unsigned long  true_pixel();
303          unsigned long  pixel;
304  
305 +        if (!mapped)
306 +                return;
307          if (ncolors > 0)
308                  pixel = pixval[get_pixel(col, xnewcolr)];
240        else if (ourvinfo.class == TrueColor || ourvinfo.class == DirectColor)
241                pixel = true_pixel(col);
309          else
310 <                return;
310 >                pixel = true_pixel(col);
311          XSetForeground(ourdisplay, ourgc, pixel);
312          XFillRectangle(ourdisplay, gwind,
313                  ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin);
314   }
315  
316  
317 < static
318 < x11_flush()                     /* flush output */
317 > static void
318 > x11_flush(void)                 /* flush output */
319   {
320 +        char    buf[256];
321 +        int     n;
322 +                                                /* check for input */
323          XNoOp(ourdisplay);
324 <        while (XPending(ourdisplay) > 0)
324 >        n = XPending(ourdisplay);                       /* from X server */
325 >        while (n-- > 0)
326                  getevent();
327 + #ifdef FNDELAY
328 +        if (inpcheck == IC_IOCTL) {                     /* from stdin */
329 + #ifdef FIONREAD
330 +                if (ioctl(fileno(stdin), FIONREAD, &n) < 0) {
331 + #else
332 +                if (1) {
333 + #endif
334 +                        if (fcntl(fileno(stdin), F_SETFL, FNDELAY) < 0) {
335 +                                eputs("cannot change input mode\n");
336 +                                quit(1);
337 +                        }
338 +                        inpcheck = IC_READ;
339 +                } else
340 +                        x11_driver.inpready += n;
341 +        }
342 +        if (inpcheck == IC_READ) {
343 +                n = read(fileno(stdin), buf, sizeof(buf)-1);
344 +                if (n > 0) {
345 +                        buf[n] = '\0';
346 +                        tocombuf(buf, &x11_driver);
347 +                }
348 +        }
349 + #endif
350   }
351  
352  
353 < static
354 < x11_comin(inp, prompt)          /* read in a command line */
355 < char  *inp, *prompt;
353 > static void
354 > x11_comin(              /* read in a command line */
355 >        char  *inp,
356 >        char  *prompt
357 > )
358   {
359 <        extern int  x11_getc();
360 <
265 <        if (prompt != NULL)
359 >        if (prompt != NULL) {
360 >                x11_flush();            /* make sure we get everything */
361                  if (fromcombuf(inp, &x11_driver))
362                          return;
363 <                else
364 <                        xt_puts(prompt, comline);
363 >                xt_puts(prompt, comline);
364 >        }
365          xt_cursor(comline, TBLKCURS);
366          editline(inp, x11_getc, x11_comout);
367          xt_cursor(comline, TNOCURS);
368   }
369  
370  
371 < static
372 < x11_comout(out)                 /* output a string to command line */
373 < char  *out;
371 > static void
372 > x11_comout(             /* output a string to command line */
373 >        char  *outp
374 > )
375   {
376 <        if (comline == NULL)
376 >        if (comline == NULL || outp == NULL || !outp[0])
377                  return;
378 <        xt_puts(out, comline);
379 <        if (out[strlen(out)-1] == '\n')
378 >        xt_puts(outp, comline);
379 >        if (outp[strlen(outp)-1] == '\n')
380                  XFlush(ourdisplay);
381   }
382  
383  
384 < static
385 < x11_errout(msg)                 /* output an error message */
386 < char  *msg;
384 > static void
385 > x11_errout(                     /* output an error message */
386 >        char  *msg
387 > )
388   {
389 <        stderr_v(msg);          /* send to stderr also! */
389 >        eputs(msg);             /* send to stderr also! */
390          x11_comout(msg);
391   }
392  
393  
394 + static void
395 + std_comin(              /* read in command line from stdin */
396 +        char  *inp,
397 +        char  *prompt
398 + )
399 + {
400 +        if (prompt != NULL) {
401 +                if (fromcombuf(inp, &x11_driver))
402 +                        return;
403 +                if (!x11_driver.inpready)
404 +                        std_comout(prompt);
405 +        }
406 + #ifdef FNDELAY
407 +        if (inpcheck == IC_READ) {      /* turn off FNDELAY */
408 +                if (fcntl(fileno(stdin), F_SETFL, 0) < 0) {
409 +                        eputs("cannot change input mode\n");
410 +                        quit(1);
411 +                }
412 +                inpcheck = IC_IOCTL;
413 +        }
414 + #endif
415 +        if (gets(inp) == NULL) {
416 +                strcpy(inp, "quit");
417 +                return;
418 +        }
419 +        x11_driver.inpready -= strlen(inp) + 1;
420 +        if (x11_driver.inpready < 0)
421 +                x11_driver.inpready = 0;
422 + }
423 +
424 +
425 + static void
426 + std_comout(             /* write out string to stdout */
427 +        char    *outp
428 + )
429 + {
430 +        fputs(outp, stdout);
431 +        fflush(stdout);
432 + }
433 +
434 +
435   static int
436 < x11_getcur(xp, yp)              /* get cursor position */
437 < int  *xp, *yp;
436 > x11_getcur(             /* get cursor position */
437 >        int  *xp,
438 >        int  *yp
439 > )
440   {
441          while (XGrabPointer(ourdisplay, gwind, True, ButtonPressMask,
442                          GrabModeAsync, GrabModeAsync, None, pickcursor,
# Line 313 | Line 453 | int  *xp, *yp;
453          if (c_last > c_first)                   /* key pressed */
454                  return(x11_getc());
455                                                  /* button pressed */
456 <        if (levptr(XButtonPressedEvent)->button & Button1)
456 >        if (levptr(XButtonPressedEvent)->button == Button1)
457                  return(MB1);
458 <        if (levptr(XButtonPressedEvent)->button & Button2)
458 >        if (levptr(XButtonPressedEvent)->button == Button2)
459                  return(MB2);
460 <        if (levptr(XButtonPressedEvent)->button & Button3)
460 >        if (levptr(XButtonPressedEvent)->button == Button3)
461                  return(MB3);
322        if (levptr(XButtonPressedEvent)->button & (Button4|Button5))
323                return(MB1);
462          return(ABORT);
463   }
464  
465  
466 < static
467 < xnewcolr(ndx, r, g, b)          /* enter a color into hardware table */
468 < int  ndx;
469 < int  r, g, b;
466 > static void
467 > xnewcolr(               /* enter a color into hardware table */
468 >        int  ndx,
469 >        int  r,
470 >        int  g,
471 >        int  b
472 > )
473   {
474          XColor  xcolor;
475  
# Line 343 | Line 484 | int  r, g, b;
484  
485  
486   static int
487 < getpixels()                             /* get the color map */
487 > getpixels(void)                         /* get the color map */
488   {
489          XColor  thiscolor;
490          register int  i, j;
# Line 363 | Line 504 | loop:
504                  pixval = (unsigned long *)malloc(ncolors*sizeof(unsigned long));
505                  if (pixval == NULL)
506                          return(ncolors = 0);
507 <                if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,
367 <                                pixval,ncolors) != 0)
507 >                if (XAllocColorCells(ourdisplay,ourmap,0,NULL,0,pixval,ncolors))
508                          break;
509 <                free((char *)pixval);
509 >                free((void *)pixval);
510                  pixval = NULL;
511          }
512          if (pixval == NULL) {
# Line 395 | Line 535 | loop:
535   }
536  
537  
538 < static
539 < freepixels()                            /* free our pixels */
538 > static void
539 > freepixels(void)                                /* free our pixels */
540   {
541          if (ncolors == 0)
542                  return;
543          XFreeColors(ourdisplay,ourmap,pixval,ncolors,0L);
544 +        free((void *)pixval);
545 +        pixval = NULL;
546          ncolors = 0;
547          if (ourmap != DefaultColormap(ourdisplay,ourscreen))
548                  XFreeColormap(ourdisplay, ourmap);
# Line 409 | Line 551 | freepixels()                           /* free our pixels */
551  
552  
553   static unsigned long
554 < true_pixel(col)                 /* return true pixel value for color */
555 < COLOR  col;
554 > true_pixel(                     /* return true pixel value for color */
555 >        COLOR  col
556 > )
557   {
558          unsigned long  rval;
559          BYTE  rgb[3];
# Line 424 | Line 567 | COLOR  col;
567  
568  
569   static int
570 < x11_getc()                      /* get a command character */
570 > x11_getc(void)                  /* get a command character */
571   {
572          while (c_last <= c_first) {
573                  c_first = c_last = 0;           /* reset */
# Line 435 | Line 578 | x11_getc()                     /* get a command character */
578   }
579  
580  
581 < static
582 < getevent()                      /* get next event */
581 > static void
582 > getevent(void)                  /* get next event */
583   {
584          XNextEvent(ourdisplay, levptr(XEvent));
585          switch (levptr(XEvent)->type) {
# Line 444 | Line 587 | getevent()                     /* get next event */
587                  resizewindow(levptr(XConfigureEvent));
588                  break;
589          case UnmapNotify:
590 +                mapped = 0;
591                  freepixels();
592                  break;
593          case MapNotify:
594                  if (ourvinfo.class == PseudoColor ||
595 <                                ourvinfo.class == GrayScale)
595 >                                ourvinfo.class == GrayScale) {
596                          if (getpixels() == 0)
597 <                                stderr_v("Cannot allocate colors\n");
597 >                                eputs("cannot allocate colors\n");
598                          else
599                                  new_ctab(ncolors);
600 +                }
601 +                mapped = 1;
602                  break;
603          case Expose:
604                  fixwindow(levptr(XExposeEvent));
# Line 466 | Line 612 | getevent()                     /* get next event */
612   }
613  
614  
615 < static
616 < getkey(ekey)                            /* get input key */
617 < register XKeyPressedEvent  *ekey;
615 > static void
616 > getkey(                         /* get input key */
617 >        register XKeyPressedEvent  *ekey
618 > )
619   {
620          register int  n;
621  
# Line 479 | Line 626 | register XKeyPressedEvent  *ekey;
626   }
627  
628  
629 < static
630 < fixwindow(eexp)                         /* repair damage to window */
631 < register XExposeEvent  *eexp;
629 > static void
630 > fixwindow(                              /* repair damage to window */
631 >        register XExposeEvent  *eexp
632 > )
633   {
634 +        char  buf[80];
635 +
636          if (eexp->window == gwind) {
637 <                sprintf(getcombuf(&x11_driver), "repaint %d %d %d %d\n",
637 >                sprintf(buf, "repaint %d %d %d %d\n",
638                          eexp->x, gheight - eexp->y - eexp->height,
639                          eexp->x + eexp->width, gheight - eexp->y);
640 +                tocombuf(buf, &x11_driver);
641          } else if (eexp->window == comline->w) {
642                  if (eexp->count == 0)
643                          xt_redraw(comline);
# Line 494 | Line 645 | register XExposeEvent  *eexp;
645   }
646  
647  
648 < static
649 < resizewindow(ersz)                      /* resize window */
650 < register XConfigureEvent  *ersz;
648 > static void
649 > resizewindow(                   /* resize window */
650 >        register XConfigureEvent  *ersz
651 > )
652   {
653 <        if (ersz->width == gwidth && ersz->height-COMHEIGHT == gheight)
653 >        if (ersz->width == gwidth && ersz->height-comheight == gheight)
654                  return;
655  
656          gwidth = ersz->width;
657 <        gheight = ersz->height-COMHEIGHT;
657 >        gheight = ersz->height-comheight;
658          x11_driver.xsiz = gwidth < MINWIDTH ? MINWIDTH : gwidth;
659          x11_driver.ysiz = gheight < MINHEIGHT ? MINHEIGHT : gheight;
660  
661 <        strcpy(getcombuf(&x11_driver), "new\n");
661 >        tocombuf("new\n", &x11_driver);
662   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines