21 |
|
|
22 |
|
char *progname; /* global argv[0] */ |
23 |
|
|
24 |
< |
#define SERV_READY 01 |
25 |
< |
#define DEV_READY 02 |
24 |
> |
#define RDY_SRV 01 |
25 |
> |
#define RDY_DEV 02 |
26 |
|
|
27 |
|
|
28 |
|
main(argc, argv) |
39 |
|
/* enter main loop */ |
40 |
|
do { |
41 |
|
rdy = disp_wait(); |
42 |
< |
if (rdy & DEV_READY) { /* get user input */ |
42 |
> |
if (rdy & RDY_DEV) { /* get user input */ |
43 |
|
inp = dev_input(); |
44 |
|
if (inp & DEV_NEWVIEW) |
45 |
|
new_view(&odev.v); |
46 |
|
if (inp & DEV_SHUTDOWN) |
47 |
|
serv_request(DR_SHUTDOWN, 0, NULL); |
48 |
+ |
if (inp & DEV_REDRAW) { |
49 |
+ |
imm_mode = 1; /* preempt updates */ |
50 |
+ |
beam_sync(); |
51 |
+ |
} |
52 |
|
if (inp & DEV_WAIT) |
53 |
|
pause = 1; |
54 |
|
if (inp & DEV_RESUME) { |
56 |
|
pause = 0; |
57 |
|
} |
58 |
|
} |
59 |
< |
if (rdy & SERV_READY) { /* get server result */ |
59 |
> |
if (rdy & RDY_SRV) { /* get server result */ |
60 |
|
res = serv_result(); |
61 |
|
if (pause && res != DS_SHUTDOWN) { |
62 |
|
serv_request(DR_ATTEN, 0, NULL); |
80 |
|
register int i; |
81 |
|
/* see if we can avoid select call */ |
82 |
|
if (imm_mode || stdin->_cnt > 0) |
83 |
< |
return(SERV_READY); |
83 |
> |
return(RDY_SRV); |
84 |
|
if (dev_flush()) |
85 |
< |
return(DEV_READY); |
85 |
> |
return(RDY_DEV); |
86 |
|
/* make the call */ |
87 |
|
FD_ZERO(&readset); FD_ZERO(&errset); |
88 |
|
FD_SET(0, &readset); |
98 |
|
} |
99 |
|
flgs = 0; /* flag what's ready */ |
100 |
|
if (FD_ISSET(0, &readset) || FD_ISSET(0, &errset)) |
101 |
< |
flgs |= SERV_READY; |
101 |
> |
flgs |= RDY_SRV; |
102 |
|
if (FD_ISSET(odev.ifd, &readset) || FD_ISSET(odev.ifd, &errset)) |
103 |
< |
flgs |= DEV_READY; |
103 |
> |
flgs |= RDY_DEV; |
104 |
|
return(flgs); |
105 |
|
} |
106 |
|
|