I am working on an application that would like to manipulate (a copy) of the desktop icons. I have queried the Xtree
of the root window and obtained the the window id`s of the icon window for each top level application (and have even experimented with reparenting them but that gets messy). I know that the window manager, 4dwm on IRIX aka mwm, maintains the pixmap of the applications icon window in order to repaint it once it has been obscured and then exposed.
My question is if there is any mechanism for querying the window manager for the icon window`s pixmap.
For example, I have tried the following code
gc = XtGetGC( w, GCForeground | GCBackground, &gcvalues );
wmhints = XGetWMHints( XtDisplay(bar), top_win );
XCopyArea( dpy, wmhints->icon_pixmap, copy_of_icon_pixmap, gc, 0, 0, ICON_WD, ICON_HT, 0, 0 );
to no avail. I have also wondered if the data is contained in the background_pixmap attribute of the XSetWindowAttributes structure. Unfortunately, the mechanism for communicating this type of data seem to be primarily for INSERTING a pixmap for the icon windows, not the other way around.
Thanks.
‹ Reparenting a Widget internally Another Error from XmHTML ›
Tue, 08/07/2012 - 15:11
#1
Icon data from mwm
There is no formal mechanism for getting that image -- in fact, you`re lucky if the window manager even uses icons. Then, you face the problem of knowing whether the particular application is using an icon pixmap or an icon window.
See this question in the comp.windows.x FAQ
175) Can XGetWindowAttributes get a window`s background pixel/pixmap?
No. Once set, the background pixel or pixmap of a window cannot be re-read
by clients. The reason for this is that a client can create a pixmap, set it
to be the background pixmap of a window, and then free the pixmap. The window
keeps this background, but the pixmap itself is destroyed. If you`re sure a
window has a background pixel (not a pixmap), you can use XClearArea() to
clear a region to the background color and then use XGetImage() to read back
that pixel. However, this action alters the contents of the window, and it
suffers from race conditions with exposures. [courtesy Dave Lemke of NCD and
Stuart Marks of Sun]
Note that the same applies to the border pixel/pixmap. This is a (mis)feature
of the protocol which allows the server to manipulate the pixel/pixmap
however it wants. By not requiring the server to keep the original pixel or
pixmap, some (potentially a lot of) space can be saved. [courtesy Jim
Fulton, then of X Consortium]
So the best you can do is an XGetImage on the area, which is fraught with problems. You could also try to determine the default for the window manager, which has its own problems.