| 35 |
|
#define COMCW 8 /* approx. character width (pixels) */ |
| 36 |
|
#define COMCH 14 /* approx. character height (pixels) */ |
| 37 |
|
|
| 38 |
– |
#ifndef WFLUSH |
| 39 |
– |
#define WFLUSH 30 /* flush after this many rays */ |
| 40 |
– |
#endif |
| 41 |
– |
|
| 38 |
|
#define ourscreen DefaultScreen(ourdisplay) |
| 39 |
|
#define ourroot RootWindow(ourdisplay,ourscreen) |
| 40 |
|
#define ourwhite WhitePixel(ourdisplay,ourscreen) |
| 41 |
|
#define ourblack BlackPixel(ourdisplay,ourscreen) |
| 42 |
|
|
| 47 |
– |
#define checkinp() while (XPending(ourdisplay) > 0) getevent() |
| 48 |
– |
|
| 43 |
|
#define levptr(etype) ((etype *)¤tevent) |
| 44 |
|
|
| 45 |
|
static XEvent currentevent; /* current event */ |
| 68 |
|
extern char *malloc(); |
| 69 |
|
|
| 70 |
|
int x11_close(), x11_clear(), x11_paintr(), x11_errout(), |
| 71 |
< |
x11_getcur(), x11_comout(), x11_comin(); |
| 71 |
> |
x11_getcur(), x11_comout(), x11_comin(), x11_flush(); |
| 72 |
|
|
| 73 |
|
static struct driver x11_driver = { |
| 74 |
|
x11_close, x11_clear, x11_paintr, x11_getcur, |
| 75 |
< |
x11_comout, x11_comin, 1.0 |
| 75 |
> |
x11_comout, x11_comin, x11_flush, 1.0 |
| 76 |
|
}; |
| 77 |
|
|
| 78 |
|
|
| 189 |
|
COLOR col; |
| 190 |
|
int xmin, ymin, xmax, ymax; |
| 191 |
|
{ |
| 198 |
– |
extern long nrays; /* global ray count */ |
| 192 |
|
extern int xnewcolr(); /* pixel assignment routine */ |
| 200 |
– |
static long lastflush = 0; /* ray count at last flush */ |
| 193 |
|
|
| 194 |
|
if (ncolors > 0) { |
| 195 |
|
XSetForeground(ourdisplay, ourgc, |
| 197 |
|
XFillRectangle(ourdisplay, gwind, |
| 198 |
|
ourgc, xmin, gheight-ymax, xmax-xmin, ymax-ymin); |
| 199 |
|
} |
| 200 |
< |
if (nrays - lastflush >= WFLUSH) { |
| 201 |
< |
if (ncolors <= 0) /* output necessary for death */ |
| 202 |
< |
XFillRectangle(ourdisplay, gwind, |
| 203 |
< |
ourgc, 0, 0, 1 ,1); |
| 204 |
< |
checkinp(); |
| 205 |
< |
lastflush = nrays; |
| 206 |
< |
} |
| 200 |
> |
} |
| 201 |
> |
|
| 202 |
> |
|
| 203 |
> |
static |
| 204 |
> |
x11_flush() /* flush output */ |
| 205 |
> |
{ |
| 206 |
> |
if (ncolors <= 0) /* output necessary for death */ |
| 207 |
> |
XFillRectangle(ourdisplay, gwind, ourgc, 0, 0, 1 ,1); |
| 208 |
> |
while (XPending(ourdisplay) > 0) |
| 209 |
> |
getevent(); |
| 210 |
|
} |
| 211 |
|
|
| 212 |
|
|