[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

874.0. "Question about SAVE_UNDER Attribute" by WHELIN::ADAVIS (Andrew J. Davis) Fri Jun 02 1989 12:48

Here's a question that was raised in my recent DECwindows programming
lab course a few weeks ago.

It seems that the SAVE_UNDER window attribute does not work as indicated.

It was our, (the people in the class), understanding that the SAVE_UNDER 
attribute worked as follows:

Given two windows, WINDOW-A and WINDOW-B:

if WINDOW-A is moved to a point at which it occludes WINDOW-B AND WINDOW-A
has the SAVE_UNDER attribute turned on then the information displayed in
WINDOW-B is saved. If WINDOW-A is then iconified or moved away from
WINDOW-B, the entire original contents of WINDOW-B would be displayed.

This, however, was not the case, instead, WINDOW-B, which originally
contained text now appeared with a blank background.

Is this the correct definition of the SAVE_UNDER attribute?  If so, was the
result described above correct and does SAVE_UNDER actually NOT work as
indicated?  If not, what is required to achieve the desired result,
(i.e. redisplaying the text).

Thanks,

Andrew

T.RTitleUserPersonal
Name
DateLines
874.1Oh wellCASEE::LACROIXGone with the windFri Jun 02 1989 13:0413
    It seems like your understanding of save under is correct, except for
    one thing: the save under flag is just a flag which means 'Hey Server,
    t'would be great if you could save the content of any window I could
    obscure'. You don't have any guarantee that the server will follow your
    advice; the server could always take your hint in account, sometimes
    take it in account, or never take it in account. I'm not 100% positive,
    but I believe that our V1 servers just ignore this hint; in other
    words, your WINDOW-B will not automagically be repainted, and you need
    some code to handle the expose events and do the right thing. Things
    may be different in V2, I don't know.

    Denis.

874.2Beg all you want...STAR::BRANDENBERGSi vis pacem para bellumFri Jun 02 1989 13:466
    
    SaveUnders, like backing store, is purely advisory and not implemented
    in the V1.0 VMS Server.  (You can be 100% positive now, Denis.)
    
    					monty

874.3PSW::WINALSKICareful with that VAX, EugeneFri Jun 02 1989 15:098
And even if it were implemented, your application still cannot rely on the hint
being taken--it must still be prepared to handle exposure events anywhere in its
windows, at any time.  The only advantage of specifying the save-under hint is
that, if the hint is taken, you will get fewer (or no) expose events actually
generated and thus things will run more efficiently.

--PSW

874.4Server says it'll do save unders, but how?SX4GTO::ROSESat Sep 30 1989 02:4047
    The PMAX color server (in UWS2.2 field test at least) claims that it
    does save unders. Unfortunately, I haven't been able to get them to
    happen. Maybe I'm doing something stupid, it's so late at night...
    
    Sample program follows. The idea is there's one window inside the
    other. If you click in the larger window, the smaller one is mapped or
    unmapped. Notice that the larger window gets an expose event on each
    unmap, in spite of the save unders.

#include <stdio.h>
#include <X11/Xlib.h>

main() {
    Display *d;
    Window w,w2;
    XEvent ev;
    XSetWindowAttributes xwa;
    int w2_mapped;

    d = XOpenDisplay("");
    XSynchronize(d,1);
    printf(" Does save unders = %d\n",
        DoesSaveUnders(DefaultScreenOfDisplay(d)));
    w = XCreateSimpleWindow(d,RootWindow(d,0),100,100,300,300,
        0,BlackPixel(d,0),WhitePixel(d,0));
    xwa.border_pixel = BlackPixel(d,0);
    xwa.save_under = 1;
    w2 = XCreateWindow(d,w,10,10,100,100,1,CopyFromParent,
        CopyFromParent,CopyFromParent,CWBorderPixel|CWSaveUnder,&xwa);
    w2_mapped = 0; 
    XSelectInput(d,w,ButtonPressMask|ExposureMask);
    XMapWindow(d,w);
    while (1) {                                                       
        XNextEvent(d,&ev);
        if (ev.type == ButtonPress) {
            if (w2_mapped) {
                XUnmapWindow(d,w2);
                w2_mapped = 0;
            } else {
                XMapWindow(d,w2);
                w2_mapped = 1;
            }
        } else if (ev.type == Expose && ev.xexpose.window == w) 
            printf("x \n");
    }
}