Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!snorkelwacker.mit.edu!hsdndev!husc6!zariski!fry From: fry@zariski.harvard.edu (David Fry) Newsgroups: comp.sys.mac.programmer Subject: Re: Different way to redraw windows? Message-ID: <6717@husc6.harvard.edu> Date: 9 May 91 11:45:39 GMT References: <1991May7.002959.9701@umiami.ir.miami.edu> Sender: news@husc6.harvard.edu Organization: Harvard Math Department Lines: 52 In article <1991May7.002959.9701@umiami.ir.miami.edu> dweisman@umiami.ir.miami.edu (Ordinary Man) writes: >When you have stuff in a window on the screen, and you cover it with another >window, what happens to the bits of memory that were obscured by the covering >window? The bits are REPLACED by the bits of the covering window. >If the memory occupied by 2 windows is separate and contiguous, then >shouldn't the memory of the obscured window remain intact? The memory for all things on the screen is in one piece. It maintains the image of everything on the screen separate from what's in windows. That is, there is no memory of what is in windows. That said, there are two exceptions. The first is when the programmer puts a Picture handle containing a "snapshot" of the window's contents into the WindowRecord, which will force the Window Manager to update the window's appearance whenever necessary. You could call that remembering the bits of the window, but it's not really. The other exception, of course, is when the programmer maintains a copy of the window in an offscreen buffer for fast drawing. Then the "bits" of the window are stored elsewhere, but it's not done by the system and each individual program still responds to update events. >On a similar note, why can't you implement the >redrawing of windows like the Menu Manager handles the redrawing of bits >obscured by a menu when you pull it down? Now that's a fast redraw! :-) You can and many programmers do. It's just using an offscreen buffer. When you put a menu down, the Menu Manager copies the bits that WILL be obscured to a temporary buffer, if memory permits. When you release the menu, the bits are put back from the buffer. If you are "lucky" enough to be running low on memory sometime, you'll be able to notice that if there isn't enough memory for this, the Menu Manager will instead send update events to all the windows that got obscured and redraw the desktop, a slower technique. MS Word comes to mind. I believe that before a dialog box is put up, they copy the current contents of the window offscreen and use them to redraw the window when the dialog box is dismissed. David Fry fry@math.harvard.EDU Department of Mathematics fry@huma1.bitnet Harvard University ...!harvard!huma1!fry Cambridge, MA 02138