ambar@athena.mit.edu (Jean Marie Diaz) (02/03/88)
[These quotes are from an article posted to comp.sources.bugs. I'm crossposting to comp.windows.x because I'd like feedback from there as well...] weissman = Terry Weissman of DEC. (weissman@decwrl.dec.com) caag = Crispin Goswell of RAL (caag@vd.rl.ac.uk) [My X11 driver] doesn't understand expose events. If you obscure or iconify the postscript window, that data won't ever be repainted. This is partially because I didn't see any straightforward way to put in an event-handling loop, and mostly because I was too lazy. - Weismann [There *is* no straight-forward way of putting in an event-handling loop. PostScript is not designed to handle asynchronous input. I believe the only correct solution to this is to demand backing store from the X server. Some PostScript images take minutes or hours to compute. Requiring this to happen just because the user removes an obscuring window is just *wrong*. I think you've done the right thing by not attempting to fix this one. - caag] Well, I wouldn't call it straightforward, but there is a way, which is used by the X11 version of gnuplot (done by Paul Rubin here at Athena). Gnuplot, in its interactive mode, is similar to xps (for lack of a better abbreviation) in that it has an interpreter whose output goes to a different ("output-only") window. Paul's method is as follows: 1) Set up a signal handler which will send us a SIGIO interrupt when data appears on the X server socket. 2) When we get this signal, disable the interrupts (because we're going to start doing Xlib calls, which are not necessarily reentrant). 3) Update the screen. 4) Turn the handler back on. This method works beautifully in gnuplot, which simply replots its equation(s) over the exposed portion of screen. Since this won't work very well for xps, we have one final wrinkle: a call to NewWindowHardware() creates both a Window, and a Pixmap the size and color of the window. Thereafter, whenever the window is written into, the same operation is performed on the pixmap. When we need to refresh, we just copy from the appropriate area on the pixmap. Comments? AMBAR