[comp.windows.x] XSetWindowBackgroundPixmap?

arman@oahu.cs.ucla.edu (Arman Bostani) (03/21/90)

If I'm using XSetWindowBackgroundPixmap(dpy, win, pix), is it
guaranteed that subsequent changes to the pixmap will appear in win,
whenever XClearWindow(win) is called?

[pix is exactly the same size and depth as the win]

example:

         ...
         ...

        XSetWindowBackgroundPixmap(dpy, win, pix);
        XDrawLine(dpy, pix, gc, x0, y0, x1, y1);
        XClearWindow(dpy, win);
        XFlush(dpy);

does the line appear in win?

I have tried this on several X11R3 and R4 servers, and on all but one
update the window from the pixmap after the XClearWindow.

Thanx for the help,
arman.

-- Arman Bostani	// UCLA Computer Science Department
-- arman@CS.UCLA.EDU	// ...!{uunet,rutgers,ucbvax}!cs.ucla.edu!arman

klee@wsl.dec.com (Ken Lee) (03/21/90)

In article <33267@shemp.CS.UCLA.EDU>, arman@oahu.cs.ucla.edu (Arman
Bostani) writes:
> If I'm using XSetWindowBackgroundPixmap(dpy, win, pix), is it
> guaranteed that subsequent changes to the pixmap will appear in win,
> whenever XClearWindow(win) is called?

Background pixmaps are not the same as backing store.  Section 3.2.1 of
the Xlib manual says:  "If you later draw into the pixmap used for the
background, what happens is undefined because the X implementation is
free to make a copy of the pixmap or to use the same pixmap."

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (03/21/90)

    If I'm using XSetWindowBackgroundPixmap(dpy, win, pix), is it
    guaranteed that subsequent changes to the pixmap will appear in win,
    whenever XClearWindow(win) is called?

You will find explicit words about this in both the Xlib and Protocol
manuals.  In Xlib, in Section 3.2.1 (p. 34 in the Digital Press book).
In the Protocol, under CreateWindow (p. 365 in the Digital Press book).
(I'm afraid I couldn't find explicit words in the O'Reilly manuals.)

envbvs@epb2.lbl.gov (Brian V. Smith) (03/22/90)

In article <9003211352.AA03280@expire.lcs.mit.edu>, rws@EXPO.LCS.MIT.EDU
(Bob Scheifler) writes:
|>
|>    If I'm using XSetWindowBackgroundPixmap(dpy, win, pix), is it
|>    guaranteed that subsequent changes to the pixmap will appear in win,
|>    whenever XClearWindow(win) is called?
|>
|>You will find explicit words about this in both the Xlib and Protocol
|>manuals.  In Xlib, in Section 3.2.1 (p. 34 in the Digital Press book).
|>In the Protocol, under CreateWindow (p. 365 in the Digital Press book).
|>(I'm afraid I couldn't find explicit words in the O'Reilly manuals.)
        
Bob, I don't happen to have the Digital Press book, but the O'Reilly manuals.
Could you answer the question? 
The Xlib documentation provided in the X source distribution is not
explicit either.
I am not the person who originally asked, but want to know also.
_____________________________________
Brian V. Smith    (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
I don't speak for LBL, these non-opinions are all mine.

mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (03/22/90)

> If I'm using XSetWindowBackgroundPixmap(dpy, win, pix), is it
> guaranteed that subsequent changes to the pixmap will appear in win,
> whenever XClearWindow(win) is called?

No.  From the Xlib documentation....

	ground.  The background-pixmap can be freed immediately if
	no further explicit reference is made to it (the X server
	will keep a copy to use when needed).  If you later draw
	into the pixmap used for the background, what happens is
	undefined because the X implementation is free to make a
	copy of the pixmap or to use the same pixmap.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (03/22/90)

    The Xlib documentation provided in the X source distribution is not
    explicit either.

You are wrong.  The references I gave were equally valid for the R4
(and also R3) MIT documents, not just the Digital Press version (which
is really just a copy-edit cleanup of the MIT documents).  You really
should learn to use the documentation (that's why I didn't directly
answer the question in the first place), but just to prove you wrong,
I will bother to quote from the MIT Xlib document where I referenced:

If you later draw into the pixmap used for the background,
what happens is undefined because the
X implementation is free to make a copy of the pixmap or
to use the same pixmap.

and from the MIT Protocol document where I referenced:

Subsequent drawing into the background or border pixmap has an
undefined effect on the window state.
The server might or might not make a copy of the pixmap.