Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!usc!snorkelwacker!bloom-beacon!EXPO.LCS.MIT.EDU!kit From: kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: Window Creation Question Message-ID: <8910262028.AA16122@expo.lcs.mit.edu> Date: 26 Oct 89 20:28:30 GMT References: <988@odin.SGI.COM> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 54 I will attempt to not let the tone of this message affect my respone, but... > > There is no way to write a proper X program that does not > > handle events. > Hogwash. xsetroot, xhost, xset... You can even do it properly with > a window, depending on what you want done. Okay, fine but 99% of the time if you are not dealing with events you are doing something wrong, and asking for trouble. Perhaps my words were a bit to strong, but unless you REALLY know what you are doing then you had better handle events. The intended audience for this message was novices. Why bother picking this nit? > > You must have a window visable on display, or all your drawing > > commands will be tossed in the bit bucket. The only way to > > make sure that this is true is to wait for expose events. > Don't forget Map events Forget Map events, in this case they are not useful. Mapped windows will not necesarily be visable, or even mapped on the screen. What if you are mapped and you ancestor is unmapped? Exposure is what you want to use when drawing. I stand by my original answer. > > Since the X model also requires the application to repair > > any damage to the window caused by it being obscured, you > > must also be prepared to redraw the contents of your window > > on any expose event. > Hogwash again. The X model does not require interest in Expose events and > therefore interest in those events is selectable. The server will paint > the background of your window as it exposes. Thus, if all you want is > a window with its background (maybe the background is the mona lisa), > you can ignore exposes ad nauseum. (Besides, X doesn't require applications > to have windows.) Seems that this is an nit also. If you are drawing on a window then you will have to repair the damage caused by someone unobscuring a section of that window. Sure the server will fix your background, and if you have nothing of interest to repair you are not required to select for expose events, but that does not change the truth of my original statement. I did write a program that did all the drawing on background pixmaps, but this sucker was a real memory hog. You can get around the X model of exposures and redraws, but you will have a much better application (smaller, and faster) if you work with X and handle your exposure events properly. Attempting to hack things up by using the background pixmap so simulate backing store may seem like the easy way out, but in the long run it is not worth it. Do it "right" the first time and you will be very happy that you did. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213