debian/0000755000000000000000000000000012251573673007201 5ustar debian/.git-dpm0000644000000000000000000000041612251573673010544 0ustar # see git-dpm(1) from git-dpm package f24e229ffab562b49e5f6dbcfe149bb9f9ec35f4 f24e229ffab562b49e5f6dbcfe149bb9f9ec35f4 0e648ff7bc9bae837f1622093dab2f94b4f603ae 0e648ff7bc9bae837f1622093dab2f94b4f603ae xwit_3.4.orig.tar.gz 2dde9cca621c71d858a3b7aea673e7caccd11caa 14557 debian/changelog0000644000000000000000000000707512251573673011064 0ustar xwit (3.4-15) unstable; urgency=medium * update Vcs- headers * change debhelper compatibility to 8 * bump Standards-Version -- Bernhard R. Link Tue, 10 Dec 2013 12:14:38 +0100 xwit (3.4-14) unstable; urgency=low * import patch from Ubuntu fixing wrong linker argument order * use dpkg-buildflags * switch to debhelper compatibility level 7 * make description changes suggested by lintian -- Bernhard R. Link Wed, 14 Sep 2011 15:23:12 +0200 xwit (3.4-13) unstable; urgency=low * switch to "3.0 (quilt)" format * add Vcs- headers * bump Standards-Version, no changes needed -- Bernhard R. Link Mon, 04 Jan 2010 10:14:51 +0100 xwit (3.4-12) unstable; urgency=low * add patch from Paolo Bonzini to make -focus work better with some newfangled window managers. * increase Standards-Version to 3.8.2. -- Bernhard R. Link Wed, 15 Jul 2009 12:06:48 +0200 xwit (3.4-11) unstable; urgency=low * increase Standards-Version to 3.8.0: - support parallel=n in DEB_BUILD_OPTIONS * fix example in manpage (Closes: 502328), thanks to Daniel Watkins. -- Bernhard R. Link Sun, 19 Oct 2008 19:09:04 +0200 xwit (3.4-10) unstable; urgency=low * update Standards-version to 3.7.2 * modernize debian/rules (dh 5, don't ignore make clean errors, build-arch) -- Bernhard R. Link Sat, 08 Dec 2007 12:32:01 +0100 xwit (3.4-9) unstable; urgency=low * some code cleanup * add an -property option to specify something different than the name of the window to use (Closes: #109313) * add an -print command to print the windows geometry and name * add an -all alias to -names '' * correctly escape dashes in the manpage -- Bernhard R. Link Fri, 2 Dec 2005 16:18:14 +0100 xwit (3.4-8) unstable; urgency=low * Adopting this package (Closes: #327628) * repackage - getting rid of dpatch - make description more like I like it - build with custom Makefile, getting rid of imake * adding patch from Decklin Foster (Closes: #334921) -- Bernhard R. Link Fri, 21 Oct 2005 12:08:33 +0200 xwit (3.4-7) unstable; urgency=low * QA Group upload orphaning this package * debian/control: build-depend on dpatch * debian/rules: add dpatch support * Added patch from Andreas Jochens to fix FTBFS with gcc-3.4 (closes: #263209) -- Andrew Pollock Tue, 4 Oct 2005 21:45:57 +1000 xwit (3.4-6) unstable; urgency=low * Added -focus option (Thanks to Michael Mauch for the patch) -- Dima Barsky Sun, 22 Jun 2003 00:13:10 +0100 xwit (3.4-5) unstable; urgency=low * Modified long description to comply with the policy (Closes: #110207) * Added Build-Depends: xlibs-dev (Closes: #105375) * Some code clean-up to get rid of compilation warnings -- Dima Barsky Sat, 8 Sep 2001 12:38:34 +0100 xwit (3.4-4) unstable; urgency=low * Added xutils and debhelper to Build-Depends (Closes: #82884) -- Dima Barsky Fri, 19 Jan 2001 20:06:16 +0000 xwit (3.4-3) unstable; urgency=low * Added -fetch and -store options to access cutbuffers (Closes: #38379) -- Dima Barsky Sat, 6 Jan 2001 17:02:55 +0000 xwit (3.4-2) unstable; urgency=low * Changed Architecture: from i386 to any -- Dima Barsky Wed, 07 Oct 1998 11:23:48 +0100 xwit (3.4-1) unstable; urgency=low * Initial Release. -- Dima Barsky Fri, 24 Jul 1998 23:39:26 +0100 debian/compat0000644000000000000000000000000212251573673010377 0ustar 8 debian/control0000644000000000000000000000137312251573673010610 0ustar Source: xwit Section: x11 Priority: optional Maintainer: Bernhard R. Link Build-Depends: debhelper (>= 8), libx11-dev, x11proto-core-dev Standards-Version: 3.9.5 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=users/brlink/xwit.git;a=summary Vcs-Git: git://anonscm.debian.org/users/brlink/xwit.git Package: xwit Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: collection of simple routines to call some X11 functions xwit allows one to call some X11 functions from the command line or a shell script. . xwit will resize, iconify, pop, and move windows given by name or id, change an icon, title or name, set the screen saver going, and change individual key autorepeat settings, move the mouse cursor, etc. debian/copyright0000644000000000000000000001037512251573673011142 0ustar This package was debianized by Bernhard R. Link on Fri, 21 Oct 2005 12:06:15 +0200. The .orig.tar.gz was repackaged by my predecessor as maintainer without any changes from a .tar.gz from ftp://ftp.x.org/contrib/utilities/ xwit is written by Mark M Martin mmm@cetia.fr and David DiGiacomo david@slack.com The actual license is a bit unclear, the README file states: | The program is released into the public domain. The considerate | will leave credit for the authors. while xwit.c contains the following notice: * Copyright 1991 CETIA * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of CETIA not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. CETIA makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * CETIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CETIA * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Original by Mark M Martin. cetia 93/08/13 r1.6 mmm@cetia.fr * * This version by David DiGiacomo, david@slack.com. The file ClientWin.c contain the following notice: * Copyright 1989 by the Massachusetts Institute of Technology * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. M.I.T. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. Additionally, xwit is compiled using a file named dsimple.c, which has no license notice in the .tar.gz, and is replaced in the .diff.gz by a almost identically file available from the X sources with the following license notice: | Copyright 1993, 1998 The Open Group | | Permission to use, copy, modify, distribute, and sell this software and its | documentation for any purpose is hereby granted without fee, provided that | the above copyright notice appear in all copies and that both that | copyright notice and this permission notice appear in supporting | documentation. | | The above copyright notice and this permission notice shall be included | in all copies or substantial portions of the Software. | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | OTHER DEALINGS IN THE SOFTWARE. | | Except as contained in this notice, the name of The Open Group shall | not be used in advertising or otherwise to promote the sale, use or | other dealings in this Software without prior written authorization | from The Open Group. Additionally included are - a patch to add -fetch and -store and may clean-ups (most likely from Dima Barsky ) - a patch to add a -focus option from Michael Mauch - a patch to add -raise, -lower, -opposite, -circulate from Decklin Foster - some cleanup by me (Bernhard R. Link ) - a parch from Paolo Bonzini to modernize -focus debian/dirs0000644000000000000000000000001012251573673010054 0ustar usr/bin debian/docs0000644000000000000000000000000712251573673010051 0ustar README debian/patches/0000755000000000000000000000000012251573673010630 5ustar debian/patches/0001-debian-changes-from-xwit-3.4-2.patch0000644000000000000000000001137712251573673017463 0ustar From 71c0e50503a98659b838e02514bd6da4c239577f Mon Sep 17 00:00:00 2001 From: Dima Barsky Date: Sun, 3 Jan 2010 20:16:03 +0100 Subject: debian changes from xwit 3.4-2 Taken from xwit_3.4-1.diff.gz. --- dsimple.c | 38 ++++++++++++++++++++------------------ xwit.c | 32 +++++++++++++++++++------------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/dsimple.c b/dsimple.c index cd61870..a88f55b 100644 --- a/dsimple.c +++ b/dsimple.c @@ -20,6 +20,26 @@ void out(); void blip(); Window Window_With_Name(); void Fatal_Error(); +void usage(); + +/* + * outl: a debugging routine. Flushes stdout then prints a message on stderr + * and flushes stderr. Used to print messages when past certain points + * in code so we can tell where we are. Outl may be invoked like + * printf with up to 7 arguments. + */ +/* VARARGS1 */ +void +outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) + char *msg; + char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; +{ + fflush(stdout); + fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); + fprintf(stderr, "\n"); + fflush(stderr); +} + /* * Just_display: A group of routines designed to make the writting of simple @@ -467,24 +487,6 @@ Window Window_With_Name(dpy, top, name) } /* - * outl: a debugging routine. Flushes stdout then prints a message on stderr - * and flushes stderr. Used to print messages when past certain points - * in code so we can tell where we are. Outl may be invoked like - * printf with up to 7 arguments. - */ -/* VARARGS1 */ -outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) - char *msg; - char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; -{ - fflush(stdout); - fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - fprintf(stderr, "\n"); - fflush(stderr); -} - - -/* * Standard fatal error routine - call like printf but maximum of 7 arguments. * Does not require dpy or screen defined. */ diff --git a/xwit.c b/xwit.c index 5a7f720..7353d5b 100644 --- a/xwit.c +++ b/xwit.c @@ -31,10 +31,14 @@ #include #include #include +#include #include #include "dsimple.h" +Window XmuClientWindow(); + /* note: called by dsimple.c code, must be global */ +void usage() { static char Revision[] = "$Revision: 3.4 $"; @@ -127,20 +131,20 @@ static void doit(); /* * sleep for given millisecs for those without usleep */ -static +static void mssleep(ms) int ms; { struct timeval tv; tv.tv_sec = ms/1000; tv.tv_usec = (ms%1000)*1000; - select(0,(int*)0,(int*)0,(int*)0,&tv); + select(0,NULL,NULL,NULL,&tv); } /* * find all windows below this and if name matches call doit on it */ -static +static void downtree(top) Window top; { @@ -164,7 +168,7 @@ Window top; /* * [un]set autorepeat for individual keys */ -static +static void setrepeat() { unsigned long value_mask; @@ -186,7 +190,7 @@ setrepeat() * get window position, compensating for decorations * (based on xwininfo.c) */ -static +static void getpos(window, xp, yp) Window window; int *xp, *yp; @@ -209,7 +213,7 @@ getpos(window, xp, yp) /* * get window size */ -static +static void getsize(window, wp, hp) Window window; int *wp, *hp; @@ -226,7 +230,7 @@ getsize(window, wp, hp) /* * set window position */ -static +static void domove(window, x, y, right, bottom) Window window; int x, y; @@ -299,7 +303,7 @@ domove(window, x, y, right, bottom) /* * set window size */ -static +static void doresize(window, w, h) Window window; int w, h; @@ -343,7 +347,7 @@ doresize(window, w, h) /* * set row/column size */ -static +static void rcresize(what, window) enum functions what; Window window; @@ -375,7 +379,7 @@ rcresize(what, window) XFree(hints); } -static +static void loadbitmap(window, file, pmp) Window window; char *file; @@ -389,7 +393,7 @@ loadbitmap(window, file, pmp) Fatal_Error("XReadBitmapFile failed"); } -static +static void setbitmap(window) Window window; { @@ -418,7 +422,7 @@ setbitmap(window) XSetCloseDownMode(dpy, RetainTemporary); } - if (ohints = XGetWMHints(dpy, window)) { + if ((ohints = XGetWMHints(dpy, window)) != NULL ) { if (ohints->icon_pixmap && hints->icon_pixmap) XFreePixmap(dpy, ohints->icon_pixmap); if (ohints->icon_mask && hints->icon_mask) @@ -429,7 +433,7 @@ setbitmap(window) XSetWMHints(dpy, window, hints); } -static +static void setwinattr(window) Window window; { @@ -633,6 +637,7 @@ getxid(s) return id; Fatal_Error("Invalid ID format: %s", s); /* NOTREACHED */ + return -1; } static int @@ -709,6 +714,7 @@ matchopt(key, nargs, argc, argv) return match; } +void main(argc, argv) int argc; char **argv; debian/patches/0002-Added-fetch-and-store-options-to-access-cutbuffers.patch0000644000000000000000000000377412251573673023743 0ustar From 1980ce384f7d05e9c0683245b2c01b5307d256bf Mon Sep 17 00:00:00 2001 From: Dima Barsky Date: Sun, 3 Jan 2010 20:27:56 +0100 Subject: Added -fetch and -store options to access cutbuffers Taken from xwit_3.4-5.diff.gz (but supposed to be there since 3.4-3). --- xwit.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/xwit.c b/xwit.c index 7353d5b..de7934d 100644 --- a/xwit.c +++ b/xwit.c @@ -118,6 +118,7 @@ static char *wmiconname; static int Giconx, Gicony; static int nrows; static int ncolumns; +static int nbuffer; static char *bitmapname; static char *maskname; static int Gbs, Gsu; @@ -715,6 +716,42 @@ matchopt(key, nargs, argc, argv) } void +FetchBuffer( dpy, nbuf ) + Display *dpy; + int nbuf; +{ + char *buf; + int size; + + buf = XFetchBuffer(dpy, &size, nbuf); + + if( size == 0 ) + fprintf( stderr, "Could not fetch cutbuffer %d\n", nbuf ); + else + fwrite( buf, 1, size, stdout ); +} + +void +StoreBuffer( dpy, nbuf ) + Display *dpy; + int nbuf; +{ + char *buf = NULL; + int bufsize, nread, total=0; + + bufsize = 10; + buf = malloc( bufsize ); + while( (nread=read(0,buf+total,bufsize-total)) > 0 ) + { + total+=nread; + bufsize *= 2; + buf = realloc( buf, bufsize ); + } + XStoreBuffer(dpy, buf, total, nbuf); + free(buf); +} + +int main(argc, argv) int argc; char **argv; @@ -751,6 +788,14 @@ main(argc, argv) function |= FBIT(columns); ncolumns = atoi(*++argv); } + else if (matchopt("store*buffer", 1, pargc, argv)) { + nbuffer = atoi(*++argv); + StoreBuffer( dpy, nbuffer ); + } + else if (matchopt("fetch*buffer", 1, pargc, argv)) { + nbuffer = atoi(*++argv); + FetchBuffer( dpy, nbuffer ); + } else if (matchopt("c*urrent", 0, pargc, argv)) { Winidmode = WID_curr; } debian/patches/0003-Some-code-clean-up-to-get-rid-of-compilation-warning.patch0000644000000000000000000000127412251573673024104 0ustar From 065f5a5c9a08eaa2689ae68197c273c3d2b35e24 Mon Sep 17 00:00:00 2001 From: Dima Barsky Date: Sun, 3 Jan 2010 20:29:12 +0100 Subject: Some code clean-up to get rid of compilation warnings Taken from xwit_3.4-5.diff.gz. --- xwit.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/xwit.c b/xwit.c index de7934d..bb20d54 100644 --- a/xwit.c +++ b/xwit.c @@ -989,6 +989,8 @@ main(argc, argv) case WID_select: window = xwit_select_window(dpy, 0); break; + default: + break; } switch (Winidmode) { @@ -1007,5 +1009,6 @@ main(argc, argv) XSync(dpy, True); (void) XCloseDisplay(dpy); - exit(!Gwinfound); + return(!Gwinfound); } + debian/patches/0004-Added-focus-option.patch0000644000000000000000000000365212251573673015664 0ustar From 3db6dbe908c0a51b5aaf07e91d31f319f333db35 Mon Sep 17 00:00:00 2001 From: Michael Mauch Date: Sun, 3 Jan 2010 20:33:28 +0100 Subject: Added -focus option Taken from xwit_3.4-6.diff.gz. --- xwit.c | 10 ++++++++-- xwit.man | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/xwit.c b/xwit.c index bb20d54..dbb4165 100644 --- a/xwit.c +++ b/xwit.c @@ -62,7 +62,7 @@ usage() fprintf(stderr, "usage: %s -display -sync\n\ - -pop -iconify -unmap\n\ + -pop -focus -iconify -unmap\n\ -resize w h -rows r -columns c -[r]move x y\n\ -[r]warp x y -colormap -[no]save\n\ -name -iconname \n\ @@ -76,7 +76,7 @@ usage() } enum functions { - pop, icon, unmap, colormap, + pop, focus, icon, unmap, colormap, move, rmove, warp, rwarp, resize, save, nosave, keyrepeat, nokeyrepeat, @@ -506,6 +506,9 @@ doit(window) case pop: XMapRaised(dpy, window); break; + case focus: + XSetInputFocus(dpy, window, CurrentTime, RevertToNone); + break; case unmap: XUnmapWindow(dpy, window); break; @@ -896,6 +899,9 @@ main(argc, argv) else if (matchopt("p*op", 0, pargc, argv)) { function |= FBIT(pop); } + else if (matchopt("f*ocus", 0, pargc, argv)) { + function |= FBIT(focus); + } else if (matchopt("ri*conmove", 2, pargc, argv)) { function |= FBIT(riconmove); Giconx = atoi(argv[1]); diff --git a/xwit.man b/xwit.man index b5b4050..f740e11 100644 --- a/xwit.man +++ b/xwit.man @@ -10,6 +10,7 @@ xwit .IR display ] .RB [ -sync ] .RB [ -pop ] +.RB [ -focus ] .RB [ -iconify ] .RB [ -unmap ] .br @@ -77,6 +78,9 @@ causes all X requests to be performed synchronously. is the default action. It need only be given if it is wanted as well as some other function. .TP +-focus +will give the input focus to the specified window. +.TP -iconify will iconify the windows instead of popping them. .TP debian/patches/0005-fix-FTBFS-with-gcc-3.4.patch0000644000000000000000000000220012251573673015662 0ustar From d02388c85fa6357cf178372de5a7cf38b34f30fd Mon Sep 17 00:00:00 2001 From: Andreas Jochens Date: Sun, 3 Jan 2010 20:37:25 +0100 Subject: fix FTBFS with gcc-3.4 Taken from xwit_3.4-7.diff.gz and also found at http://bugs.debian.org/263209: When building 'xwit' with gcc-3.4 I get the following error: make[1]: Entering directory `/xwit-3.4' gcc -g -O2 -Wall -c -o xwit.o xwit.c gcc -g -O2 -Wall -c -o dsimple.o dsimple.c dsimple.c: In function `Malloc': dsimple.c:69: error: conflicting types for 'malloc' dsimple.c: In function `Fatal_Error': dsimple.c:503: warning: implicit declaration of function `exit' make[1]: *** [dsimple.o] Error 1 make[1]: Leaving directory `/xwit-3.4' make: *** [build] Error 2 With the attached patch 'xwit' can be compiled using gcc-3.4. --- dsimple.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dsimple.c b/dsimple.c index a88f55b..cbd42b6 100644 --- a/dsimple.c +++ b/dsimple.c @@ -66,7 +66,7 @@ extern int screen; char *Malloc(size) unsigned size; { - char *data, *malloc(); + char *data; if (!(data = malloc(size))) Fatal_Error("Out of memory!"); debian/patches/0006-patch-to-add-a-few-more-window-operations.patch0000644000000000000000000000666012251573673022134 0ustar From fcfc7a3ba139d6a82d99a10d01a5bb950cf92ea2 Mon Sep 17 00:00:00 2001 From: Decklin Foster Date: Sun, 3 Jan 2010 20:49:55 +0100 Subject: patch to add a few more window operations This implements a few more window management actions which are somewhat obscure, but useful to me. Add operations to raise (without mapping) or lower a window, and toggle or circulate stacking. --- xwit.c | 38 ++++++++++++++++++++++++++++++++++++++ xwit.man | 21 +++++++++++++++++++++ 2 files changed, 59 insertions(+), 0 deletions(-) diff --git a/xwit.c b/xwit.c index dbb4165..ac3f68a 100644 --- a/xwit.c +++ b/xwit.c @@ -63,6 +63,7 @@ usage() fprintf(stderr, "usage: %s -display -sync\n\ -pop -focus -iconify -unmap\n\ + -raise -lower -opposite -[un]circulate\n\ -resize w h -rows r -columns c -[r]move x y\n\ -[r]warp x y -colormap -[no]save\n\ -name -iconname \n\ @@ -77,6 +78,7 @@ usage() enum functions { pop, focus, icon, unmap, colormap, + raise, lower, opposite, circulate, uncirculate, move, rmove, warp, rwarp, resize, save, nosave, keyrepeat, nokeyrepeat, @@ -509,6 +511,27 @@ doit(window) case focus: XSetInputFocus(dpy, window, CurrentTime, RevertToNone); break; + case raise: + values.stack_mode = Above; + value_mask = CWStackMode; + XConfigureWindow(dpy, window, value_mask, &values); + break; + case lower: + values.stack_mode = Below; + value_mask = CWStackMode; + XConfigureWindow(dpy, window, value_mask, &values); + break; + case opposite: + values.stack_mode = Opposite; + value_mask = CWStackMode; + XConfigureWindow(dpy, window, value_mask, &values); + break; + case circulate: + XCirculateSubwindowsUp(dpy, window); + break; + case uncirculate: + XCirculateSubwindowsDown(dpy, window); + break; case unmap: XUnmapWindow(dpy, window); break; @@ -902,6 +925,21 @@ main(argc, argv) else if (matchopt("f*ocus", 0, pargc, argv)) { function |= FBIT(focus); } + else if (matchopt("ra*ise", 0, pargc, argv)) { + function |= FBIT(raise); + } + else if (matchopt("lo*wer", 0, pargc, argv)) { + function |= FBIT(lower); + } + else if (matchopt("op*posite", 0, pargc, argv)) { + function |= FBIT(opposite); + } + else if (matchopt("cir*culate", 0, pargc, argv)) { + function |= FBIT(circulate); + } + else if (matchopt("uncir*culate", 0, pargc, argv)) { + function |= FBIT(uncirculate); + } else if (matchopt("ri*conmove", 2, pargc, argv)) { function |= FBIT(riconmove); Giconx = atoi(argv[1]); diff --git a/xwit.man b/xwit.man index f740e11..04cc02d 100644 --- a/xwit.man +++ b/xwit.man @@ -14,6 +14,11 @@ xwit .RB [ -iconify ] .RB [ -unmap ] .br +.RB [ -raise ] +.RB [ -lower ] +.RB [ -opposite ] +.RB [ - [ un ] circulate ] +.br .RB [ -resize .IR w\ h ] .RB [ -rows @@ -88,6 +93,22 @@ will iconify the windows instead of popping them. will iconify windows by unmapping with a non ICCCM compliant window manager. (Beware, this option is not usually what you want). .TP +-raise +raise windows (but do not map them if unmapped). +.TP +-lower +lower windows. +.TP +-opposite +toggle the stacking of windows from top to bottom among any overlapping +windows. +.TP +-circulate +circulate a window's subwindows forward. Use this with -root. +.TP +-uncirculate +circulate a window's subwindows backward. Use this with -root. +.TP -resize w h resize windows to the given pixel size. .TP debian/patches/0007-replace-dsimple.-with-newer-version.patch0000644000000000000000000002222012251573673021131 0ustar From 49656f601637a948e119d8bedece7d76c0f64946 Mon Sep 17 00:00:00 2001 From: "Bernhard R. Link" Date: Sun, 3 Jan 2010 20:54:38 +0100 Subject: replace dsimple.* with newer version --- dsimple.c | 132 +++++++++++++++++++++++++++++++++---------------------------- dsimple.h | 41 ++++++++++--------- 2 files changed, 92 insertions(+), 81 deletions(-) diff --git a/dsimple.c b/dsimple.c index cbd42b6..b4819cd 100644 --- a/dsimple.c +++ b/dsimple.c @@ -1,45 +1,47 @@ -/* $XConsortium: dsimple.c,v 1.12 91/05/11 21:01:36 gildea Exp $ */ -/* $Id: dsimple.c,v 3.2 95/10/18 16:58:55 dd Exp $ */ +/* $Xorg: dsimple.c,v 1.4 2001/02/09 02:05:54 xorgcvs Exp $ */ +/* + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/programs/xlsfonts/dsimple.c,v 3.6 2001/12/14 20:02:09 dawes Exp $ */ + #include #include #include #include #include +#include +#include /* * Other_stuff.h: Definitions of routines in other_stuff. * * Written by Mark Lillibridge. Last updated 7/1/87 - * - * Send bugs, etc. to chariot@athena.mit.edu. - */ - -unsigned long Resolve_Color(); -Pixmap Bitmap_To_Pixmap(); -Window Select_Window(); -void out(); -void blip(); -Window Window_With_Name(); -void Fatal_Error(); -void usage(); - -/* - * outl: a debugging routine. Flushes stdout then prints a message on stderr - * and flushes stderr. Used to print messages when past certain points - * in code so we can tell where we are. Outl may be invoked like - * printf with up to 7 arguments. */ -/* VARARGS1 */ -void -outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) - char *msg; - char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; -{ - fflush(stdout); - fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - fprintf(stderr, "\n"); - fflush(stderr); -} +#include "dsimple.h" /* * Just_display: A group of routines designed to make the writting of simple @@ -49,22 +51,20 @@ outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) * and screen already defined on entry. * * Written by Mark Lillibridge. Last updated 7/1/87 - * - * Send bugs, etc. to chariot@athena.mit.edu. */ /* This stuff is defined in the calling program by just_display.h */ -extern char *program_name; -extern Display *dpy; -extern int screen; +char *program_name = "unknown_program"; +Display *dpy; +int screen; +static void _bitmap_error(int, char *); /* * Malloc: like malloc but handles out of memory using Fatal_Error. */ -char *Malloc(size) - unsigned size; +char *Malloc(size_t size) { char *data; @@ -78,11 +78,9 @@ char *Malloc(size) /* * Realloc: like Malloc except for realloc, handles NULL using Malloc. */ -char *Realloc(ptr, size) - char *ptr; - int size; +char *Realloc(void *ptr,size_t size) { - char *new_ptr, *realloc(); + void *new_ptr; if (!ptr) return(Malloc(size)); @@ -98,9 +96,7 @@ char *Realloc(ptr, size) * Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obselete) * If found, remove it from command line. Don't go past a lone -. */ -char *Get_Display_Name(pargc, argv) - int *pargc; /* MODIFIED */ - char **argv; /* MODIFIED */ +char *Get_Display_Name(int *pargc, char **argv) { int argc = *pargc; char **pargv = argv+1; @@ -158,9 +154,7 @@ char *display_name; * for this display is then stored in screen. * Does not require dpy or screen defined. */ -void Setup_Display_And_Screen(argc, argv) -int *argc; /* MODIFIED */ -char **argv; /* MODIFIED */ +void Setup_Display_And_Screen(int *argc, char **argv) { dpy = Open_Display (Get_Display_Name(argc, argv)); screen = DefaultScreen(dpy); @@ -279,7 +273,7 @@ Window Select_Window_Args(rargc, argv) #define OPTION argv[0] #define NXTOPTP ++argv, --argc>0 #define NXTOPT if (++argv, --argc==0) usage() -#define COPYOPT nargv++[0]=OPTION; nargc++ +#define COPYOPT nargv++[0]=OPTION, nargc++ while (NXTOPTP) { if (!strcmp(OPTION, "-")) { @@ -305,7 +299,7 @@ Window Select_Window_Args(rargc, argv) w=0; sscanf(OPTION, "0x%lx", &w); if (!w) - sscanf(OPTION, "%ld", &w); + sscanf(OPTION, "%lu", &w); if (!w) Fatal_Error("Invalid window id format: %s.", OPTION); continue; @@ -321,13 +315,8 @@ Window Select_Window_Args(rargc, argv) * Other_stuff: A group of routines which do common X11 tasks. * * Written by Mark Lillibridge. Last updated 7/1/87 - * - * Send bugs, etc. to chariot@athena.mit.edu. */ -extern Display *dpy; -extern int screen; - /* * Resolve_Color: This routine takes a color name and returns the pixel # * that when used in the window w will be of color name. @@ -401,7 +390,9 @@ Pixmap Bitmap_To_Pixmap(dpy, d, gc, bitmap, width, height) */ void blip() { - outl("blip!"); + fflush(stdout); + fprintf(stderr, "blip!\n"); + fflush(stderr); } @@ -487,18 +478,37 @@ Window Window_With_Name(dpy, top, name) } /* + * outl: a debugging routine. Flushes stdout then prints a message on stderr + * and flushes stderr. Used to print messages when past certain points + * in code so we can tell where we are. Outl may be invoked like + * printf with up to 7 arguments. + */ +void +outl(char *msg, ...) +{ + va_list args; + fflush(stdout); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); + fprintf(stderr, "\n"); + fflush(stderr); +} + + +/* * Standard fatal error routine - call like printf but maximum of 7 arguments. * Does not require dpy or screen defined. */ -/* VARARGS1 */ -void Fatal_Error(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) -char *msg; -char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; +void Fatal_Error(char *msg, ...) { + va_list args; fflush(stdout); fflush(stderr); fprintf(stderr, "%s: error: ", program_name); - fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); fprintf(stderr, "\n"); exit(2); } diff --git a/dsimple.h b/dsimple.h index eb7c419..c9a7b01 100644 --- a/dsimple.h +++ b/dsimple.h @@ -12,26 +12,26 @@ /* Global variables used by routines in just_display.c */ -char *program_name = "unknown_program"; /* Name of this program */ -Display *dpy; /* The current display */ -int screen; /* The current screen */ +extern char *program_name; /* Name of this program */ +extern Display *dpy; /* The current display */ +extern int screen; /* The current screen */ #define INIT_NAME program_name=argv[0] /* use this in main to setup program_name */ /* Declaritions for functions in just_display.c */ -void Fatal_Error(); -char *Malloc(); -char *Realloc(); -char *Get_Display_Name(); -Display *Open_Display(); -void Setup_Display_And_Screen(); -XFontStruct *Open_Font(); -void Beep(); -Pixmap ReadBitmapFile(); -void WriteBitmapFile(); -Window Select_Window_Args(); +void Fatal_Error(char *msg, ...); +char *Malloc(size_t); +char *Realloc(void*,size_t); +char *Get_Display_Name(int*,char **); +Display *Open_Display(char *); +void Setup_Display_And_Screen(int *, char **); +XFontStruct *Open_Font(char *); +void Beep(void); +Pixmap ReadBitmapFile(Drawable,char *,int*,int*,int*,int*); +void WriteBitmapFile(char *,Pixmap,int,int,int,int); +Window Select_Window_Args(int *,char **); #define X_USAGE "[host:display]" /* X arguments handled by Get_Display_Name */ @@ -45,9 +45,10 @@ Window Select_Window_Args(); * Send bugs, etc. to chariot@athena.mit.edu. */ -unsigned long Resolve_Color(); -Pixmap Bitmap_To_Pixmap(); -Window Select_Window(); -void out(); -void blip(); -Window Window_With_Name(); +unsigned long Resolve_Color(Window,char *); +Pixmap Bitmap_To_Pixmap(Display *,Drawable,GC,Pixmap,int,int); +Window Select_Window(Display *); +void out(void); +void blip(void); +Window Window_With_Name(Display *,Window,char *); +void usage(void); debian/patches/0008-improve-manpage.patch0000644000000000000000000000250512251573673015327 0ustar From 4657be04005631f184547fc535fded6706c15c0c Mon Sep 17 00:00:00 2001 From: "Bernhard R. Link" Date: Sun, 3 Jan 2010 20:55:23 +0100 Subject: improve manpage --- xwit.man | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xwit.man b/xwit.man index 04cc02d..3ebc2d9 100644 --- a/xwit.man +++ b/xwit.man @@ -1,5 +1,4 @@ -.\" $Id: xwit.man,v 3.4 97/10/20 18:32:54 dd Exp $ -.TH XWIT 1X +.TH XWIT 1 "22 Oct 2005" .SH NAME xwit \- window interface tool: pop or iconify this xterm window or named windows .SH SYNOPSIS @@ -70,7 +69,7 @@ and apply it to several windows whose name begins with one of the given strings, or a particular window id given, or the window id found in the environment variable .B WINDOWID -(which is set by xterm for the program it runs). +(which is set by xterm for the program it runs), or the window under the mouse cursor. .SH OPTIONS .TP -display @@ -229,5 +228,6 @@ Mark M Martin, CETIA France, mmm@cetia.fr .br David DiGiacomo, david@slack.com .SH ACKNOWLEDGEMENTS -Thanks to Andre Delafontaine, Norman R. McBride, Keith Thompson, and -Glen R. Walker for bug reports and suggestions. +Thanks to Andre Delafontaine, Norman R. McBride, Keith Thompson, +Glen R. Walker, Michael Mauch, Dima Barsky and Decklin Foster +for bug reports, suggestions and/or patches. debian/patches/0009-correctly-escape-dashes-in-the-manpage.patch0000644000000000000000000001643212251573673021546 0ustar From 2a30affc01fd26172652fea978c4b82d593ab960 Mon Sep 17 00:00:00 2001 From: "Bernhard R. Link" Date: Sun, 3 Jan 2010 21:07:05 +0100 Subject: correctly escape dashes in the manpage --- xwit.man | 154 +++++++++++++++++++++++++++++++------------------------------- 1 files changed, 77 insertions(+), 77 deletions(-) diff --git a/xwit.man b/xwit.man index 3ebc2d9..3e5aef5 100644 --- a/xwit.man +++ b/xwit.man @@ -1,62 +1,62 @@ -.TH XWIT 1 "22 Oct 2005" +.TH XWIT 1 "2 Dec 2005" .SH NAME xwit \- window interface tool: pop or iconify this xterm window or named windows .SH SYNOPSIS .B xwit 'in \n(.iu+\w'\fBxwit \fR'u -.RB [ -display +.RB [ \-display .IR display ] -.RB [ -sync ] -.RB [ -pop ] -.RB [ -focus ] -.RB [ -iconify ] -.RB [ -unmap ] +.RB [ \-sync ] +.RB [ \-pop ] +.RB [ \-focus ] +.RB [ \-iconify ] +.RB [ \-unmap ] .br -.RB [ -raise ] -.RB [ -lower ] -.RB [ -opposite ] -.RB [ - [ un ] circulate ] +.RB [ \-raise ] +.RB [ \-lower ] +.RB [ \-opposite ] +.RB [ \- [ un ] circulate ] .br -.RB [ -resize +.RB [ \-resize .IR w\ h ] -.RB [ -rows +.RB [ \-rows .IR r ] -.RB [ -columns +.RB [ \-columns .IR c ] -.RB [ - [ r ] move +.RB [ \- [ r ] move .IR x\ y ] .br -.RB [ - [ r ] warp +.RB [ \- [ r ] warp .IR x\ y ] -.RB [ -colormap +.RB [ \-colormap .IR colormapid ] -.RB [ - [ no ] save ] +.RB [ \- [ no ] save ] .br -.RB [ -name +.RB [ \-name .IR name ] -.RB [ -iconname +.RB [ \-iconname .IR name ] .br -.RB [ -bitmap +.RB [ \-bitmap .IR file ] -.RB [ -mask +.RB [ \-mask .IR file ] -.RB [ - [ r ] iconmove +.RB [ \- [ r ] iconmove .IR x\ y ] .br -.RB [ - [ no ] backingstore ] -.RB [ - [ no ] saveunder ] +.RB [ \- [ no ] backingstore ] +.RB [ \- [ no ] saveunder ] .br -.RB [ - [ no ] keyrepeat -.IR "keycode ... keycode - keycode ..." ] +.RB [ \- [ no ] keyrepeat +.IR "keycode ... keycode \- keycode ..." ] .br -.RB [ -id +.RB [ \-id .IR windowid ] -.RB [ -root ] -.RB [ -current ] -.RB [ -select ] -.RB [ -names +.RB [ \-root ] +.RB [ \-current ] +.RB [ \-select ] +.RB [ \-names .IR initialsubstring... ] .in .SH DESCRIPTION @@ -72,100 +72,100 @@ in the environment variable (which is set by xterm for the program it runs), or the window under the mouse cursor. .SH OPTIONS .TP --display +\-display is followed by the display to open. .TP --sync +\-sync causes all X requests to be performed synchronously. .TP --pop +\-pop is the default action. It need only be given if it is wanted as well as some other function. .TP --focus +\-focus will give the input focus to the specified window. .TP --iconify +\-iconify will iconify the windows instead of popping them. .TP --unmap +\-unmap will iconify windows by unmapping with a non ICCCM compliant window manager. (Beware, this option is not usually what you want). .TP --raise +\-raise raise windows (but do not map them if unmapped). .TP --lower +\-lower lower windows. .TP --opposite +\-opposite toggle the stacking of windows from top to bottom among any overlapping windows. .TP --circulate -circulate a window's subwindows forward. Use this with -root. +\-circulate +circulate a window's subwindows forward. Use this with \-root. .TP --uncirculate -circulate a window's subwindows backward. Use this with -root. +\-uncirculate +circulate a window's subwindows backward. Use this with \-root. .TP --resize w h +\-resize w h resize windows to the given pixel size. .TP --rows r +\-rows r resize windows to the given number of rows. .TP --columns c +\-columns c resize windows to the given number of columns. .TP --move x y +\-move x y move windows to the given absolute position relative to its parent. (If the x or y value is negative it is taken relative to the right or bottom edge of the parent.) .TP --rmove x y +\-rmove x y move windows by the given relative amount. .TP --warp x y +\-warp x y move the cursor to the given position relative to the specified window. -Add -root to warp to an absolute position. +Add \-root to warp to an absolute position. .TP --rwarp x y +\-rwarp x y move the cursor by the given relative amount. .TP --colormap colormapid +\-colormap colormapid install the given colormap into the given window. --save -nosave +\-save \-nosave immediately enable or disable the screen saver. .TP --name name +\-name name set the WM_NAME property to the given string. .TP --iconname name +\-iconname name set the WM_ICON_NAME property to the given string. .TP --bitmap file +\-bitmap file use the given bitmap file as the icon bitmap for the window. .TP --mask file +\-mask file use the given bitmap file as the icon mask for the window. .TP --iconmove x y +\-iconmove x y move icons to the given absolute position. (Will not work with some window managers.) .TP --riconmove x y +\-riconmove x y move icons by the given relative amount. (Will not work with some window managers.) .TP --backingstore -bs -nobackingstore -nobs +\-backingstore \-bs \-nobackingstore \-nobs enable or disable backing store for the window. .TP --saveunder -su -nosaveunder -nosu +\-saveunder \-su \-nosaveunder \-nosu enable or disable saveunders for the window. .TP --keyrepeat -nokeyrepeat +\-keyrepeat \-nokeyrepeat is followed by a list of keycodes (decimal numbers, see xmodmap(1)). -A range can be specified as a lower number, ``-'', and upper number +A range can be specified as a lower number, ``\-'', and upper number as three separate arguments. The individual setting of auto-repeat for those keycodes is set on or off. The global setting of auto-repeat can be set with xset(1). @@ -176,47 +176,47 @@ Window Selection If no window is specified, $WINDOWID will be used if set; otherwise the window under the cursor will be selected. .TP --id +\-id is followed by a single window number, in decimal; or, if it begins with 0x, in hexadecimal. .TP --root +\-root selects the root window. .TP --current +\-current selects the window under the cursor (default if no window specified and $WINDOWID not set). .TP --select +\-select allows the user to interactively select a window with the mouse. .TP --names +\-names if given must be the last option and is followed by a list of strings. All windows that have a name that begins exactly like one of the strings will be acted upon. -By using a null string (-names ''), all names will be matched. +By using a null string (\-names ''), all names will be matched. .SH EXAMPLES .\" DD 10/97: seems to crash olvwm, sigh .\" To iconify all windows (probably not quite what you want to do) .\" .ta 1i -.\" xwit -names '' +.\" xwit \-names '' To de-iconify and pop ``this'' xterm and warp the cursor into it: - xwit -pop -warp 50 50 + xwit \-pop \-warp 50 50 To interactively select an xterm, and resize it to 34 rows and 80 columns: - xwit -select -rows 34 -columns 80 + xwit \-select \-rows 34 \-columns 80 To gently agitate your oclock on the screen: - while xwit -rmove 0 10 -name oclock - do xwit -rmove 0 -10 -name oclock + while xwit \-rmove 0 10 \-name oclock + do xwit \-rmove 0 \-10 \-name oclock done .SH DIAGNOSTICS Exit status is 0 if any action is taken, 1 if no window matches the list -supplied to -names, 2 if an error occurs. +supplied to \-names, 2 if an error occurs. .SH LIMITATIONS Since each application is supposed to request these functions of the window manager, some of them may not like other clients mapping and unmapping debian/patches/0010-all-prop-print.patch0000644000000000000000000001556212251573673015120 0ustar From e0d3a94de62ed9ef12ef3259bb39b3997dcda2eb Mon Sep 17 00:00:00 2001 From: "Bernhard R. Link" Date: Sun, 3 Jan 2010 21:08:05 +0100 Subject: all prop print * add an -property option to specify something different than the name of the window to use * add an -print command to print the windows geometry and name * add an -all alias to -names '' --- xwit.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- xwit.man | 15 ++++++++++ 2 files changed, 104 insertions(+), 6 deletions(-) diff --git a/xwit.c b/xwit.c index ac3f68a..4c7e6d6 100644 --- a/xwit.c +++ b/xwit.c @@ -26,6 +26,7 @@ * * This version by David DiGiacomo, david@slack.com. */ +#include #include #include #include @@ -62,15 +63,15 @@ usage() fprintf(stderr, "usage: %s -display -sync\n\ - -pop -focus -iconify -unmap\n\ + -pop -focus -iconify -unmap -print \n\ -raise -lower -opposite -[un]circulate\n\ -resize w h -rows r -columns c -[r]move x y\n\ -[r]warp x y -colormap -[no]save\n\ - -name -iconname \n\ + -name -iconname -property \n\ -bitmap -mask -[r]iconmove x y\n\ -[no]backingstore -[no]saveunder\n\ -[no]keyrepeat keycode ... keycode - keycode\n\ - -id -root -current -select\n\ + -id -root -current -select -all\n\ -names ... [must be last]\n", program_name); exit(2); @@ -78,6 +79,7 @@ usage() enum functions { pop, focus, icon, unmap, colormap, + print, raise, lower, opposite, circulate, uncirculate, move, rmove, warp, rwarp, resize, save, nosave, @@ -144,6 +146,34 @@ int ms; select(0,NULL,NULL,NULL,&tv); } +static Atom property = XA_WM_NAME; + +static Bool MyFetchName(Display *display, Window w, unsigned char **name) +{ + Atom returnedType; + int returnedFormat; + unsigned long number; + unsigned long bytesAfterReturn; + unsigned char *data; + + if( Success != XGetWindowProperty(display, w, property, + 0, (long)BUFSIZ, False, + XA_STRING, + &returnedType, &returnedFormat, + &number, &bytesAfterReturn, &data)) { + *name = NULL; + return False; + } else if( returnedType != XA_STRING || returnedFormat != 8 ) { + if(data) + XFree(data); + *name = NULL; + return False; + } else { + *name = data; + return (data!=NULL)?True:False; + } +} + /* * find all windows below this and if name matches call doit on it */ @@ -153,11 +183,12 @@ Window top; { Window *child, dummy; unsigned int children, i; - char **cpp, *name; + char **cpp; + unsigned char *name; if (XQueryTree(dpy, top, &dummy, &dummy, &child, &children)==0) Fatal_Error("XQueryTree failed"); for (i=0; i= ' ' && ((*name)&0x80)== 0 ) { + putchar(*name); + } else + printf("\\%03hho",*name); + name++; + } + putchar('\''); + putchar('\n'); + } +} + +/* * set window size */ static void @@ -505,6 +569,9 @@ doit(window) case colormap: XSetWindowColormap(dpy, window, cmap); break; + case print: + doprint(window); + break; case pop: XMapRaised(dpy, window); break; @@ -777,6 +844,8 @@ StoreBuffer( dpy, nbuf ) free(buf); } +char *allwindows[] = {""}; + int main(argc, argv) int argc; @@ -796,7 +865,12 @@ main(argc, argv) while (argv++, --argc > 0) { /* argv[0] = next argument */ /* argc = # of arguments left */ - if (matchopt("ba*ckingstore", 0, pargc, argv) || + if (matchopt("a*ll", 0, pargc, argv)) { + Winidmode = WID_names; + names = allwindows; + numnames = 1; + } + else if (matchopt("ba*ckingstore", 0, pargc, argv) || matchopt("bs", 0, pargc, argv)) { function |= FBIT(F_winattr); Gbs = 1; @@ -922,6 +996,9 @@ main(argc, argv) else if (matchopt("p*op", 0, pargc, argv)) { function |= FBIT(pop); } + else if (matchopt("pr*int", 0, pargc, argv)) { + function |= FBIT(print); + } else if (matchopt("f*ocus", 0, pargc, argv)) { function |= FBIT(focus); } @@ -993,6 +1070,12 @@ main(argc, argv) warpx = atoi(argv[1]); warpy = atoi(argv[2]); argv += 2; + } else if(matchopt("prop*erty",1, pargc,argv)) { + property = XInternAtom(dpy,argv[1],False); + if( None == property ) { + Fatal_Error("Unknown atom %s",argv[1]); + } + argv++; } else usage(); diff --git a/xwit.man b/xwit.man index 3e5aef5..54f53e0 100644 --- a/xwit.man +++ b/xwit.man @@ -56,6 +56,7 @@ xwit .RB [ \-root ] .RB [ \-current ] .RB [ \-select ] +.RB [ \-all ] .RB [ \-names .IR initialsubstring... ] .in @@ -78,6 +79,11 @@ is followed by the display to open. \-sync causes all X requests to be performed synchronously. .TP +\-property property +causes the specified property to be used instead of the windows +name (which is WM_NAME). +Some possible values are: WM_CLASS, WM_COMMAND, WM_ICON_NAME, WM_CLIENT_MACHINE. +.TP \-pop is the default action. It need only be given if it is wanted as well as some other function. @@ -171,6 +177,11 @@ The individual setting of auto-repeat for those keycodes is set on or off. The global setting of auto-repeat can be set with xset(1). When off, no keys will repeat. .TP +\-print +will print the id, the coordinates, the depth and the name of all +selected windows. +If \-property is given, that one will be printed instead of the name. +.TP Window Selection .br If no window is specified, $WINDOWID will be used if set; @@ -190,10 +201,14 @@ $WINDOWID not set). \-select allows the user to interactively select a window with the mouse. .TP +\-all +is equivalent to \-names '', as easier to remember. +.TP \-names if given must be the last option and is followed by a list of strings. All windows that have a name that begins exactly like one of the strings will be acted upon. +If \-property is given, this property is used instead of the name. By using a null string (\-names ''), all names will be matched. .SH EXAMPLES .\" DD 10/97: seems to crash olvwm, sigh debian/patches/0011-some-code-cleanup.patch0000644000000000000000000002262612251573673015540 0ustar From 0cada55f2cb31e423ab83269f4052c67a270bcd8 Mon Sep 17 00:00:00 2001 From: "Bernhard R. Link" Date: Sun, 3 Jan 2010 21:11:07 +0100 Subject: some code cleanup --- ClientWin.c | 12 ++----- ClientWin.h | 2 + dsimple.c | 76 +------------------------------------------------- xwit.c | 89 ++++++++++++++++++---------------------------------------- 4 files changed, 35 insertions(+), 144 deletions(-) create mode 100644 ClientWin.h diff --git a/ClientWin.c b/ClientWin.c index d472fbf..973eaef 100644 --- a/ClientWin.c +++ b/ClientWin.c @@ -17,14 +17,13 @@ #include #include +#include "ClientWin.h" -static Window TryChildren(); +static Window TryChildren(Display *,Window,Atom); /* Find a window with WM_STATE, else return win itself, as per ICCCM */ -Window XmuClientWindow (dpy, win) - Display *dpy; - Window win; +Window XmuClientWindow (Display *dpy,Window win) { Atom WM_STATE; Atom type = None; @@ -47,10 +46,7 @@ Window XmuClientWindow (dpy, win) } static -Window TryChildren (dpy, win, WM_STATE) - Display *dpy; - Window win; - Atom WM_STATE; +Window TryChildren (Display *dpy, Window win, Atom WM_STATE) { Window root, parent; Window *children; diff --git a/ClientWin.h b/ClientWin.h new file mode 100644 index 0000000..6bab5f5 --- /dev/null +++ b/ClientWin.h @@ -0,0 +1,2 @@ + +Window XmuClientWindow (Display *dpy,Window win); diff --git a/dsimple.c b/dsimple.c index b4819cd..5dc11f2 100644 --- a/dsimple.c +++ b/dsimple.c @@ -59,8 +59,6 @@ char *program_name = "unknown_program"; Display *dpy; int screen; -static void _bitmap_error(int, char *); - /* * Malloc: like malloc but handles out of memory using Fatal_Error. */ @@ -184,59 +182,6 @@ void Beep() XBell(dpy, 50); } - -/* - * ReadBitmapFile: same as XReadBitmapFile except it returns the bitmap - * directly and handles errors using Fatal_Error. - */ -static void _bitmap_error(status, filename) - int status; - char *filename; -{ - if (status == BitmapOpenFailed) - Fatal_Error("Can't open file %s!", filename); - else if (status == BitmapFileInvalid) - Fatal_Error("file %s: Bad bitmap format.", filename); - else - Fatal_Error("Out of memory!"); -} - -Pixmap ReadBitmapFile(d, filename, width, height, x_hot, y_hot) - Drawable d; - char *filename; - int *width, *height, *x_hot, *y_hot; -{ - Pixmap bitmap; - int status; - - status = XReadBitmapFile(dpy, RootWindow(dpy, screen), filename, - (unsigned int *)width, (unsigned int *)height, - &bitmap, x_hot, y_hot); - if (status != BitmapSuccess) - _bitmap_error(status, filename); - - return(bitmap); -} - - -/* - * WriteBitmapFile: same as XWriteBitmapFile except it handles errors - * using Fatal_Error. - */ -void WriteBitmapFile(filename, bitmap, width, height, x_hot, y_hot) - char *filename; - Pixmap bitmap; - int width, height, x_hot, y_hot; -{ - int status; - - status= XWriteBitmapFile(dpy, filename, bitmap, width, height, x_hot, - y_hot); - if (status != BitmapSuccess) - _bitmap_error(status, filename); -} - - /* * Select_Window_Args: a rountine to provide a common interface for * applications that need to allow the user to select one @@ -458,7 +403,7 @@ Window Window_With_Name(dpy, top, name) { Window *children, dummy; unsigned int nchildren; - int i; + unsigned int i; Window w=0; char *window_name; @@ -478,25 +423,6 @@ Window Window_With_Name(dpy, top, name) } /* - * outl: a debugging routine. Flushes stdout then prints a message on stderr - * and flushes stderr. Used to print messages when past certain points - * in code so we can tell where we are. Outl may be invoked like - * printf with up to 7 arguments. - */ -void -outl(char *msg, ...) -{ - va_list args; - fflush(stdout); - va_start(args, msg); - vfprintf(stderr, msg, args); - va_end(args); - fprintf(stderr, "\n"); - fflush(stderr); -} - - -/* * Standard fatal error routine - call like printf but maximum of 7 arguments. * Does not require dpy or screen defined. */ diff --git a/xwit.c b/xwit.c index 4c7e6d6..955eae6 100644 --- a/xwit.c +++ b/xwit.c @@ -35,8 +35,7 @@ #include #include #include "dsimple.h" - -Window XmuClientWindow(); +#include "ClientWin.h" /* note: called by dsimple.c code, must be global */ void @@ -131,14 +130,13 @@ static int Gbs, Gsu; static int Gwinfound; /* forward declarations */ -static void doit(); +static void doit(Window); /* * sleep for given millisecs for those without usleep */ static void -mssleep(ms) -int ms; +mssleep(int ms) { struct timeval tv; tv.tv_sec = ms/1000; @@ -156,10 +154,10 @@ static Bool MyFetchName(Display *display, Window w, unsigned char **name) unsigned long bytesAfterReturn; unsigned char *data; - if( Success != XGetWindowProperty(display, w, property, - 0, (long)BUFSIZ, False, + if( Success != XGetWindowProperty(display, w, property, + 0, (long)BUFSIZ, False, XA_STRING, - &returnedType, &returnedFormat, + &returnedType, &returnedFormat, &number, &bytesAfterReturn, &data)) { *name = NULL; return False; @@ -178,8 +176,7 @@ static Bool MyFetchName(Display *display, Window w, unsigned char **name) * find all windows below this and if name matches call doit on it */ static void -downtree(top) -Window top; +downtree(Window top) { Window *child, dummy; unsigned int children, i; @@ -190,7 +187,7 @@ Window top; for (i=0; i Date: Sun, 3 Jan 2010 20:59:07 +0100 Subject: build with custom Makefile, getting rid of imake --- Makefile | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..222a26c --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +CFLAGS ?= -Wall -O2 -g -Wstrict-prototypes -Wmissing-prototypes +LDFLAGS ?= -Wl,-z,defs +LIBRARIES = -lX11 + +all: xwit + +xwit: xwit.o ClientWin.o dsimple.o + gcc $(CFLAGS) $(LDFLAGS) $(LIBRARIES) -o $@ $^ + +%.o: %.c + gcc $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + +# Headers needed +dsimple.o: dsimple.h +xwit.o: dsimple.h ClientWin.h +ClientWin.o: ClientWin.h + +clean: + -rm xwit *.o + +install: xwit + install xwit $(DESTDIR)/usr/bin/ + debian/patches/0013-Incorrect-example-on-man-page.patch0000644000000000000000000000143112251573673017707 0ustar From 3e6f5d8a84da3212798372e2e8094ae9b8886e3d Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Sun, 3 Jan 2010 21:36:34 +0100 Subject: Incorrect example on man page --- xwit.man | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xwit.man b/xwit.man index 54f53e0..6760152 100644 --- a/xwit.man +++ b/xwit.man @@ -226,8 +226,8 @@ To interactively select an xterm, and resize it to 34 rows and 80 columns: To gently agitate your oclock on the screen: - while xwit \-rmove 0 10 \-name oclock - do xwit \-rmove 0 \-10 \-name oclock + while xwit \-rmove 0 10 \-names oclock + do xwit \-rmove 0 \-10 \-names oclock done .SH DIAGNOSTICS Exit status is 0 if any action is taken, 1 if no window matches the list debian/patches/0014-xwit-use-_NET_ACTIVE_WINDOW-to-implement-focus.patch0000644000000000000000000000573412251573673022463 0ustar From 4a3de94f9a30b269e2e7deaf6ee78052b373e5c5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 29 Jun 2009 19:13:23 +0200 Subject: xwit: use _NET_ACTIVE_WINDOW to implement focus Hi, here is a small patch to xwit. xwit -pop -focus does not work on recent window managers because -pop fails to bring up the window; it just marks it as requiring attention. These window managers add an event, _NET_ACTIVE_WINDOW, which can be used to do -pop *and* -focus together. This patch makes -focus use this event if available. I added it to -focus rather than -pop on the grounds that -pop was meant to raise the window without actually making it focused. I hope you will consider this patch for inclusion in Debian's xwit. Thanks! Paolo --- xwit.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 60 insertions(+), 2 deletions(-) diff --git a/xwit.c b/xwit.c index 955eae6..1f17e4c 100644 --- a/xwit.c +++ b/xwit.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "dsimple.h" #include "ClientWin.h" @@ -172,6 +173,40 @@ static Bool MyFetchName(Display *display, Window w, unsigned char **name) } } + +/* See if the given atom of the _NET_* family is supported on the + display. */ + +static Bool HasNetAtom(Display *dpy, Atom atom) +{ + static Atom *atoms; + static unsigned long n_atoms = -1; + int i; + + if (n_atoms == -1) { + Atom type; + int format; + unsigned long bytes_after; + + n_atoms = 0; + XGetWindowProperty (dpy, RootWindow (dpy, screen), + XInternAtom(dpy, "_NET_SUPPORTED", True), + 0, LONG_MAX, False, XA_ATOM, &type, &format, + &n_atoms, &bytes_after, (void *)&atoms); + + if (type != XA_ATOM) + return False; + } + + if (atoms == NULL) + return False; + + for (i = 0; i < n_atoms; i++) + if (atoms[i] == atom) + return True; + return False; +} + /* * find all windows below this and if name matches call doit on it */ @@ -555,9 +590,32 @@ doit(Window window) case pop: XMapRaised(dpy, window); break; - case focus: - XSetInputFocus(dpy, window, CurrentTime, RevertToNone); + case focus: { + static XClientMessageEvent event; + + if (event.type == 0) { + event.type = ClientMessage; + event.message_type = + XInternAtom(dpy, "_NET_ACTIVE_WINDOW", True); + event.format = 32; + event.data.l[0] = 1; + event.data.l[1] = CurrentTime; + } + + /* if no _NET_ACTIVE_WINDOW, the wm is oldschool... */ + if (event.message_type == 0 + || !HasNetAtom (dpy, event.message_type)) + XSetInputFocus(dpy, window, CurrentTime, RevertToNone); + else { + event.window = window; + event.data.l[2] = root; + if (XSendEvent(dpy, root, (Bool) False, + SubstructureRedirectMask, + (XEvent *) & event) == 0) + Fatal_Error("send event failed"); + } break; + } case raise: values.stack_mode = Above; value_mask = CWStackMode; debian/patches/0015-fix-as-needed-linking.patch0000644000000000000000000000122612251573673016277 0ustar From f24e229ffab562b49e5f6dbcfe149bb9f9ec35f4 Mon Sep 17 00:00:00 2001 From: Michael Bienia Date: Sun, 5 Dec 2010 17:34:00 +0100 Subject: fix as needed linking Move $(LIBRARIES) to the end of the linker call to fix linking with --as-needed. --- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index 222a26c..be9e3df 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ LIBRARIES = -lX11 all: xwit xwit: xwit.o ClientWin.o dsimple.o - gcc $(CFLAGS) $(LDFLAGS) $(LIBRARIES) -o $@ $^ + gcc $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBRARIES) %.o: %.c gcc $(CPPFLAGS) $(CFLAGS) -c -o $@ $< debian/patches/series0000644000000000000000000000121712251573673012046 0ustar 0001-debian-changes-from-xwit-3.4-2.patch 0002-Added-fetch-and-store-options-to-access-cutbuffers.patch 0003-Some-code-clean-up-to-get-rid-of-compilation-warning.patch 0004-Added-focus-option.patch 0005-fix-FTBFS-with-gcc-3.4.patch 0006-patch-to-add-a-few-more-window-operations.patch 0007-replace-dsimple.-with-newer-version.patch 0008-improve-manpage.patch 0009-correctly-escape-dashes-in-the-manpage.patch 0010-all-prop-print.patch 0011-some-code-cleanup.patch 0012-build-with-custom-Makefile-getting-rid-of-imake.patch 0013-Incorrect-example-on-man-page.patch 0014-xwit-use-_NET_ACTIVE_WINDOW-to-implement-focus.patch 0015-fix-as-needed-linking.patch debian/rules0000755000000000000000000000231512251573673010262 0ustar #!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) MAKEFLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) endif CFLAGS := $(shell dpkg-buildflags --get CFLAGS) CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes LDFLAGS += -Wl,-z,defs build: build-arch-stamp build-arch: build-arch-stamp build-indep: build-arch-stamp: dh_testdir $(MAKE) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' touch build-arch-stamp clean: dh_testdir dh_testroot rm -f build-arch-stamp build-indep-stamp $(MAKE) clean dh_clean binary-indep: build-indep # We have nothing to do. binary-arch: build-arch dh_testdir dh_testroot dh_prep dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/xwit dh_installchangelogs dh_installdocs dh_installexamples dh_installman xwit.man dh_link dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build build-arch build-indep clean binary-indep binary-arch binary debian/source/0000755000000000000000000000000012251573673010501 5ustar debian/source/format0000644000000000000000000000001412251573673011707 0ustar 3.0 (quilt) debian/watch0000644000000000000000000000013312251573673010227 0ustar # See uscan(1) for format version=2 http://ftp.x.org/contrib/utilities/xwit-(.*)\.tar\.gz