tomas@m2cs.uu.no (Tomas Felner) (02/08/90)
NeWS gurus, your attention please: I have a problem with retained canvases under NeWS 1.1. Consider the following scenario: I have a window (LiteWindow) and want to create a button inside that window. The canvas for the button is a direct subcanvas of the window's ClientCanvas. When I move around the window with the button, the button flickers like crazy. Very annoying!! The flickering only occurs when the client canvas (i.e. the parent canvas to the button) is retained. If I make it non-retained, the flickering does not occur. According to the NeWS manual, a retained canvas keeps an offscreen copy of the canvas and uses that copy to repair damage instead of producing damage events. After some investigation I came to the following conclusion: If I move around the retained canvas (the window), it seems that the offscreen copy is constantly (for each movecanvas operation) restored on the canvas, thereby deleting the button. This causes a damage for the button which in turn is also repaired. As a result of this behaviour I get the flickering. If the window is non-retained, moving it around does not cause any damage and thus no restoring or repairing. That's why there's no flickering. I would expect the retained canvas to behave like the non-retained canvas, since I don't see any reason to repair it all the time. My questions are now: Is my conclusion correct, and if not, how does it work instead? If it is correct, why is the retained canvas constantly repaired from the offscreen copy, even if it is not necessary, thereby causing this flickering? And why is this not the case with the non-retained canvas? And finally: How can I make a canvas retained AND avoid the flickering, i.e. avoid the repairing of the canvas with the offscreen copy ???? Some of you might wonder why I don't just make the window non-retained. Well, I want my button to be movable. If I move around the button I would get a lot of /Damage events for the underlying window and handling them is slooow. Setting /SaveBehind to true for the button doesn't help very much either. Furthermore, the window could have bigger damage than just the button area, and fixing that would be even slower. Therefore the window must be retained. While playing around with this stuff I encountered two more strange things: - There's an undocumented operator, 'setretainthreshold'. What is the exact syntax/semantics for it and how does it effect the behaviour of retained canvases? - I wasn't able to set a canvas back to non-retained once it was set to retained. Why is this so? Am I doing something wrong? Does it depend on other things like the canvas being transparent or unmapped or so? I hope, someone can solve the problems, or at least shed some light on them. -- Tomas Felner Modula-2 CASE Systems AS | Internet: tomas@m2cs.uu.no Maridalsveien 139 | Phone: +47 2 379784 N-0461 Oslo 4, Norway | FAX: +47 2 356448