[comp.windows.x] bizarre behaviour???

kaleb@thyme.jpl.nasa.gov (Kaleb Keithley) (12/07/90)

In Xlib, if I create an InputOnly window, with a depth of 0 and no background
attributes, on top of another window, I get a transparent window on which 
I can select for events and "see through" to the parent underneath, i.e. 
I can see text and graphics that are being drawn dynamically on the parent.

If I change if from an InputOnly window to an InputOutput window, (yes,
I know that a depth of 0 on an InputOutput means CopyFromParent) then,
rather than seeing what's on the parent, I get a "hole" through my
application and can see whatever was underneath when the expose event
was received, e.g. root window root-weave, other applications, etc.
(note that what is displayed "underneath" does not change until another
expose event is received.)

I'd like to have a transparent InputOutput window.  I've looked through
the Server dix code for CreateWindow, but alas, I don't see anything
that looks relevent.  The above described behaviour seems odd to me; I'm 
reluctant to call it a bug though.

Sun 4/330, SunOS 4.1, MIT X11R4.18.

Anyone have any thoughts?

-- 
Kaleb Keithley                      Jet Propulsion Labs
kaleb@thyme.jpl.nasa.gov

You can please all of the people some of the time,

etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) (12/07/90)

|> If I change if from an InputOnly window to an InputOutput window, (yes,
|> I know that a depth of 0 on an InputOutput means CopyFromParent) then,
|> rather than seeing what's on the parent, I get a "hole" through my
|> application and can see whatever was underneath when the expose event
|> was received, e.g. root window root-weave, other applications, etc.
|> (note that what is displayed "underneath" does not change until another
|> expose event is received.)
|> 
|> I'd like to have a transparent InputOutput window.  I've looked through
|> the Server dix code for CreateWindow, but alas, I don't see anything
|> that looks relevent.  The above described behaviour seems odd to me; I'm 
|> reluctant to call it a bug though.

This is not a bug. 

A Window without a background is initialized to
whatever was behind it when it was mapped (usually).
I imagine the contents are just plain undefined.

If you don't have a background, something has to go there.

Notice that when you move it around, it keeps the original
contents.
--
					Eric Taylor
					Baylor College of Medicine
					etaylor@wilkins.bcm.tmc.edu
					(713) 798-3776

mouse@LARRY.MCRCIM.MCGILL.EDU (12/10/90)

> In Xlib, if I create an InputOnly window, [...] I get a transparent
> window on which I can select for events and "see through" to the
> parent underneath, i.e. I can see text and graphics that are being
> drawn dynamically on the parent.

Yes.  This is just what InputOutput windows are supposed to be.

> If I change if from an InputOnly window to an InputOutput window
> [...] then, rather than seeing what's on the parent, I get a "hole"
> through my application and can see whatever was underneath when the
> expose event was received, e.g. root window root-weave, other
> applications, etc.

This too is working as it's supposed to.

More precisely, the "background" of an InputOutput window with
background None (which is what you get if you don't specify otherwise)
is defined to be "whatever happens to be lying about on that area of
the screen".  If you map the parent window before mapping the window
whose background is None, you'll see that it just leaves the parent's
bits untouched instead of the "hole through the application" effect
you mentioned.

> I'd like to have a transparent InputOutput window.

This seems to be a common request.  What everybody seems to want is a
window that is either transparent (catches events but lets what's
behind it show through, even when the stuff in back changes) or
nonexistent (neither obscures stuff behind nor catches events), except
where something has been drawn on it.

Standard X does not provide anything of the sort.  The closest
suggestion I can make is to use the SHAPE extension to shape the window
to fit the graphics.  (This gives the second alternative I mentioned
above, nonexistence.  To get transparency, conver it with an InputOnly
window and diddle your event handling.)  Unfortunately, changing shapes
is typically very slow, so this is practical only when you're doing
something whose shape doesn't change often.

Of course, if all you want is the "hole through the application"
effect, you can just use SHAPE to create a hole in the middle of your
top-level window.

					der Mouse

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