xloadimage for tvtwm
George Ferguson
ferguson at cs.rochester.edu
Wed Sep 12 07:28:35 AEST 1990
I hacked xloadimage to search for a virtual root window so that it
would work with tvtwm. I basically cut the code from ssetroot.c by
Tom LaStrange in the tvtwm distribution into root.c of the xloadimage
distribution. I figured others might be interested so here it is. It
has only been very briefly tested, but seems to work for the common case.
Unshar the file "changes" and apply it with "patch <changes". Enjoy.
George
George Ferguson ARPA: ferguson at cs.rochester.edu
University of Rochester UUCP: {decvax,rutgers}!rochester!ferguson
Rochester NY 14627 VOX: (716) 275-2527
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: changes
# Wrapped by ferguson at magenta.cs.rochester.edu on Tue Sep 11 17:24:36 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'changes' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'changes'\"
else
echo shar: Extracting \"'changes'\" \(2507 characters\)
sed "s/^X//" >'changes' <<'END_OF_FILE'
X*** root.c.old Tue Sep 11 17:09:30 1990
X--- root.c Tue Sep 11 17:16:35 1990
X***************
X*** 93,98 ****
X--- 93,109 ----
X }
X }
X
X+ /*
X+ * Modified to search for a virtual root window based on code from
X+ * Tom LaStrange (toml at solbourne.com) in the tvtwm distribution.
X+ * I doubt that I got all the other possible places changes are needed,
X+ * especially w.r.t. colormaps.
X+ *
X+ * George Ferguson, ferguson at cs.rochester.edu, 11 Sep 1990.
X+ */
X+
X+ static Window getRootWindow();
X+
X void imageOnRoot(disp, scrn, image, verbose)
X Display *disp;
X int scrn;
X***************
X*** 100,109 ****
X unsigned int verbose;
X { Pixmap pixmap;
X Colormap xcmap;
X
X
X! freePrevious(disp, RootWindow(disp, scrn));
X
X if (! sendImageToX(disp, scrn, DefaultVisual(disp, scrn), image,
X &pixmap, &xcmap, verbose))
X exit(1);
X--- 111,123 ----
X unsigned int verbose;
X { Pixmap pixmap;
X Colormap xcmap;
X+ Window root;
X
X
X! root = getRootWindow(disp,scrn);
X
X+ freePrevious(disp, root);
X+
X if (! sendImageToX(disp, scrn, DefaultVisual(disp, scrn), image,
X &pixmap, &xcmap, verbose))
X exit(1);
X***************
X*** 117,124 ****
X exit(1);
X }
X
X! XSetWindowBackgroundPixmap(disp, RootWindow(disp, scrn), pixmap);
X! XClearWindow(disp, RootWindow(disp, scrn));
X XFreePixmap(disp, pixmap);
X! preserveResource(disp, RootWindow(disp, scrn));
X }
X--- 131,167 ----
X exit(1);
X }
X
X! XSetWindowBackgroundPixmap(disp, root, pixmap);
X! XClearWindow(disp, root);
X XFreePixmap(disp, pixmap);
X! preserveResource(disp, root);
X! }
X!
X! /*
X! * This is more or less directly from ssetroot.c in the tvtwm distribution.
X! */
X! static Window
X! getRootWindow(disp,scrn)
X! Display *disp;
X! int scrn;
X! {
X! Atom __SWM_VROOT,actual_type;
X! Window root,rootReturn,parentReturn,*children,*newRoot;
X! int numChildren,i,actual_format;
X! long nitems, bytesafter;
X!
X!
X! root = RootWindow(disp,scrn);
X! __SWM_VROOT = XInternAtom(disp,"__SWM_VROOT",False);
X! XQueryTree(disp,root,&rootReturn,&parentReturn,&children,&numChildren);
X! for (i = 0; i < numChildren; i++) {
X! newRoot = NULL;
X! if (XGetWindowProperty (disp, children[i], __SWM_VROOT,0,1,
X! False,XA_WINDOW,&actual_type,&actual_format,&nitems,&bytesafter,
X! (unsigned char **)&newRoot) == Success && newRoot) {
X! root = *newRoot;
X! break;
X! }
X! }
X! return(root);
X }
END_OF_FILE
if test 2507 -ne `wc -c <'changes'`; then
echo shar: \"'changes'\" unpacked with wrong size!
fi
# end of 'changes'
fi
echo shar: End of shell archive.
exit 0
--
George Ferguson ARPA: ferguson at cs.rochester.edu
University of Rochester UUCP: {decvax,rutgers}!rochester!ferguson
Rochester NY 14627 VOX: (716) 275-2527
More information about the Alt.sources
mailing list