How to distinguish Window and Pixmap ID

Ren, Zhaohan zhaohan.ren at intel.com
Tue Mar 17 20:05:20 PDT 2009


Hi all
I am using XVideo interface to do video post-processing work. The third argument of XvPutImage is "Drawable d"(see below):
extern int XvPutImage (Display *display, XvPortID id, Drawable d,......);
If the "Drawable" is a window(Created by XCreateWindow) I will use hardware overlay method to display yuv surface, if the "Drawable" is a pixmap(Created by XCreatePixmap) I will use textured blit way. But I don't know how to distinguish if a "Drawable" is a window or a pixmap. Jackson give me a way below(Thank you very much, Jackson):

static int pixmap = 0;
static int pixmap_check(Display *d, void *v) { pixmap = 1; return 0; }
/* ... */
    XWindowAttributes xwa;
    void *old_handler = XSetErrorHandler(dpy, pixmap_check);
    XGetWindowAttributes(dpy, draw, &xwa);
    XSetErrorHandler(dpy, old_handler);
    if (pixmap) /* whatever */

Does anyone have a better way?

Regards


More information about the xorg-devel mailing list