Re: X11/Spaces thinks X11 windows are overlapping on different Spaces
Re: X11/Spaces thinks X11 windows are overlapping on different Spaces
- Subject: Re: X11/Spaces thinks X11 windows are overlapping on different Spaces
- From: Greg Parker <email@hidden>
- Date: Thu, 8 Nov 2007 01:16:36 -0800
On Nov 8, 2007, at 12:38 AM, Jeremy Huddleston wrote:
The odd thing is that the window IDs get changed at some point, and
X11 looses the window name information. I tested this out on my
linux box and discovered that this occurs whenever I have a WM
running. When I don't have a wm (just have exec xterm in
mw .xinitrc), the window list appears as I'd expect, but when I do
have a WM (even a minimal one like twm), I notice the same thing
(window IDs changed and names becoming null).
Most window managers wrap ("reparent") each client window inside
another window created by the window manager itself. This wrapper
window is where the window manager draws its window decorations (title
bar, close box, etc). Your program's first query is catching its own
windows before the WM reparents them.
This patch looks for a named subwindow if the top-level window didn't
have a name. Works with quartz-wm.
--- xwinlist.c 2007-11-08 01:10:51.000000000 -0800
+++ xwinlist.c 2007-11-08 01:12:35.000000000 -0800
@@ -42,10 +42,24 @@
} else if(children) {
printf("X-Window Stack Order (Bottom-most first):\n");
for(i=0; i < nchildren; i++) {
-// if(children[i] == win1 || children[i] == win2) {
- XFetchName(display, children[i], &name);
- printf("Window %lu : %s\n", children[i], name);
-// }
+ XFetchName(display, children[i], &name);
+ if (!name) {
+ // window has no name - look for a child with a name
+ Window ignore;
+ Window *subchildren;
+ unsigned int nsubchildren, j;
+ s = XQueryTree(display, children[i], &ignore, &ignore,
&subchildren, &nsubchildren);
+ if (s) {
+ for (j = 0; j < nsubchildren; j++) {
+ XFetchName(display, subchildren[j], &name);
+ if (name) break;
+ }
+ XFree(subchildren);
+ }
+ }
+
+ printf("Window %lu : %s\n", children[i], name);
+ if (name) XFree(name);
}
XFree(children);
children = NULL;
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden