[comp.windows.x] Does a pixmap need be created with the window to be used on?

wyuen@CAE.WISC.EDU (08/27/90)

I'd appreciate any help on the following:

I created a pixmap using XCreateBitmapFromData(
                                                display,
                                                RootWindow(display, screen_id),
                                                data,
                                                WIDTH,
                                                HEIGHT);

and use the pixmap created on another window created later, as its
background_pixmap.

However I'm getting an X_ChangeWindowAttributes error with BadMatch
(invalid parameter attributes) when I, right after created the
window, I call XSetWindowBackgroundPixmap() to set it.

The error goes away when I call XSetWindowBackgroundPixmap() with
ParentRelative as the pixmap argument, ie, not using the pixmap
I created earlier with XCreateBitmapFromData(..., RootWindow(),....)

In addition, the error surfaces only when used on some servers (sparcs
running x11r4) but everything seems fine on Sun3's.

NOW, the question is, is it generally OK to create a pixmap using the
RootWindow() or some other top level windows, and use it later with
other subwindows to be created?

In other words, do I need to create the pixmap with the window I'm
using it on?

Further, the manual says
XCreateBitmapFromData(display, drawable, data, width, height)
drawable - specifies the drawable. This determines which screen to create
           the bitmap on.

It seems to suggest that I should be allowed to create the pixmap from
the RootWindow and use it on other subwindows of this RootWindow.

I want to "associate" the pixmap with the RootWindow during creation
because the subwindows where the pixmap to be used as background will
be dynamically created and destroyed during runtime, but the pixmap
pattern remains the same.

Thanks for any response, preferrably back to the newsgroup as my
email reception is not quite stable.

mouse@LARRY.MCRCIM.MCGILL.EDU (08/29/90)

> I created a pixmap using XCreateBitmapFromData(
>					display,
>					RootWindow(display, screen_id),
>					data,
>					WIDTH,
>					HEIGHT);

> and use the pixmap created on another window created later, as its
> background_pixmap.

> However I'm getting an X_ChangeWindowAttributes error with BadMatch
> (invalid parameter attributes) when I, right after created the
> window, I call XSetWindowBackgroundPixmap() to set it.

The most probable cause that comes to mind is that the window is not
one bit deep.  Since the bitmap you create is only one bit deep, the
window must also be one bit deep, or you will get a BadMatch error.

> In addition, the error surfaces only when used on some servers
> (sparcs running x11r4) but everything seems fine on Sun3's.

Hmmm, are the SPARCs color but the Sun-3s monochrome?

> NOW, the question is, is it generally OK to create a pixmap using the
> RootWindow() or some other top level windows, and use it later with
> other subwindows to be created?

It *ought* to be OK.  If a pixmap created on some screen with some
depth doesn't work with a window of the same screen and depth, there's
a bug somewhere.

					der Mouse

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