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'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

Reply via email to