Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!linus!philabs!nbc1!nbc1!colin From: colin@nbc1.ge.com (Colin Rafferty) Newsgroups: comp.sources.d Subject: Re: xroach problems. (unofficial patch) Message-ID: Date: 29 Mar 91 19:45:29 GMT References: <+j7f0b+@rpi.edu> <1991Mar27.060714.19885@mel.dit.csiro.au> Sender: colin@nbc1.ge.com (Colin Rafferty) Followup-To: comp.sources.d Organization: National Broadcasting Company, New York City Lines: 109 In-Reply-To: simon@opal.CS.TU-Berlin.DE's message of 27 Mar 91 15:24:54 GMT In article simon@opal.CS.TU-Berlin.DE (Simon Leinen) writes: > >>>>> On 27 Mar 91 06:07:14 GMT, simonm@mel.dit.csiro.au (Simon > >>>>> McClenahan) said: > SimonM> I can't help you, but I manage to compile it, and it just > SimonM> plain doesn't work! > Do you use tvtwm? Then the ordinary root window (on which the > cockroaches run around) will be covered by the virtual desktop window. > You have to #include "vroot.h" in the `xroach.c' file *after* > . The file `vroot.h' redefines two preprocessor macros > `RootWindow' and `DefaultRootWindow' to do the right thing in the > presence of a virtual desktop. It was written by Andreas Stolcke of > ICSI and can be FTPed from export.lcs.mit.edu, File /contrib/vroot.h. Alternatively, you can install this patch that I made. Note that this is an unofficial patch to xroach. I sent it to the author, and he said that he would be including it with other revisions that he's making. So if you don't use tvtwm, don't bother with this. If you do, then install this patch, and then uninstall it before you install the official first patch. -Colin --8<---8<---8<---8<---8<---8<--- cut here --8<---8<---8<---8<---8<---8<--- *** xroach.c.orig Wed Mar 27 13:02:21 1991 --- xroach.c Wed Mar 27 14:37:09 1991 *************** *** 5,10 **** --- 5,14 ---- jta@locus.com + Modified: Colin Rafferty (colin@nbc1.ge.com) 3/27/91 + Made it be usable with tvtwm. Code added taken + from ssetroot modified by Tom LaStrange. + This program may be freely distributed provided that all copyright notices are retained. *************** *** 16,21 **** --- 20,26 ---- #include #include #include + #include #include #include *************** *** 73,78 **** --- 78,85 ---- int curRoaches = 0; float roachSpeed = 20.0; + Atom __SWM_VROOT = None; + Region rootVisible = NULL; void Usage(); *************** *** 100,105 **** --- 107,115 ---- char *roachColor = "black"; int nVis; int needCalc; + Window rootReturn, parentReturn, *children; + unsigned int numChildren; + int i; /* Process command line options. *************** *** 145,150 **** --- 155,181 ---- rootWin = RootWindow(display, screen); black = BlackPixel(display, screen); white = WhitePixel(display, screen); + + /* go look for a virtual root (stolen from ssetroot) */ + __SWM_VROOT = XInternAtom(display, "__SWM_VROOT", False); + XQueryTree(display, rootWin, &rootReturn, &parentReturn, + &children, &numChildren); + for (i = 0; i < numChildren; i++) { + Atom actual_type; + int actual_format; + long nitems, bytesafter; + Window *newRoot = NULL; + + if (XGetWindowProperty (display, children[i], __SWM_VROOT,0,1, + False, XA_WINDOW, &actual_type, + &actual_format, &nitems, &bytesafter, + (unsigned char **) &newRoot) == Success + && newRoot) + { + rootWin = *newRoot; + break; + } + } display_width = DisplayWidth(display, screen); display_height = DisplayHeight(display, screen); --8<---8<---8<---8<---8<---8<--- cut here --8<---8<---8<---8<---8<---8<--- -- Colin Owen Rafferty | I believe in compulsory cannibalism. colin@nbc1.ge.com | If people were forced to eat (I don't speak for NBC. | what they killed, there would Watch Tom Brokaw for that.) | be no more wars. -- Abbie Hoffman