60 #if !defined(lint) && !defined(SABER)
61 static const char vroot_rcsid[] =
"#Id: vroot.h,v 1.4 1991/09/30 19:23:16 stolcke Exp stolcke #";
67 #include <X11/Xatom.h>
71 #if defined(__STDC__) || defined(__cplusplus)
72 VirtualRootWindowOfScreen(Screen *screen)
74 VirtualRootWindowOfScreen(screen) Screen *screen;
77 static Screen *save_screen = (Screen *)0;
78 static Window root = (Window)0;
80 if (screen != save_screen) {
81 Display *dpy = DisplayOfScreen(screen);
82 Atom __SWM_VROOT = None;
84 Window rootReturn, parentReturn, *children;
85 unsigned int numChildren;
87 root = RootWindowOfScreen(screen);
90 __SWM_VROOT = XInternAtom(dpy,
"__SWM_VROOT", False);
91 if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
92 &children, &numChildren)) {
93 for (i = 0; i < numChildren; i++) {
96 unsigned long nitems, bytesafter;
97 unsigned char *newRoot = 0;
99 if (XGetWindowProperty(dpy, children[i],
100 __SWM_VROOT, 0, 1, False, XA_WINDOW,
101 &actual_type, &actual_format,
102 &nitems, &bytesafter,
106 void *tmpRoot = (
void *) newRoot;
107 root = *(Window*) tmpRoot;
108 XFree( (
char*) newRoot );
113 XFree((
char *)children);
116 save_screen = screen;
122 #undef RootWindowOfScreen
123 #define RootWindowOfScreen(s) VirtualRootWindowOfScreen(s)
126 #define RootWindow(dpy,screen) VirtualRootWindowOfScreen(ScreenOfDisplay(dpy,screen))
128 #undef DefaultRootWindow
129 #define DefaultRootWindow(dpy) VirtualRootWindowOfScreen(DefaultScreenOfDisplay(dpy))