dy@cbnewsj.att.com (david.k.yip) (10/03/90)
I have a little shell script (print_window) that takes a snap shot of a window or the screen. This simple shell script is built using xwd and xpr, see below: xwd -frame | xpr -landscape -compact -device ps | prt -l raw The last command in the pipe is our local postscript prt command. Now that I have switched over using tvtwm, the output of print_window no longer work correctly. When I select a window to be printed, the output used to be a snap shot of the selected window. But when using tvtwm, I get a snap shot of the whole screen. If the virtaul desktop option is NOT used, than everything works fine. Has anyone noticed this problem using xwd, running tvtwm + virtaul desktop, to print a window?? The print_window shell script is very useful in our environment and so is the virtaul desktop option. I don't want to lose either thus I would love to know what is the problem and the fix for it. Any info would be greatly appreciated, thanks. David K. Yip AT&T Bell Labs Middletown NJ (201)-957-5544 (dy@mtgzx.att.com)
rlh2@ukc.ac.uk (Richard Hesketh) (10/04/90)
In article <1990Oct3.135738.17668@cbnewsj.att.com> dy@cbnewsj.att.com (david.k.yip) writes: > xwd -frame | xpr -landscape -compact -device ps | prt -l raw >Now that I have switched over using tvtwm, the output of print_window no >longer work correctly. When I select a window to be printed, the output used >to be a snap shot of the selected window. But when using tvtwm, I get a snap >shot of the whole screen. If the virtaul desktop option is NOT used, than >everything works fine. Has anyone noticed this problem using xwd, running >tvtwm + virtaul desktop, to print a window?? 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. Any example of this is given with the tvtwm source. The window id. of the virtual root window is given in a Property set on the server's root window. -- Richard Hesketh : @nsfnet-relay.ac.uk:rlh2@ukc.ac.uk : rlh2@ukc.ac.uk ..!{mcsun|mcvax}!ukc!rlh2 Computing Officer, Computing Lab., University of Kent at Canterbury, Canterbury, Kent, CT2 7NF, United Kingdom. Tel: +44 227 764000 ext 7620/7590 Fax: +44 227 762811
janssen@parc.xerox.com (Bill Janssen) (10/05/90)
Instead of using "xwd -frame", try "asnap -xwd" in your script (asnap.tar.Z is in the contrib directory on expo). The irritation here is that you have to select the area to be printed by hand, instead of just printing the window. The benefit is that you are not restrained to a single window. Bill -- Bill Janssen janssen@parc.xerox.com (415) 494-4763 Xerox Palo Alto Research Center 3333 Coyote Hill Road, Palo Alto, California 94304
janssen@parc.xerox.com (Bill Janssen) (10/05/90)
Whoops! That should be "asnap -xwd -noshow" Bill -- Bill Janssen janssen@parc.xerox.com (415) 494-4763 Xerox Palo Alto Research Center 3333 Coyote Hill Road, Palo Alto, California 94304
moss@brl.mil (Gary S. Moss ) (10/06/90)
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.
moss@brl.mil (Gary S. Moss ) (10/06/90)
In article <JANSSEN.90Oct4210022@holmes.parc.xerox.com>, janssen@parc.xerox.com (Bill Janssen) writes: |> Whoops! That should be |> |> "asnap -xwd -noshow" This doesn't work for me; I get: $ asnap -xwd -noshow | bitimp -h -l -M2 | ... bitimp: window dump file is in bad format I just grabbed asnap off of expo. Anyone else tried it? -Gary
stolcke@ICSI.Berkeley.EDU (Andreas Stolcke) (10/06/90)
|> 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 <X11/X.h> #include <X11/Xatom.h> 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)
janssen@parc.xerox.com (Bill Janssen) (10/13/90)
In article <14031@smoke.BRL.MIL> moss@brl.mil (Gary S. Moss ) writes:
This doesn't work for me; I get:
$ asnap -xwd -noshow | bitimp -h -l -M2 | ...
bitimp: window dump file is in bad format
Hmm...
asnap -xwd -noshow | xpr -device ps | lpr
works fine on either my monochrome or color screen (MIT X11R4, SunOS 4.0.3).
Also works with xwud. Perhaps bitimp is expecting something different?
Bill
--
Bill Janssen janssen@parc.xerox.com (415) 494-4763
Xerox Palo Alto Research Center
3333 Coyote Hill Road, Palo Alto, California 94304