> The man page says that XGetWindowAttributes will work for a pixmap as
> well as for a window, although only some components of the result will
> be meaningful for a pixmap.
>
> When I call XGetWindowAttributes specifying a pixmap for the drawable, I
> get a BadWindow error
>
> Any ideas what I am doing wrong?
I'd say you're mis-reading the man page (or you could be looking at a bugging
man page).
When I look at the man page for XGetWindowAttributes() it shows the syntax
of XGetGeometry() as well. The former takes a window as the 2nd parameter;
the latter takes a drawable as the 2nd parameter.
A drawable is either a window or a pixmap. So XGetGeometry will work for
a pixmap in addition to a window (x_return and y_return always being zero in
the case of a pixmap), but XGetWindowAttributes only works on windows.
>
> I'm building/running on Intel using RedHat Linux. xdpyinfo says:
>
> name of display: :0.0
> version number: 11.0
> vendor string: The XFree86 Project, Inc
> vendor release number: 4003
>
> Here is the output of the following sample program, which exhibits the
> error:
>
> % gcc -g twa.c -o twa -lX11
> % twa
> win: 01a00002 pix: 01a00001
> status for XGetWindowAttributes was 1
> window width: 50 height 50
> X Error of failed request: BadWindow (invalid Window parameter)
> Major opcode of failed request: 3 (X_GetWindowAttributes)
> Resource id in failed request: 0x1a00001
> Serial number of failed request: 12
> Current serial number in output stream: 13
> %
>
> And here is the program:
>
> #include <stdio.h>
> #include <X11/Xlib.h>
>
> main () {
> Display *dpy;
> Window win;
> Pixmap pix;
> Status stat;
> XWindowAttributes wa;
>
>
> dpy = XOpenDisplay ("");
> pix = XCreatePixmap (dpy, DefaultRootWindow(dpy),
> 100, 100, DefaultDepth (dpy, DefaultScreen (dpy)));
> win = XCreateSimpleWindow (dpy, DefaultRootWindow(dpy), 0, 0, 50, 50,
> 0, 0, 0);
>
> printf ("win: %08x pix: %08x\n", win, pix);
>
> stat = XGetWindowAttributes (dpy, win, &wa);
>
> printf ("status for XGetWindowAttributes was %d\n", stat);
> if (stat)
> printf ("window width: %d height %d\n", wa.width, wa.height);
>
> stat = XGetWindowAttributes (dpy, pix, &wa);
> printf ("status for XGetWindowAttributes was %d\n", stat);
> if (stat)
> printf ("pixmap width: %d height %d\n", wa.width, wa.height);
> }
>
>
> _______________________________________________
> Devel mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/devel
>
_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel