Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sdd.hp.com!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!agate!pasteur!ICSI.Berkeley.EDU!stolcke From: stolcke@ICSI.Berkeley.EDU (Andreas Stolcke) Newsgroups: comp.windows.x Subject: Re: tvtwm -- printing window problem with tvtwm Keywords: xwd, xprop, virtual root Message-ID: <28513@pasteur.Berkeley.EDU> Date: 5 Oct 90 20:53:24 GMT References: <1990Oct3.135738.17668@cbnewsj.att.com> <5610@harrier.ukc.ac.uk> <14030@smoke.BRL.MIL> Sender: news@pasteur.Berkeley.EDU Reply-To: stolcke@ICSI.Berkeley.EDU (Andreas Stolcke) Organization: International Computer Science Institute, Berkeley, CA Lines: 94 |> In article <5610@harrier.ukc.ac.uk>, rlh2@ukc.ac.uk (Richard Hesketh) writes: |> |> xwd looks for windows that are children of the server's root window. tvtwm |> |> creates its own virtual root window. xwd will have to be modified to look |> |> for windows that are children of this virtual root window. |> If anyone is volunteering to fix "xwd", "xprop" has a similar problem. A while ago I posted a little header file that can be included at the top of most simple X programs that refer to the root window to make them honor virtual roots. I just tried this with both xwd and xprop and magically they now work under tvtwm. Cut the file below and include in dsimple.c after all X11 headers. -- Andreas Stolcke International Computer Science Institute stolcke@icsi.Berkeley.EDU 1957 Center St., Suite 600, Berkeley, CA 94704 (415) 642-4274 ext. 126 --- /* * vroot.h -- Virtual Root Window handling header file * * This header file redefines the X11 macros RootWindow and DefaultRootWindow, * making them look for a virtual root window as provided by certain `virtual' * window managers like swm and tvtwm. If none is found, the ordinary root * window is returned, thus retaining backward compatibility with standard * window managers. * The function implementing the virtual root lookup remembers the result of * its last invocation to avoid overhead in the case of repeated calls * on the same display and screen arguments. * The lookup code itself is taken from Tom LaStrange's ssetroot program. * * Most simple root window changing X programs can be converted to using * virtual roots by just including * * #include "vroot.h" * * after all the X11 header files. It has been tested on such popular * X clients as xphoon, xfroot, xloadimage, and xaqua. * * Andreas Stolcke (stolcke@ICSI.Berkeley.EDU), 9/7/90 */ #include #include static Window VirtualRootWindow(dpy, screen) Display *dpy; { static Display *save_dpy = (Display *)NULL; static int save_screen = -1; static Window root = (Window)NULL; Atom __SWM_VROOT = None; int i; Window rootReturn, parentReturn, *children; unsigned int numChildren; if ( dpy != save_dpy || screen != save_screen ) { root = RootWindow(dpy, screen); /* go look for a virtual root */ __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False); XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren); for (i = 0; i < numChildren; i++) { Atom actual_type; int actual_format; long nitems, bytesafter; Window *newRoot = NULL; if (XGetWindowProperty(dpy, children[i], __SWM_VROOT, 0, 1, False, XA_WINDOW, &actual_type, &actual_format, &nitems, &bytesafter, (unsigned char **) &newRoot) == Success && newRoot) { root = *newRoot; break; } } save_dpy = dpy; save_screen = screen; } return root; } #undef DefaultRootWindow #define DefaultRootWindow(dpy) RootWindow(dpy, DefaultScreen(dpy)) #undef RootWindow #define RootWindow(dpy,screen) VirtualRootWindow(dpy,screen)