14 |
|
|
15 |
|
#include <stdio.h> |
16 |
|
|
17 |
– |
#include <signal.h> |
18 |
– |
|
17 |
|
#include "color.h" |
18 |
|
|
19 |
|
#include "driver.h" |
24 |
|
|
25 |
|
FILE *devin, *devout; /* communications channels */ |
26 |
|
|
29 |
– |
int notified = 0; /* notified parent of input? */ |
30 |
– |
|
27 |
|
char *progname; /* driver name */ |
28 |
|
|
29 |
|
int r_clear(), r_paintr(), r_getcur(), r_comout(), r_comin(), r_flush(); |
101 |
|
xmin = getw(devin); ymin = getw(devin); |
102 |
|
xmax = getw(devin); ymax = getw(devin); |
103 |
|
(*dev->paintr)(col, xmin, ymin, xmax, ymax); |
108 |
– |
/* check for input */ |
109 |
– |
if (!notified && dev->inpready > 0) { |
110 |
– |
notified = 1; |
111 |
– |
kill(getppid(), SIGIO); |
112 |
– |
} |
104 |
|
} |
105 |
|
|
106 |
|
|
108 |
|
{ |
109 |
|
if (dev->flush != NULL) |
110 |
|
(*dev->flush)(); |
111 |
+ |
putc(COM_FLUSH, devout); |
112 |
+ |
putw(dev->inpready, devout); |
113 |
+ |
fflush(devout); |
114 |
|
} |
115 |
|
|
116 |
|
|
156 |
|
/* reply */ |
157 |
|
putc(COM_COMIN, devout); |
158 |
|
myputs(buf, devout); |
159 |
+ |
putw(dev->inpready, devout); |
160 |
|
fflush(devout); |
166 |
– |
/* reset notify */ |
167 |
– |
notified = 0; |
161 |
|
} |
162 |
|
|
163 |
|
|