home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume21 / xwit / part01 < prev    next >
Encoding:
Text File  |  1994-01-10  |  23.0 KB  |  856 lines

  1. Newsgroups: comp.sources.x
  2. From: mmm@cetia.fr (Mark Martin)
  3. Subject: v21i088:  xwit - a miscellany of trivial X11 functions, Part01/01
  4. Message-ID: <1994Jan10.201814.6562@sparky.sterling.com>
  5. X-Md4-Signature: 171b81557ab24fccbb5a8b04ed237826
  6. Sender: chris@sparky.sterling.com (Chris Olson)
  7. Reply-To: mmm@cetia.fr
  8. Organization: CETIA, France
  9. Date: Mon, 10 Jan 1994 20:18:14 GMT
  10. Approved: chris@sterling.com
  11.  
  12. Submitted-by: mmm@cetia.fr (Mark Martin)
  13. Posting-number: Volume 21, Issue 88
  14. Archive-name: xwit/part01
  15. Environment: X11
  16.  
  17. xwit ("x window interface tool") is a hotch-potch collection of simple
  18. routines to call some of those X11 functions that don't already have any
  19. utility commands built around them.  The reasoning behind this is that
  20. loosely every X function should be accessible from a shell script.
  21.  
  22. For example, XWarpPointer() will move the X pointer, but no utility program
  23. exists to do so on those rare occasions when you could really use it.  xwit
  24. will also resize, iconify, pop, and move windows given by name or id,
  25. change an icon, title or name, set the screen saver going, and change
  26. individual key autorepeat settings.
  27.  
  28. The program is released into the public domain.  Only the considerate
  29. will leave credit for the authors.
  30.  
  31.     Mark M Martin. mmm@cetia.fr  dec 1993.
  32.     David DiGiacomo dd@mv.us.adobe.com
  33.  
  34.  
  35. #! /bin/sh
  36. # This is a shell archive, meaning:
  37. # 1. Remove everything above the #! /bin/sh line.
  38. # 2. Save the resulting text in a file.
  39. # 3. Execute the file with /bin/sh (not csh) to create the files:
  40. #    xwit/README
  41. #    xwit/xwit.c
  42. #    xwit/xwit.man
  43. #    xwit/Makefile
  44. #    xwit/Imakefile
  45. #    xwit/patchlevel.h
  46. # This archive created: Tue Dec  7 19:22:43 FST 1993
  47. # By: mmm
  48. # Part 1 of 1
  49. PATH=/bin:$PATH export PATH
  50. mkdir xwit
  51. if test -f 'xwit/README'
  52. then    echo "shar: will not overwrite existing file xwit/README"
  53. else    echo "shar: extracting xwit/README (794 chars)"
  54.     sed 's/^X//' <<\END-OF-FILE! >'xwit/README'
  55. Xxwit ("x window interface tool") is a hotch-potch collection of simple
  56. Xroutines to call some of those X11 functions that don't already have any
  57. Xutility commands built around them.  The reasoning behind this is that
  58. Xloosely every X function should be accessible from a shell script.
  59. X
  60. XFor example, XWarpPointer() will move the X pointer, but no utility program
  61. Xexists to do so on those rare occasions when you could really use it.  xwit
  62. Xwill also resize, iconify, pop, and move windows given by name or id,
  63. Xchange an icon, title or name, set the screen saver going, and change
  64. Xindividual key autorepeat settings.
  65. X
  66. XThe program is released into the public domain.  Only the considerate
  67. Xwill leave credit for the authors.
  68. X
  69. X    Mark M Martin. mmm@cetia.fr  dec 1993.
  70. X    David DiGiacomo dd@mv.us.adobe.com
  71. END-OF-FILE!
  72.     if test 794 -ne "`wc -c <'xwit/README'`"
  73.     then    echo "shar: error transmitting xwit/README (794 characters)"
  74.     fi
  75. fi
  76. if test -f 'xwit/xwit.c'
  77. then    echo "shar: will not overwrite existing file xwit/xwit.c"
  78. else    echo "shar: extracting xwit/xwit.c (11967 chars)"
  79.     sed 's/^X//' <<\END-OF-FILE! >'xwit/xwit.c'
  80. X/*
  81. X * Pop up or iconify the current xterm window (using its WINDOW_ID in the env)
  82. X * or a given window id or a list of window matching names. etc...
  83. X * A miscellany of trivial functions.
  84. X *
  85. X * Mark M Martin. cetia 93/12/07 r1.9 mmm@cetia.fr
  86. X * David DiGiacomo dd@mv.us.adobe.com
  87. X */
  88. X#include <X11/Xos.h>
  89. X#include <X11/Xlib.h>
  90. X#include <X11/Xutil.h>
  91. X#include <X11/Xproto.h>
  92. X#include <stdio.h>
  93. X#include <sys/time.h>
  94. X
  95. Xchar *progname;
  96. Xpexit(str)char *str;{
  97. X    fprintf(stderr,"%s: %s\n",progname,str);
  98. X    exit(1);
  99. X}
  100. X
  101. Xusage(){
  102. X    fprintf(stderr,
  103. X    "usage: %s -display <display>\n\
  104. X    -pop -iconify -unmap\n\
  105. X    -resize w h -rows r -columns c -[r]move x y\n\
  106. X    -[r]warp x y -cmap <colormap> -[no]save\n\
  107. X    -name <name> -iconname <name>\n\
  108. X    -bitmap <file> -mask <file>\n\
  109. X    -[no]keyrepeat keycode ... keycode - keycode\n\
  110. X    -id <windowid> -names <initialsubstrings>... [must be last]\n",
  111. X    progname);
  112. X    exit(1);
  113. X}
  114. X
  115. Xenum functions{
  116. X    pop, icon, unmap, colormap,
  117. X    move, rmove, warp, rwarp,
  118. X    resize, save, nosave,
  119. X    keyrepeat, nokeyrepeat,
  120. X    name, iconname,
  121. X    rows, columns,
  122. X    iconbitmap,
  123. X    lastfunc    /* this must be last */
  124. X}function;
  125. X#define    FBIT(func)    (1 << (func))
  126. X
  127. Xstatic int nowindow =    /* options that dont need a window */
  128. X    FBIT(save)|FBIT(nosave)|FBIT(keyrepeat)|FBIT(nokeyrepeat)|FBIT(rwarp);
  129. X
  130. XDisplay *display;
  131. XWindow root;
  132. Xint screen,tox,toy,towidth,toheight,warpx,warpy;
  133. XColormap cmap;
  134. Xchar **names;    /* -> argv list of names to avoid */
  135. Xint numnames;
  136. Xint keys[256];
  137. Xstatic char *wmname;
  138. Xstatic char *wmiconname;
  139. Xstatic int nrows;
  140. Xstatic int ncolumns;
  141. Xstatic char *bitmapname;
  142. Xstatic char *maskname;
  143. X
  144. X/*
  145. X * sleep for given millisecs for those without usleep, like us!
  146. X */
  147. Xmssleep(ms)
  148. Xint ms;
  149. X{
  150. X    struct timeval tv;
  151. X    tv.tv_sec = ms/1000;
  152. X    tv.tv_usec = (ms%1000)*1000;
  153. X    select(0,(int*)0,(int*)0,(int*)0,&tv);
  154. X}
  155. X/*
  156. X * find all windows below this and if name matches call doit on it
  157. X */
  158. Xdowntree(top)
  159. XWindow top;
  160. X{
  161. X    Window *child, dummy;
  162. X    unsigned int children, i;
  163. X    char **cpp, *name;
  164. X    if (XQueryTree(display, top, &dummy, &dummy, &child, &children)==0)
  165. X    pexit("XQueryTree failed");
  166. X    for (i=0; i<children; i++)
  167. X    if(XFetchName (display, child[i], &name)){
  168. X    for(cpp = names;*cpp!=0;cpp++)
  169. X        if(strncmp(*cpp,name,strlen(*cpp))==0){
  170. X        doit(child[i]);
  171. X        break;
  172. X        }
  173. X    XFree(name);
  174. X    }else downtree(child[i]);    /* dont go down if found a name */
  175. X    if(child)XFree((char *)child);
  176. X}
  177. X/*
  178. X * [un]set autorepeat for individual keys
  179. X */
  180. Xsetrepeat(){
  181. X    unsigned long value_mask;
  182. X    XKeyboardControl values;
  183. X    int i;
  184. X
  185. X    value_mask = KBKey|KBAutoRepeatMode;
  186. X    values.auto_repeat_mode = (function&(1<<keyrepeat))?AutoRepeatModeOn:AutoRepeatModeOff;
  187. X    
  188. X    for(i=0;i<256;i++)
  189. X    if(keys[i]){
  190. X    values.key = i;
  191. X    XChangeKeyboardControl(display, value_mask, &values);
  192. X    }
  193. X}
  194. X
  195. X/*
  196. X * get window size
  197. X */
  198. Xstatic
  199. Xgetsize(window, wp, hp)
  200. X    Window window;
  201. X    int *wp, *hp;
  202. X{
  203. X    XWindowAttributes attributes;
  204. X
  205. X    if (XGetWindowAttributes(display, window, &attributes) == 0)
  206. X    pexit("XGetWindowAttributes");
  207. X
  208. X    *wp = attributes.width;
  209. X    *hp = attributes.height;
  210. X}
  211. X
  212. X/*
  213. X * set window size
  214. X */
  215. Xstatic
  216. Xdoresize(window, w, h)
  217. X    Window window;
  218. X    int w, h;
  219. X{
  220. X    XWindowChanges values;
  221. X    unsigned int value_mask;
  222. X    int try;
  223. X    int nw, nh;
  224. X
  225. X    values.width = w;
  226. X    values.height = h;
  227. X    value_mask = CWWidth | CWHeight;
  228. X
  229. X    for (try = 0; try < 2; try++) {
  230. X    if (XReconfigureWMWindow(display, window, screen, value_mask, &values) == 0)
  231. X        pexit("resize: XReconfigureWMWindow");
  232. X
  233. X    getsize(window, &nw, &nh);
  234. X    if (values.width == nw && values.height == nh)
  235. X        return;
  236. X
  237. X    /* give window manager a chance to react */
  238. X    mssleep(500);
  239. X
  240. X    getsize(window, &nw, &nh);
  241. X    if (values.width == nw && values.height == nh)
  242. X        return;
  243. X    }
  244. X
  245. X    /* last chance */
  246. X    values.width += values.width - nw;
  247. X    values.height += values.height - nh;
  248. X    if (XReconfigureWMWindow(display, window, screen, value_mask, &values) == 0)
  249. X    pexit("resize: XReconfigureWMWindow 2");
  250. X}
  251. X
  252. X/*
  253. X * set row/column size
  254. X */
  255. Xstatic
  256. Xrcresize(what, window)
  257. X    enum functions what;
  258. X    Window window;
  259. X{
  260. X    XSizeHints *hints;
  261. X    long supplied;
  262. X    int w, h;
  263. X
  264. X    if (!(what & FBIT(rows)) || !(what & FBIT(columns)))
  265. X    getsize(window, &w, &h);
  266. X
  267. X    if (!(hints = XAllocSizeHints()))
  268. X    pexit("XAllocSizeHints");
  269. X
  270. X    if (XGetWMNormalHints(display, window, hints, &supplied) == 0)
  271. X    pexit("XGetWMNormalHints");
  272. X
  273. X    if (!(supplied & PBaseSize) || !(supplied & PResizeInc))
  274. X    pexit("missing PBaseSize and/or PResizeInc hint");
  275. X
  276. X    if (what & FBIT(columns))
  277. X    w = hints->base_width + hints->width_inc * ncolumns;
  278. X
  279. X    if (what & FBIT(rows))
  280. X    h = hints->base_height + hints->height_inc * nrows;
  281. X
  282. X    doresize(window, w, h);
  283. X
  284. X    XFree(hints);
  285. X}
  286. X
  287. Xstatic
  288. Xloadbitmap(window, file, pmp)
  289. X    Window window;
  290. X    char *file;
  291. X    Pixmap *pmp;
  292. X{
  293. X    unsigned int w, h;
  294. X    int xhot, yhot;
  295. X
  296. X    if (XReadBitmapFile(display, window, file,
  297. X        &w, &h, pmp, &xhot, &yhot) != BitmapSuccess)
  298. X        pexit("XReadBitmapFile failed");
  299. X}
  300. X
  301. Xstatic
  302. Xsetbitmap(window)
  303. X    Window window;
  304. X{
  305. X    static XWMHints *hints;
  306. X    static Pixmap bitmap_pm;
  307. X    static Pixmap mask_pm;
  308. X    XWMHints *ohints;
  309. X
  310. X    if (!hints) {
  311. X        if (!(hints = XAllocWMHints()) ||
  312. X            !(ohints = XAllocWMHints()))
  313. X            pexit("XAllocWMHints");
  314. X
  315. X        if (bitmapname) {
  316. X            loadbitmap(window, bitmapname, &bitmap_pm);
  317. X            hints->flags |= IconPixmapHint;
  318. X            hints->icon_pixmap = bitmap_pm;
  319. X        }
  320. X
  321. X        if (maskname) {
  322. X            loadbitmap(window, maskname, &mask_pm);
  323. X            hints->flags |= IconMaskHint;
  324. X            hints->icon_mask = mask_pm;
  325. X        }
  326. X
  327. X        XSetCloseDownMode(display, RetainTemporary);
  328. X    }
  329. X
  330. X    if (ohints = XGetWMHints(display, window)) {
  331. X        if (ohints->icon_pixmap && hints->icon_pixmap)
  332. X            XFreePixmap(display, ohints->icon_pixmap); 
  333. X        if (ohints->icon_mask && hints->icon_mask)
  334. X            XFreePixmap(display, ohints->icon_mask);
  335. X        XFree(ohints);
  336. X    }
  337. X
  338. X    XSetWMHints(display, window, hints);
  339. X}
  340. X
  341. X/*
  342. X * iconify the given window, or map and raise it, or whatever
  343. X */
  344. Xdoit(window)
  345. XWindow window;
  346. X{
  347. X    XWindowChanges values;
  348. X    unsigned int value_mask;
  349. X    Window child;
  350. X    enum functions f;
  351. X    int i = 0;
  352. X
  353. X    f = function;
  354. X    for (i = 0; i < lastfunc; i++)
  355. X    if (f & FBIT(i))
  356. X    switch(i){
  357. X    case warp:
  358. X        XWarpPointer(display,None,window,0,0,0,0,warpx,warpy);
  359. X        break;
  360. X    case rwarp:
  361. X        XWarpPointer(display,None,None,0,0,0,0,warpx,warpy);
  362. X        break;
  363. X    case move:
  364. X        values.x = tox;
  365. X        values.y = toy;
  366. X        value_mask = CWX|CWY;
  367. X        if(XReconfigureWMWindow(display, window, screen, value_mask, &values)==0)
  368. X        pexit("move failed");
  369. X        break;
  370. X    case rmove:
  371. X        if(XTranslateCoordinates(display,window,root,0,0,             
  372. X                  &values.x,&values.y,&child)==0)
  373. X        pexit("not same screen");
  374. X        values.x += tox;
  375. X        values.y += toy;
  376. X        value_mask = CWX|CWY;
  377. X        if(XReconfigureWMWindow(display, window, screen, value_mask, &values)==0)
  378. X        pexit("rmove failed");
  379. X        break;
  380. X    case resize:
  381. X        doresize(window, towidth, toheight);
  382. X        break;
  383. X    case colormap:
  384. X        XSetWindowColormap(display,window,cmap);
  385. X        break;
  386. X    case pop:
  387. X        XMapRaised(display,window);
  388. X        break;
  389. X    case unmap:
  390. X        XUnmapWindow(display,window);
  391. X        break;
  392. X    case icon:
  393. X        if(XIconifyWindow(display, window, screen)==0)
  394. X        pexit("iconify failed");
  395. X        break;
  396. X    case save:
  397. X        XForceScreenSaver(display,ScreenSaverActive);
  398. X        break;
  399. X    case nosave:
  400. X        XForceScreenSaver(display,ScreenSaverReset);
  401. X        break;
  402. X    case keyrepeat:
  403. X    case nokeyrepeat:
  404. X        setrepeat();
  405. X        break;
  406. X    case name:
  407. X        XStoreName(display, window, wmname);
  408. X        break;
  409. X    case iconname:
  410. X        XSetIconName(display, window, wmiconname);
  411. X        break;
  412. X    case rows:
  413. X        if (f & FBIT(columns))
  414. X        break;
  415. X        /* fall through */
  416. X    case columns:
  417. X        rcresize(f, window);
  418. X        break;
  419. X    case iconbitmap:
  420. X        setbitmap(window);
  421. X        break;
  422. X    }
  423. X}
  424. X
  425. Xmain(argc,argv)
  426. X    int argc;
  427. X    char **argv;
  428. X{
  429. X    Window window = 0;
  430. X    char *displayname = 0;
  431. X    extern char *getenv();
  432. X    
  433. X    progname = argv[0] + strlen(argv[0]);
  434. X    while (progname != argv[0] && progname[-1] != '/')
  435. X    progname--;
  436. X
  437. X    argc--;
  438. X    while(argv++,argc-->0){
  439. X    int argvlen = strlen(*argv);
  440. X    if(argvlen<2)argvlen = 2;
  441. X    if(strcmp(*argv,"-id")==0){
  442. X        argc--,argv++;
  443. X        if(argc<0)usage();
  444. X        if(sscanf(*argv,"0x%x",&window)!=1)
  445. X        window = atoi(*argv);
  446. X    }else if(strcmp(*argv,"-root")==0){
  447. X        window = (Window) -1;
  448. X    }else if(strncmp(*argv,"-names",6)==0){
  449. X        /* take rest of arg list */
  450. X        names = ++argv;
  451. X        if(*names==0)names = 0;    /* no args follow */
  452. X        numnames = argc;
  453. X        argc = 0;
  454. X    }else if(strncmp(*argv,"-display",argvlen)==0){
  455. X        argc--,argv++;
  456. X        if(argc<0)usage();
  457. X        displayname = *argv;
  458. X    }else if(strncmp(*argv,"-colormap",argvlen)==0){
  459. X        function |= 1<<colormap;
  460. X        argc--,argv++;
  461. X        if(argc<0)usage();
  462. X        if(sscanf(*argv,"0x%x",&cmap)!=1)
  463. X        cmap = atoi(*argv);
  464. X    }else if(strcmp(*argv,"-move")==0 ||
  465. X         strcmp(*argv,"-rmove")==0){
  466. X        function |= 1<<(((*argv)[1]=='m')?move:rmove);
  467. X        argc--,argv++;
  468. X        if(argc<0)usage();
  469. X        tox = atoi(*argv);
  470. X        argc--,argv++;
  471. X        if(argc<0)usage();
  472. X        toy = atoi(*argv);
  473. X    }else if(strncmp(*argv,"-resize",argvlen)==0){
  474. X        function |= 1<<resize;
  475. X        argc--,argv++;
  476. X        if(argc<0)usage();
  477. X        towidth = atoi(*argv);
  478. X        argc--,argv++;
  479. X        if(argc<0)usage();
  480. X        toheight = atoi(*argv);
  481. X    }else if(strcmp(*argv,"-warp")==0 ||
  482. X         strcmp(*argv,"-rwarp")==0){
  483. X        function |= 1<<(strcmp(*argv,"-warp")==0?warp:rwarp);
  484. X        argc--,argv++;
  485. X        if(argc<0)usage();
  486. X        warpx = atoi(*argv);
  487. X        argc--,argv++;
  488. X        if(argc<0)usage();
  489. X        warpy = atoi(*argv);
  490. X    }else if(strcmp(*argv,"-pop")==0){
  491. X        function |= 1<<pop;
  492. X    }else if(strcmp(*argv,"-save")==0){
  493. X        function |= 1<<save;
  494. X    }else if(strcmp(*argv,"-nosave")==0){
  495. X        function |= 1<<nosave;
  496. X    }else if(strncmp(*argv,"-iconify",argvlen)==0){
  497. X        function |= 1<<icon;
  498. X    }else if(strcmp(*argv,"-unmap")==0){
  499. X        function |= 1<<unmap;
  500. X    }else if(strncmp(*argv,"-keyrepeat",argvlen)==0 ||
  501. X         strncmp(*argv,"-nokeyrepeat",argvlen)==0){
  502. X        int i;
  503. X        function |= 1<<((*argv)[1]=='k'?keyrepeat:nokeyrepeat);
  504. X        if(argc<=0 || (i = atoi(argv[1]))<=0)usage();
  505. X        while(1){
  506. X        argc--,argv++;
  507. X        keys[i&0xff] = 1;
  508. X        if(argc<=0)break;
  509. X        if(strcmp(argv[1],"-")==0){
  510. X            int from = i;
  511. X            argc--,argv++;
  512. X            if(argc<0 || (i = atoi(argv[1]))<=0)usage();
  513. X            while(from<=i)keys[from++&0xff] = 1;
  514. X            argc--,argv++;
  515. X            if(argc<=0)break;
  516. X        }
  517. X        if((i = atoi(argv[1]))<=0)break;
  518. X        }
  519. X    }
  520. X    else if (strcmp(*argv, "-name") == 0) {
  521. X        function |= FBIT(name);
  522. X        argc--,argv++;
  523. X        if(argc<0)usage();
  524. X        wmname = *argv;
  525. X    }
  526. X    else if (strcmp(*argv, "-iconname") == 0) {
  527. X        function |= FBIT(iconname);
  528. X        argc--,argv++;
  529. X        if(argc<0)usage();
  530. X        wmiconname = *argv;
  531. X    }
  532. X    else if (strncmp(*argv, "-rows", argvlen) == 0) {
  533. X        function |= FBIT(rows);
  534. X        argc--,argv++;
  535. X        if(argc<0)usage();
  536. X        nrows = atoi(*argv);
  537. X    }
  538. X    else if (strncmp(*argv, "-columns", argvlen) == 0) {
  539. X        function |= FBIT(columns);
  540. X        argc--,argv++;
  541. X        if(argc<0)usage();
  542. X        ncolumns = atoi(*argv);
  543. X    }
  544. X    else if (strcmp(*argv, "-bitmap") == 0) {
  545. X        function |= FBIT(iconbitmap);
  546. X        argc--,argv++;
  547. X        if(argc<0)usage();
  548. X        bitmapname = *argv;
  549. X    }
  550. X    else if (strcmp(*argv, "-mask") == 0) {
  551. X        function |= FBIT(iconbitmap);
  552. X        argc--,argv++;
  553. X        if(argc<0)usage();
  554. X        maskname = *argv;
  555. X    }
  556. X    else usage();
  557. X    }
  558. X
  559. X    if(function==0)function = FBIT(pop);    /* default action */
  560. X
  561. X    if(window==0){
  562. X    if(names==0){
  563. X        char *s;
  564. X        s = getenv("WINDOWID");
  565. X        if(s!=0 && *s!='\0')window = atoi(s);
  566. X        else if(function & ~nowindow)pexit("No window id");
  567. X        else window = (Window)-1;
  568. X    }
  569. X    }else if(names!=0)usage();
  570. X
  571. X    display = XOpenDisplay(displayname);
  572. X    if(display==0)pexit("could not open display");
  573. X    root = DefaultRootWindow(display);
  574. X    if(window== (Window)-1)window = root;
  575. X    screen = DefaultScreen(display);
  576. X
  577. X    if(names!=0)downtree(root);
  578. X    else doit(window);
  579. X    XSync(display,True);
  580. X    (void) XCloseDisplay(display);
  581. X    exit(0);
  582. X}
  583. END-OF-FILE!
  584.     if test 11967 -ne "`wc -c <'xwit/xwit.c'`"
  585.     then    echo "shar: error transmitting xwit/xwit.c (11967 characters)"
  586.     fi
  587. fi
  588. if test -f 'xwit/xwit.man'
  589. then    echo "shar: will not overwrite existing file xwit/xwit.man"
  590. else    echo "shar: extracting xwit/xwit.man (3890 chars)"
  591.     sed 's/^X//' <<\END-OF-FILE! >'xwit/xwit.man'
  592. X.\" xwit man
  593. X.TH XWIT 1X
  594. X.SH NAME
  595. Xxwit \- window interface. pop or iconify this xterm window or named windows
  596. X.SH SYNOPSIS
  597. X.B
  598. Xxwit
  599. X'in \n(.iu+\w'\fBxwit \fR'u
  600. X.RB [ -display
  601. X.IR display ]
  602. X.RB [ -pop ]
  603. X.RB [ -iconify ]
  604. X.RB [ -unmap ]
  605. X.br
  606. X.RB [ -resize
  607. X.IR w\ h ]
  608. X.RB [ -rows
  609. X.IR r ]
  610. X.RB [ -columns
  611. X.IR c ]
  612. X.RB [ - [ r ] move
  613. X.IR x\ y ]
  614. X.br
  615. X.RB [ - [ r ] warp 
  616. X.IR x\ y ]
  617. X.RB [ -cmap
  618. X.IR colormap ]
  619. X.RB [ - [ no ] save
  620. X.br
  621. X.RB [ -name
  622. X.IR name ]
  623. X.RB [ -iconname
  624. X.IR name ]
  625. X.br
  626. X.RB [ -bitmap
  627. X.IR file ]
  628. X.RB [ -mask
  629. X.IR file ]
  630. X.br
  631. X.RB [ - [ no ] keyrepeat
  632. X.IR "keycode ... keycode - keycode ..." ]
  633. X.br
  634. X.RB [ -root ]
  635. X.RB [ -id
  636. X.IR windowid ]
  637. X.RB [ -names
  638. X.IR initialsubstring... ]
  639. X.in
  640. X.SH DESCRIPTION
  641. X.B xwit
  642. Xis an X window interface tool.
  643. XBy default when used with no arguments in an xterm it
  644. Xde-iconifies and raises the window.
  645. XYou can specify a different function to do, such as iconifying the window,
  646. Xand apply it to several windows whose name begins with one of the given
  647. Xstrings, or a particular window id given, or the window id found
  648. Xin the environment variable
  649. X.B WINDOWID.
  650. X(This variable is set by xterm for the program, usually the shell, it runs.)
  651. X.SH OPTIONS
  652. X.TP
  653. X-display
  654. Xis followed by the display to open.
  655. X.TP
  656. X-pop
  657. Xis the default action.
  658. XIt need only be given if it is wanted as well as some other function.
  659. X.TP
  660. X-iconify
  661. Xwill iconify the windows instead of popping them.
  662. X.TP
  663. X-unmap
  664. Xwill iconify windows by unmapping with a non ICCCM compliant window manager.
  665. X(Beware, this option is not usually what you want).
  666. X.TP
  667. X-resize w h
  668. Xresize windows to the given pixel size.
  669. X.TP
  670. X-rows r
  671. Xresize windows to the given number of rows.
  672. X.TP
  673. X-columns c
  674. Xresize windows to the given number of columns.
  675. X.TP
  676. X-move x y
  677. Xmove windows to the given absolute position relative to its parent.
  678. X.TP
  679. X-rmove x y
  680. Xmove windows to the given relative amount.
  681. X.TP
  682. X-warp x y
  683. Xmove the cursor to the given position relative to the specified window.
  684. XAdd -root to warp to an absolute position.
  685. X.TP
  686. X-rwarp x y
  687. Xmove the cursor by the given relative amount.
  688. X.TP
  689. X-colormap
  690. Xinstall the given colormap into the given window.
  691. X.TP
  692. X-name name
  693. Xset the WM_NAME property to the given string.
  694. X.TP
  695. X-iconname name
  696. Xset the WM_ICON_NAME property to the given string.
  697. X.TP
  698. X-bitmap file
  699. Xuse the given bitmap file as the icon bitmap for the window.
  700. X.TP
  701. X-mask file
  702. Xuse the given bitmap file as the icon mask for the window.
  703. X.TP
  704. X-id 
  705. Xis followed by a single window number, in decimal or if it begins with
  706. X0x in hexadecimal.
  707. X.TP
  708. X-names
  709. Xif given must be the last option on the line and is followed by a list of strings.
  710. XAll windows that have a name that begins exactly like one of the strings
  711. Xwill be acted upon.
  712. XBy using a null string (-names ''), all names will be matched.
  713. X.TP
  714. X-keyrepeat -nokeyrepeat
  715. Xis followed by a list of keycodes (decimal numbers, see xmodmap(1)).
  716. XA range can be specified as a lower number, ``-'', and upper number
  717. Xas three separate arguments.
  718. XThe individual setting of auto-repeat for those keycodes is set on or off.
  719. XThe global setting of auto-repeat can be set with xset(1).
  720. XWhen off, no keys will repeat.
  721. Xxset will also show the current settings for individual keys.
  722. X.SH EXAMPLES
  723. XTo iconify all windows (probably not quite what you want to do)
  724. X
  725. X.ta 1i
  726. X    xwit -names ''
  727. X
  728. XTo de-iconify and pop ``this'' xterm and warp the cursor into it
  729. X
  730. X    xwit -pop -warp 50 50
  731. X
  732. XTo gently agitate your oclock on the screen
  733. X
  734. X     while   xwit -rmove 0 10 -name oclock
  735. X     do      xwit -rmove 0 -10 -name oclock
  736. X     done
  737. X    
  738. X.SH LIMITATIONS
  739. XSince each application is supposed to request these functions of the
  740. Xwindow manager, some of them may not like other clients mapping and unmapping
  741. Xfor them behind their back.
  742. XThe iconification is requested of the window manager using the ICCCM.
  743. XNon ICCCM compliant window managers may not react correctly.
  744. X.SH AUTHORS
  745. XMark M Martin. CETIA France. 93/12/07. mmm@cetia.fr
  746. XDavid DiGiacomo dd@mv.us.adobe.com
  747. END-OF-FILE!
  748.     if test 3890 -ne "`wc -c <'xwit/xwit.man'`"
  749.     then    echo "shar: error transmitting xwit/xwit.man (3890 characters)"
  750.     fi
  751. fi
  752. if test -f 'xwit/Makefile'
  753. then    echo "shar: will not overwrite existing file xwit/Makefile"
  754. else    echo "shar: extracting xwit/Makefile (1939 chars)"
  755.     sed 's/^X//' <<\END-OF-FILE! >'xwit/Makefile'
  756. X# Makefile for xwit.  Throw this away and use the Imakefile if you can.
  757. X              TOP = .
  758. X      CURRENT_DIR = .
  759. X               CC = gcc
  760. X             LKED = $(CC)
  761. X          INSTALL = install
  762. X             MAKE = make
  763. X               MV = mv
  764. X               RM = rm -f
  765. X             TAGS = ctags
  766. X           MFLAGS = -$(MAKEFLAGS)
  767. X     INSTPGMFLAGS = -c -s
  768. X     INSTMANFLAGS = -c
  769. X     TOP_INCLUDES = -I$(INCROOT)
  770. X      CDEBUGFLAGS = -O
  771. X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
  772. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS)
  773. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  774. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  775. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
  776. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  777. X         IRULESRC = $(CONFIGDIR)
  778. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  779. X           BINDIR = $(DESTDIR)/usr/bin/X11
  780. X          INCROOT = $(DESTDIR)/usr/include
  781. X          MANPATH = $(DESTDIR)/usr/catman/x11_man
  782. X    MANSOURCEPATH = $(MANPATH)/man
  783. X           MANDIR = $(MANSOURCEPATH)1
  784. X            IMAKE = imake
  785. X             XLIB = $(EXTENSIONLIB)  -lX11
  786. X
  787. X  LOCAL_LIBRARIES = $(XLIB)
  788. X
  789. X OBJS = xwit.o
  790. X SRCS = xwit.c
  791. X
  792. X PROGRAM = xwit
  793. X
  794. Xall:: xwit
  795. X
  796. Xxwit: $(OBJS) $(DEPLIBS)
  797. X    $(RM) $@
  798. X    $(LKED) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
  799. X
  800. Xinstall:: xwit
  801. X    $(INSTALL) -c $(INSTPGMFLAGS) xwit $(BINDIR)
  802. Xinstall.man:: xwit.man
  803. X    $(INSTALL) -c $(INSTMANFLAGS) xwit.man $(MANDIR)/xwit.1
  804. Xclean::
  805. X    $(RM) $(PROGRAM)
  806. X    $(RM_CMD) \#*
  807. XMakefile::
  808. X    -@if [ -f Makefile ]; then \
  809. X    echo "    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
  810. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  811. X    else exit 0; fi
  812. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  813. Xtags::
  814. X    $(TAGS) -w *.[ch]
  815. X    $(TAGS) -xw *.[ch] > TAGS
  816. END-OF-FILE!
  817.     if test 1939 -ne "`wc -c <'xwit/Makefile'`"
  818.     then    echo "shar: error transmitting xwit/Makefile (1939 characters)"
  819.     fi
  820. fi
  821. if test -f 'xwit/Imakefile'
  822. then    echo "shar: will not overwrite existing file xwit/Imakefile"
  823. else    echo "shar: extracting xwit/Imakefile (53 chars)"
  824.     sed 's/^X//' <<\END-OF-FILE! >'xwit/Imakefile'
  825. XLOCAL_LIBRARIES = $(XLIB)
  826. X
  827. XSimpleProgramTarget(xwit)
  828. END-OF-FILE!
  829.     if test 53 -ne "`wc -c <'xwit/Imakefile'`"
  830.     then    echo "shar: error transmitting xwit/Imakefile (53 characters)"
  831.     fi
  832. fi
  833. if test -f 'xwit/patchlevel.h'
  834. then    echo "shar: will not overwrite existing file xwit/patchlevel.h"
  835. else    echo "shar: extracting xwit/patchlevel.h (65 chars)"
  836.     sed 's/^X//' <<\END-OF-FILE! >'xwit/patchlevel.h'
  837. X/*
  838. X * xwit:
  839. X * level 0: initial release
  840. X */
  841. X#define PATCHLEVEL 0
  842. END-OF-FILE!
  843.     if test 65 -ne "`wc -c <'xwit/patchlevel.h'`"
  844.     then    echo "shar: error transmitting xwit/patchlevel.h (65 characters)"
  845.     fi
  846. fi
  847. echo 'end of shar part 1 of 1'
  848. exit 0
  849.  
  850. exit 0 # Just in case...
  851. -- 
  852.   // chris@Sterling.COM           | Send comp.sources.x submissions to:
  853. \X/  Amiga: The only way to fly!  |    sources-x@sterling.com
  854.        "It's intuitively obvious to the most casual observer..."
  855.  GCS d++(--) -p+ c++ !l u++ e+ m+(-) s++/++ n h--- f+ g+++ w+ t++ r+ y+
  856.