Re: How to distinguish Window and Pixmap ID
Ren, Zhaohan wrote: Does anyone have a better way? A less hacky (but slower and more bandwidth intensive) way would be to call GetGeometry on the drawable. If x, y, or border-width are 0, then it's a window. Otherwise, take the root window in the reply and use it to walk the entire tree using multiple calls to QueryTree[1]. If you find the drawable ID in the tree, it's a window. Otherwise, it's a pixmap. The *best* way (as Adam hinted) to determine if a drawable is a window or a pixmap is to have two different entry points in your library: PostProcessWindow and PostProcessPixmap (instead of PostProcessDrawable). The application that calls your library will know which one to use. This is the only method that requires zero round-trips to the server. Peter Harris [1] xcb_query_tree will allow you to issue multiple requests at once, saving round-trip delays compared to XQueryTree. But it will still be somewhat slow. -- Open Text Connectivity Solutions Group Peter Harrishttp://www.opentext.com/connectivity Research and DevelopmentPhone: +1 905 762 6001 phar...@opentext.comToll Free: 1 877 359 4866 ___ xorg-devel mailing list xorg-devel@lists.x.org http://lists.x.org/mailman/listinfo/xorg-devel
How to distinguish Window and Pixmap ID
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 ___ xorg-devel mailing list xorg-devel@lists.x.org http://lists.x.org/mailman/listinfo/xorg-devel
Re: How to distinguish Window and Pixmap ID
On Mon, 2009-03-16 at 10:57 +0800, Ren, Zhaohan wrote: Hi all Windows and pixmaps together are known as drawables. Now I get a drawable ID(Created by XCreateWindow or XCreatePixmap) , I want to know how to distinguish them, that is to say how to distinguish if a drawable ID is a pixmap ID or window ID. It seems that I didn't find any Xlib interface to achieve this. Are there any good method to use? There's no good interface for this, or for discovering the type of an arbitrary XID in general. If you think you need one you're probably mistaken. Why do you think you need to do this? You _can_ do something like: 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 */ But really, don't. - ajax signature.asc Description: This is a digitally signed message part ___ xorg-devel mailing list xorg-devel@lists.x.org http://lists.x.org/mailman/listinfo/xorg-devel
RE: How to distinguish Window and Pixmap ID
I'm doing some video post-processing work, if the Drawable created by application interface is a window I will use hardware overlay, if it is a pixmap I will use textured video. Now I see, thank you for your help. -Original Message- From: Adam Jackson [mailto:a...@nwnk.net] Sent: 2009年3月16日 22:31 To: Ren, Zhaohan Cc: xorg-devel@lists.x.org Subject: Re: How to distinguish Window and Pixmap ID On Mon, 2009-03-16 at 10:57 +0800, Ren, Zhaohan wrote: Hi all Windows and pixmaps together are known as drawables. Now I get a drawable ID(Created by XCreateWindow or XCreatePixmap) , I want to know how to distinguish them, that is to say how to distinguish if a drawable ID is a pixmap ID or window ID. It seems that I didn't find any Xlib interface to achieve this. Are there any good method to use? There's no good interface for this, or for discovering the type of an arbitrary XID in general. If you think you need one you're probably mistaken. Why do you think you need to do this? You _can_ do something like: 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 */ But really, don't. - ajax ___ xorg-devel mailing list xorg-devel@lists.x.org http://lists.x.org/mailman/listinfo/xorg-devel
How to distinguish Window and Pixmap ID
Hi all Windows and pixmaps together are known as drawables. Now I get a drawable ID(Created by XCreateWindow or XCreatePixmap) , I want to know how to distinguish them, that is to say how to distinguish if a drawable ID is a pixmap ID or window ID. It seems that I didn't find any Xlib interface to achieve this. Are there any good method to use? Thank you ___ xorg-devel mailing list xorg-devel@lists.x.org http://lists.x.org/mailman/listinfo/xorg-devel