[comp.windows.x] Save under problem

rcb@cccvs1.ncsu.edu (Randy Buckland) (05/18/89)

I am having a problem using save-under attribute that and wondered if anyone
had seen this.

I have a main window with a drawing in it. I have a child of this window
that is unmapped that will overlay part of the drawing and has the
attributes save-under set to true and backing-store set to always (the
contents of the child never change, it's a menu) When I run the program,
everything works ok except that save-under is not being used. I get an expose
event for the main window every time I unmap the child. Now you might
be thinking that save under is not implemented on my workstation, but it is.
I have a vaxstation II monochrome running MIT X11R3 under ultrix 3.0.

I know the save-under works since I can make it start working in my window
in only one way as follows. After the window is created and I verify that
save under is not working, I make sure the child window is mapped and then
push the main window under another window (xterm window). When I recall the
window, the main window is redrawn and the child is not because of the
backing store. At this point, I can unmap the child and the region of the
main under the child is redrawn. Then when I map and unmap the child, the 
save-under works and I don't get an expose event for the main window.

This only works if the child is mapped when the main window is obscured by
another window. If the child is unmapped when the main is pushed down and
brought back, the behavior does not change and I still continue to get
expose events for the main when the child is unmapped.

I also just ran some more tests and find the same behavior on a 
vaxstation 2000 (B&W) running MIT X11R3 and on an IBM PC/RT running IBM's
Xwindows for AIX

Randy Buckland
rcb@ncsuvx.ncsu.edu

msm@SRC.DEC.COM (Mark S. Manasse) (05/19/89)

Randy Buckland wonders why save-under doesn't work on top-level 
windows.  The fault, as usual, is with the window manager; since the 
top-level window is being reparented by the window manager, the 
save-under protects the bits of the window manager's frame, and not 
the bits of other top-level windows.  Window manager writers may want 
to take this effect into account, and relay the request for save-unders 
to the frame window.  Whether window managers should also turn off 
save-unders on the window itself so that the server doesn't store 
a large pixmap for the never-to-be-seen contents of the frame 
underneath the window is a philosophical issue that's better left 
unanswered here.

Randy may also want to make his menu be a transient-for window, which 
some window manager's might use as a hint that save-under would be 
a reasonable idea.

Other than non-reparenting window managers (such as uwm), I don't 
know of any window manager that actually does any of this, by the 
way.

Mark

rws@EXPO.LCS.MIT.EDU (05/19/89)

Although Mark may have correctly interpreted Randy Buckland's scenario,
I'm not convinced he has (but Mark's comments are none-the-less useful for
people to remember).  Randy said:

    I have a main window with a drawing in it. I have a child of this window
    that is unmapped that will overlay part of the drawing and has the
    attributes save-under set to true and backing-store set to always

Note that he said a *child* of the main window, not a sibling.

My recollection is that there was a "feature" in the R3 server that explicitly
avoided having save-under apply to the *parent* of the requesting window.  We
have since decided that this is not such a feature, and save-under does apply
to the parent in our current development server.

[Sorry, you'll have to wait for R4 for a fix from us.]

clive@ixi.UUCP (Clive Feather) (05/20/89)

In article <3018@ncsuvx.ncsu.edu> rcb@cccvs1.ncsu.edu (Randy Buckland) writes:
>I am having a problem using save-under attribute that and wondered if anyone
>had seen this.
>
>I have a main window with a drawing in it. I have a child of this window
>that is unmapped that will overlay part of the drawing and has the
>attributes save-under set to true [...]
>everything works ok except that save-under is not being used. I get an expose
>event for the main window every time I unmap the child. Now you might
>be thinking that save under is not implemented on my workstation, but it is.
>[...]
>I know the save-under works since I can make it start working in my window
>in only one way as follows [...]

Remember that the server is entitled to do what it likes about save-unders
and backing-store; it can always implement them, never implement them, or
switch them on and off every 30 seconds ! The flags in the window attributes
are hints to the server, not commands; when a window is obscured, the server
has the choice of saving the contents or generating an expose when it becomes
visible again.

All this means that you must live with the behaviour you are seeing; the
server is behaving correctly.

Of course, if you are asking *why* your server is behaving this way, then
that's a different and legitimate question (to which I don't know the answer),
provided that you accept that you might not be able to change it.
-- 
Clive D.W. Feather           clive@ixi.uucp
IXI Limited                  ...!mcvax!ukc!ixi!clive (riskier)
                             +44 223 462 131