Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!csd4.csd.uwm.edu!mailrus!ncar!gatech!bloom-beacon!mote.umb.EDU!karl From: karl@mote.umb.EDU ("Karl Berry.") Newsgroups: comp.windows.x Subject: Handling expose events. Message-ID: <8908220058.AA08564@mote.umb.edu> Date: 22 Aug 89 00:58:16 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 41 Two programs I've worked on recently (Metafont and Ghostscript) are designed to work with many devices; to them, X is just another device. (Well, there are some differences between MF and Ghostscript as far as the way X is used goes, but they aren't relevant for my purposes here.) The interface between any device and the program is a set of small procedures. The program does all the real graphics work. For both these programs, it is quite straightforward to implement the interface procedures in Xlib; from what little I have read of the Xt manual, Xlib seems far more appropriate. It seems like overkill to me to have a widget for these windows, when the only thing that is ever done is drawing rectangles and lines (say). Perhaps I'm wrong about this; that's one of the things I'd like to know. But there is a problem with using Xlib: handling expose events. In neither case does the program keep track of a bitmap representing the current state of the window; it just makes marks as it goes along. And although I could write all the drawing routines to update a bitmap, that is probably an unacceptable memory overhead, and it is certainly not very clean. What I would like to do is get X to tell me when part of the window is obscured; that seems like the VisibilityNotify event. But I also want to get the image that was on the screen with XGetImage (or whatever; the point is to get it from X), and thus I need the coordinates of what was obscured. It looked like (a) those coordinates are not available to me (I suspect I'm wrong about this), and (b) XGetImage is not guaranteed to work on obscured parts of windows, and I only get the event after the window is obscured, so I'm up the creek... The general question is: what is the best approach to this? For example, is it somehow possible to use Xt to handle the Expose events, but deal with the drawing myself? The specific question is: is it possible to handle expose events using Xlib if a bitmap of the window's contents is not kept by the program? Thanks for any help. karl@umb.edu ...!harvard!umb!karl