mikew@wyse.wyse.com (Mike Wexler) (02/09/89)
Submitted-by: Mark Moraes <moraes@csri.toronto.edu> Posting-number: Volume 3, Issue 10 Archive-name: xplaces.r3/patch1 I fixed xplaces to run properly under R3, with reparenting window managers, and improved the rcmd script to pass the DISPLAY variable properly. (Mike, please could you post this to comp.sources.x - it's for the xplaces command that came with R3/contrib/clients, not the one posted recently. Thanks) *** /dev/null Thu Feb 2 21:21:16 1989 --- patchlevel.h Thu Feb 2 21:13:04 1989 *************** *** 0 **** --- 1 ---- + #define PATCHLEVEL 1 *** /tmp/,RCSt1a20190 Thu Feb 2 21:26:19 1989 --- README Thu Feb 2 21:16:52 1989 *************** *** 1,9 ! Ken Yap's original xplaces produced only teh application name, and its ! geometry. It now gets the WM_COMMAND property and reconstructs the ! command line with the window's present geometry (rather than the ! geometry it started with), and also uses the CLIENT_MACHINE property ! to determine whether the application is running remotely or not. Will ! only work with reparenting window managers that copy properties to the ! parent window or non-reparenting window managers. Mark Moraes --- 1,8 ----- ! Ken Yap's original xplaces produced only the application name, and its ! geometry. It now gets the WM_COMMAND property and reconstructs the command ! line with the window's present geometry (rather than the geometry it started ! with), and also uses the CLIENT_MACHINE property to determine whether the ! application is running remotely or not. It should work with reparenting ! window managers as well - tested with twm. Mark Moraes *** /tmp/,RCSt1a20190 Thu Feb 2 21:26:20 1989 --- Imakefile Thu Feb 2 21:25:51 1989 *************** *** 1,4 LOCAL_LIBRARIES = $(XLIB) SimpleProgramTarget(xplaces) --- 1,5 ----- LOCAL_LIBRARIES = $(XLIB) + DEFINES = -DRCMD SimpleProgramTarget(xplaces) *** /tmp/,RCSt1a20190 Thu Feb 2 21:26:23 1989 --- rcmd Thu Feb 2 20:35:28 1989 *************** *** 4,9 # By running this through the Bourne shell at the other end, and # we get rid of the rsh and rshd which otherwise hand around at either # end. Hacked from a posting by clyde@emx.utexas.edu to list.xpert if test $# -lt 2 ; then echo Usage: $0 remotehost remotecommand exit 1 --- 4,10 ----- # By running this through the Bourne shell at the other end, and # we get rid of the rsh and rshd which otherwise hand around at either # end. Hacked from a posting by clyde@emx.utexas.edu to list.xpert + user= if test $# -lt 2 ; then echo Usage: $0 remotehost remotecommand exit 1 *************** *** 10,15 else host=$1 shift fi echo "TERM=$TERM;export TERM;DISPLAY=$DISPLAY;export DISPLAY;($*)" '\ > /dev/null 2>&1 &' | rsh $host /bin/sh & --- 11,21 ----- else host=$1 shift + if test $1 = "-l" ; then + shift + user=$1 + shift + fi fi xhost=`expr "$DISPLAY" : "\([^:]*\).*"` xscreen=`expr "$DISPLAY" : "[^:]*\(.*\)"` *************** *** 11,15 host=$1 shift fi ! echo "TERM=$TERM;export TERM;DISPLAY=$DISPLAY;export DISPLAY;($*)" '\ ! > /dev/null 2>&1 &' | rsh $host /bin/sh & --- 17,34 ----- shift fi fi ! xhost=`expr "$DISPLAY" : "\([^:]*\).*"` ! xscreen=`expr "$DISPLAY" : "[^:]*\(.*\)"` ! if test x$xscreen = x; then ! xscreen=":0.0" ! fi ! if test x$xhost = x -o x$xhost = x"unix"; then ! DISPLAY=`hostname`$xscreen ! fi ! if test x$user = x; then ! echo "TERM=$TERM;export TERM;DISPLAY=$DISPLAY;export DISPLAY;($*)" '\ ! > /dev/null 2>&1 &' | rsh $host /bin/sh & ! else ! echo "TERM=$TERM;export TERM;DISPLAY=$DISPLAY;export DISPLAY;($*)" '\ ! > /dev/null 2>&1 &' | rsh $host -l $user /bin/sh & ! fi *** /tmp/,RCSt1a20190 Thu Feb 2 21:26:25 1989 --- xplaces.c Thu Feb 2 21:12:03 1989 *************** *** 30,35 exit(1); } main(argc, argv) int argc; char *argv[]; --- 30,36 ----- exit(1); } + static Display *d; main(argc, argv) int argc; char *argv[]; *************** *** 34,40 int argc; char *argv[]; { ! register Display *d; register int width, height; int nchildren; char *win_name; --- 35,48 ----- int argc; char *argv[]; { ! if ((d = XOpenDisplay(NULL)) == NULL) ! fatal("Can't open display"); ! searchtree(DefaultRootWindow(d)); ! } ! ! searchtree(w) ! Window w; ! { register int width, height; int nchildren; char *win_name; *************** *** 53,60 char tmpstr[256]; int nextarg, donegeometry; - if ((d = XOpenDisplay(NULL)) == NULL) - fatal("Can't open display"); /* get a list of children of the root window */ if (XQueryTree(d, DefaultRootWindow(d), &root_win, &parent_win, --- 61,66 ----- char tmpstr[256]; int nextarg, donegeometry; /* get a list of children of the window */ if (XQueryTree(d, w, &root_win, &parent_win, &child_list, &nchildren) *************** *** 56,65 if ((d = XOpenDisplay(NULL)) == NULL) fatal("Can't open display"); ! /* get a list of children of the root window */ ! if (XQueryTree(d, DefaultRootWindow(d), &root_win, &parent_win, ! &child_list, &nchildren) == 0) ! fatal("Can't query window tree"); /* scan list */ for ( ; nchildren-- > 0; child_list++) { --- 62,71 ----- int nextarg, donegeometry; ! /* get a list of children of the window */ ! if (XQueryTree(d, w, &root_win, &parent_win, &child_list, &nchildren) ! == 0) ! return; /* scan list */ for ( ; nchildren-- > 0; child_list++) { *************** *** 63,68 /* scan list */ for ( ; nchildren-- > 0; child_list++) { /* what is the name? */ if (!XFetchName(d, *child_list, &win_name)) continue; /* not fatal */ --- 69,77 ----- /* scan list */ for ( ; nchildren-- > 0; child_list++) { + /* Recurse first */ + searchtree(*child_list); + /* what is the name? */ if (!XFetchName(d, *child_list, &win_name)) continue; /* not fatal */ -- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330 Moderator of comp.sources.x