jv@mh.nl (Johan Vromans) (09/13/90)
Sometimes I run the DECwindows window manager, sometimes MWM, sometimes TVTWM, sometimes GWM. Each of these window managers need a different desktop setup due to title bars, border sizes or other properties. Does there exist a program that can be fed a window name and a geometry, so that the designated window is rearranged to match the geometry? Thanks for any info. I'll summarize if I get some. Johan -- Johan Vromans jv@mh.nl via internet backbones Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62911/62500 ------------------------ "Arms are made for hugging" -------------------------
jv@mh.nl (Johan Vromans) (09/14/90)
In article <1990Sep13.131325.8985@squirrel.mh.nl> jv@mh.nl (Johan Vromans) writes: > Does there exist a program that can be fed a window name and a > geometry, so that the designated window is rearranged to match the > geometry? Well, based on a program that was sent to me by Gary Oberrunner, I hacked the following. Call as: placewin -geometry 60x60+0+950 xclock /* placewin.c -- place windows * Author : Johan Vromans (based on a program by garyo@think.com) * Created On : Fri Sep 14 09:38:09 1990 * Last Modified By: Johan Vromans * Last Modified On: Fri Sep 14 12:39:57 1990 * Update Count : 3 * Status : Really? */ #include <stdio.h> #include <X11/Xlib.h> #include <X11/Xutil.h> char *position = NULL; char *wname = NULL; int ok = 0; void FixWindow(d, w, level) Display *d; Window w; int level; { int i; Window root; int x, y; int old_x, old_y; unsigned int width, height, bw, depth; unsigned int old_width, old_height, old_bw, old_depth; char *name; XFetchName(d, w, &name); if ( strncmp (name, wname, strlen(wname)) ) { XFree(name); return; } ok = 1; XGetGeometry(d, w, &root, &old_x, &old_y, &old_width, &old_height, &old_bw, &old_depth); bw = old_bw; XGeometry(d, w, position, "200x200+200+200", bw, 1, 1, 0, 0, &x, &y, &width, &height); fprintf(stderr, "Moving window \"%s\" [0x%x] %dx%d+%d+%d => %dx%d+%d+%d\n", name, w, old_width, old_height, old_x, old_y, width, height, x, y); XMoveResizeWindow(d, w, x, y, width, height); XFree(name); } void FixTree(d, w, level) Display *d; Window w; int level; { Window root, parent, *children; int i, nchildren; /* Get the subtree */ XQueryTree(d, w, &root, &parent, &children, &nchildren); /* Fix this window */ FixWindow(d, w, level); /* Return if it's a leaf */ if (nchildren == 0) return; /* Else recurse on the children */ for (i = 0; i < nchildren; i++) FixTree(d, children[i], level+1); XFree(children); } main(argc, argv) char **argv; int argc; { Display *d; Window w; char *display; int x, y, width, height; char *prog = *argv; argv++; argc--; if (argc > 0 && !strcmp (*argv, "-display")) { display = argv[1]; argc -= 2; argv += 2; } else display = ""; if (argc != 3 || strcmp (*argv, "-geometry")) { fprintf (stderr, "Usage: %s [-display dname] -geometry geometry window_name\n", prog); exit (1); } position = argv[1]; wname = argv[2]; d = XOpenDisplay(display); if (d == NULL) { fprintf(stderr, "Can't open display %s\n", display); exit(1); } FixTree(d, RootWindow(d, DefaultScreen(d)), 0); return (ok > 0); } -- Johan Vromans jv@mh.nl via internet backbones Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62911/62500 ------------------------ "Arms are made for hugging" -------------------------