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.31 by schorsch, Mon Jul 21 22:30:19 2003 UTC vs.
Revision 2.32 by schorsch, Tue Mar 30 16:13:01 2004 UTC

# Line 22 | Line 22 | static const char      RCSid[] = "$Id$";
22   #include  <X11/cursorfont.h>
23   #include  <X11/Xutil.h>
24  
25 + #include  "platform.h"
26   #include  "color.h"
27   #include  "driver.h"
28   #include  "x11twind.h"
# Line 79 | Line 80 | static Colormap ourmap = 0;            /* our color map */
80  
81   static int  inpcheck;                   /* whence to check input */
82  
83 < static int      x11_getcur();
83 > static void x11_errout(char  *msg);
84  
85 < static void  x11_close(), x11_clear(), x11_paintr(), x11_errout(),
86 <                x11_comout(), x11_comin(), x11_flush();
85 > static dr_closef_t x11_close;
86 > static dr_clearf_t x11_clear;
87 > static dr_paintrf_t x11_paintr;
88 > static dr_getcurf_t x11_getcur;
89 > static dr_comoutf_t x11_comout;
90 > static dr_cominf_t x11_comin;
91 > static dr_flushf_t x11_flush;
92  
93 < static void  std_comin(), std_comout();
93 > static dr_cominf_t std_comin;
94 > static dr_comoutf_t std_comout;
95  
96   static struct driver  x11_driver = {
97          x11_close, x11_clear, x11_paintr, x11_getcur,
98          NULL, NULL, x11_flush, 1.0
99   };
100  
101 < static int  getpixels(), x11_getc();
95 < static void  xnewcolr(), freepixels(), resizewindow(),
96 <                getevent(), getkey(), fixwindow();
97 < static unsigned long  true_pixel();
101 > static dr_getchf_t x11_getc;
102  
103 + static void freepixels(void);
104 + static int getpixels(void);
105 + static dr_newcolrf_t xnewcolr;
106 + static unsigned long true_pixel(COLOR  col);
107 + static void getevent(void);
108 + static void getkey(XKeyPressedEvent  *ekey);
109 + static void fixwindow(XExposeEvent  *eexp);
110 + static void resizewindow(XConfigureEvent  *ersz);
111  
112 < struct driver *
113 < x11_init(name, id)              /* initialize driver */
114 < char  *name, *id;
112 > extern dr_initf_t x11_init; /* XXX this should be in a seperate header file */
113 >
114 >
115 > extern struct driver *
116 > x11_init(               /* initialize driver */
117 >        char  *name,
118 >        char  *id
119 > )
120   {
121          char  *gv;
122          int  nplanes;
# Line 208 | Line 225 | char  *name, *id;
225  
226  
227   static void
228 < x11_close()                     /* close our display */
228 > x11_close(void)                 /* close our display */
229   {
230          erract[COMMAND].pf = NULL;              /* reset error vectors */
231          if (erract[WARNING].pf != NULL)
# Line 231 | Line 248 | x11_close()                    /* close our display */
248  
249  
250   static void
251 < x11_clear(xres, yres)                   /* clear our display */
252 < int  xres, yres;
251 > x11_clear(                      /* clear our display */
252 >        int  xres,
253 >        int  yres
254 > )
255   {
256                                                  /* check limits */
257          if (xres < MINWIDTH)
# Line 278 | Line 297 | int  xres, yres;
297  
298  
299   static void
300 < x11_paintr(col, xmin, ymin, xmax, ymax)         /* fill a rectangle */
301 < COLOR  col;
302 < int  xmin, ymin, xmax, ymax;
300 > x11_paintr(             /* fill a rectangle */
301 >        COLOR  col,
302 >        int  xmin,
303 >        int  ymin,
304 >        int  xmax,
305 >        int  ymax
306 > )
307   {
308          unsigned long  pixel;
309  
# Line 297 | Line 320 | int  xmin, ymin, xmax, ymax;
320  
321  
322   static void
323 < x11_flush()                     /* flush output */
323 > x11_flush(void)                 /* flush output */
324   {
325          char    buf[256];
326          int     n;
# Line 333 | Line 356 | x11_flush()                    /* flush output */
356  
357  
358   static void
359 < x11_comin(inp, prompt)          /* read in a command line */
360 < char  *inp, *prompt;
359 > x11_comin(              /* read in a command line */
360 >        char  *inp,
361 >        char  *prompt
362 > )
363   {
364          if (prompt != NULL) {
365                  x11_flush();            /* make sure we get everything */
# Line 349 | Line 374 | char  *inp, *prompt;
374  
375  
376   static void
377 < x11_comout(outp)                /* output a string to command line */
378 < char  *outp;
377 > x11_comout(             /* output a string to command line */
378 >        char  *outp
379 > )
380   {
381          if (comline == NULL || outp == NULL || !outp[0])
382                  return;
# Line 361 | Line 387 | char  *outp;
387  
388  
389   static void
390 < x11_errout(msg)                 /* output an error message */
391 < char  *msg;
390 > x11_errout(                     /* output an error message */
391 >        char  *msg
392 > )
393   {
394          eputs(msg);             /* send to stderr also! */
395          x11_comout(msg);
# Line 370 | Line 397 | char  *msg;
397  
398  
399   static void
400 < std_comin(inp, prompt)          /* read in command line from stdin */
401 < char  *inp, *prompt;
400 > std_comin(              /* read in command line from stdin */
401 >        char  *inp,
402 >        char  *prompt
403 > )
404   {
405          if (prompt != NULL) {
406                  if (fromcombuf(inp, &x11_driver))
# Line 399 | Line 428 | char  *inp, *prompt;
428  
429  
430   static void
431 < std_comout(outp)                /* write out string to stdout */
432 < char    *outp;
431 > std_comout(             /* write out string to stdout */
432 >        char    *outp
433 > )
434   {
435          fputs(outp, stdout);
436          fflush(stdout);
# Line 408 | Line 438 | char   *outp;
438  
439  
440   static int
441 < x11_getcur(xp, yp)              /* get cursor position */
442 < int  *xp, *yp;
441 > x11_getcur(             /* get cursor position */
442 >        int  *xp,
443 >        int  *yp
444 > )
445   {
446          while (XGrabPointer(ourdisplay, gwind, True, ButtonPressMask,
447                          GrabModeAsync, GrabModeAsync, None, pickcursor,
# Line 437 | Line 469 | int  *xp, *yp;
469  
470  
471   static void
472 < xnewcolr(ndx, r, g, b)          /* enter a color into hardware table */
473 < int  ndx;
474 < int  r, g, b;
472 > xnewcolr(               /* enter a color into hardware table */
473 >        int  ndx,
474 >        int  r,
475 >        int  g,
476 >        int  b
477 > )
478   {
479          XColor  xcolor;
480  
# Line 454 | Line 489 | int  r, g, b;
489  
490  
491   static int
492 < getpixels()                             /* get the color map */
492 > getpixels(void)                         /* get the color map */
493   {
494          XColor  thiscolor;
495          register int  i, j;
# Line 506 | Line 541 | loop:
541  
542  
543   static void
544 < freepixels()                            /* free our pixels */
544 > freepixels(void)                                /* free our pixels */
545   {
546          if (ncolors == 0)
547                  return;
# Line 521 | Line 556 | freepixels()                           /* free our pixels */
556  
557  
558   static unsigned long
559 < true_pixel(col)                 /* return true pixel value for color */
560 < COLOR  col;
559 > true_pixel(                     /* return true pixel value for color */
560 >        COLOR  col
561 > )
562   {
563          unsigned long  rval;
564          BYTE  rgb[3];
# Line 536 | Line 572 | COLOR  col;
572  
573  
574   static int
575 < x11_getc()                      /* get a command character */
575 > x11_getc(void)                  /* get a command character */
576   {
577          while (c_last <= c_first) {
578                  c_first = c_last = 0;           /* reset */
# Line 548 | Line 584 | x11_getc()                     /* get a command character */
584  
585  
586   static void
587 < getevent()                      /* get next event */
587 > getevent(void)                  /* get next event */
588   {
589          XNextEvent(ourdisplay, levptr(XEvent));
590          switch (levptr(XEvent)->type) {
# Line 582 | Line 618 | getevent()                     /* get next event */
618  
619  
620   static void
621 < getkey(ekey)                            /* get input key */
622 < register XKeyPressedEvent  *ekey;
621 > getkey(                         /* get input key */
622 >        register XKeyPressedEvent  *ekey
623 > )
624   {
625          register int  n;
626  
# Line 595 | Line 632 | register XKeyPressedEvent  *ekey;
632  
633  
634   static void
635 < fixwindow(eexp)                         /* repair damage to window */
636 < register XExposeEvent  *eexp;
635 > fixwindow(                              /* repair damage to window */
636 >        register XExposeEvent  *eexp
637 > )
638   {
639          char  buf[80];
640  
# Line 613 | Line 651 | register XExposeEvent  *eexp;
651  
652  
653   static void
654 < resizewindow(ersz)                      /* resize window */
655 < register XConfigureEvent  *ersz;
654 > resizewindow(                   /* resize window */
655 >        register XConfigureEvent  *ersz
656 > )
657   {
658          if (ersz->width == gwidth && ersz->height-comheight == gheight)
659                  return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines