[comp.windows.x] Updating a background None window

ado@elsie.UUCP (Arthur David Olson) (07/01/88)

For the sake of concreteness, compile the following code. . .

	#include "X11/Xlib.h"

	main()
	{
		Display *	display;
		Window		window;

		display = XOpenDisplay("");
		XSynchronize(display, 1);
		window = XCreateSimpleWindow(display, RootWindow(display, 0),
			0, 0, 100, 100, 5, 1, 0);
		XSetWindowBackgroundPixmap(display, window, None);
		XMapWindow(display, window);
		for ( ; ; ) {
			XUnmapWindow(display, window);
			XMapWindow(display, window);
			(void) sleep(5);
		}
	}

. . .then run it under your favorite window manager and move the window.

The question on the floor:  is there a better way than Unmapping and reMapping
to get a transparent window's background corrected after it has been moved?
-- 
	ado@ncifcrf.gov			ADO is a trademark of Ampex.

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (07/01/88)

    Date: 30 Jun 88 18:40:46 GMT
    From: elsie!ado@cvl.umd.edu  (Arthur David Olson)

    The question on the floor:  is there a better way than Unmapping and reMapping
    to get a transparent window's background corrected after it has been moved?

You are confusing "transparency" with "background None".  Windows with
background None are not the same as X10 "transparent" windows.  An X11
InputOnly window is "transparent" with respect to output (but unlike
X10, you cannot perform graphics through an InputOnly window).  A window
with background None should primarily be viewed as meaning "don't bother
to repaint my contents, I can't define a background that will paint a
reasonable number of correct bits, I'm going to repaint the entire
exposed region anyway".  For example, a window displaying a complex
image might set the background to None.  There is a tradeoff between
setting a background so that you can "see" the window shape in the
period between when an exposure takes place and the application gets
around to repainting (e.g., right after the window is mapped), and
minimizing useless computation by the server.  A window with background
None can be used to approximate an X10 transparent window, but not
completely (e.g., you have to umap it before moving).

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (07/01/88)

    Date: 30 Jun 88 18:40:46 GMT
    From: elsie!ado@cvl.umd.edu  (Arthur David Olson)

    The question on the floor:  is there a better way than Unmapping and reMapping
    to get a transparent window's background corrected after it has been moved?

I should have amended: X10 transparent windows were used primarily for
two distinct purposes: one was as a rectangular clipping region for
output, and the other was for cursor/input control.  In X11, GCs
provide for general clipping, and InputOnly windows provide for
cursor/input control.