all repos — ryudo @ 496da4fe6e8652064de54cfda6282a795427bbe6

the floatiling window manager that flows; fork of rio from plan9port

add OPACITY, TRANSPARENTLIST config macros; add clang-format back to build script; update docs
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmGULbwACgkQO3+8IhRO
Y5i3OQ//ffF42f4sG9be2l59h2TF/esmKTtnuRrZF6MrcFXJi7Ewbl41YH+ZvTkF
HcdEPZXVJw+Y/dJR5UPxztWg9PKR3crotSkuJvZiMGxUbN5Aghj3q6+ajnUDkZi3
LTWy0kI2LSxT5weffbUVzlZSvp5z6DboRAW/NkIm2a9QdWCnaD/O1/2nEaq1sJQ/
l3ob5MuMa0+i7tDPwpr8wgvVXNdNdr9F7G7IhJNeM7czQqph8nigPTbZVcIomoW/
zSPo945fRVm4NOE1SRy4cbmyze0JdbS6nuAerYD+CKg4al8EIwrMRTG51UU2+8+g
jJORLDE1uRnJanlPHD+RpcrmAdwtdi3KM8+GmbcFzlH/bbDabgJ3XaiCzYbZzOR/
UNGAHSS+V/PUuCjiUrVTBdrm6mfGQwURlbVUSYDYZ4iAYsbvU3PlSJ/EyvrjBNOE
5hhCzoywXoDsTC0lcFeMXVJB54FcXMDZEiT6ywcs26RziaQxmMd51YSP29I3aQ4T
dY8gUWBbGY/9aw3Mwmy0xNRZQmwUkt10OxWZsldamb5j3sxY6fdicohyOtbEbkGZ
NMk6KFeUqcPh0wg5gzCEh3HCRskRN4YNJSvNJAWOIRisJgE386lIXNtC/JskDmKP
6dmBW2SFICANIGITBW0o6tzGH6tLnq3GEFJtiG8qnfoinf0n3g0=
=KwjW
-----END PGP SIGNATURE-----
commit

496da4fe6e8652064de54cfda6282a795427bbe6

parent

b23f229ca59b1225f6dba04e8195c64a617c05c6

M README.mdREADME.md

@@ -39,6 +39,7 @@ + Virtual Desk--: Super+Left

- Other new features customizable by `config.h`: + Show/hide 'Stick' Button3 menuitem + `AUTOSTICK` list of windows to spawn sticky by default and not focus (pseudo-panel/dock windows) + + `TRANSPARENTLIST` of window classes to be rendered with partial transparency (and corresponding OPACITY setting) + Optionally notify with `notify-send` which desktop is switched to (I use it with `dunst`) + Gaps for pseudo-tiling + Option to swap the keyboard shortcuts between "Snap Big Center" and "Snap Floating Center" (and the preferred behavior for terminals launched by keyboard)

@@ -61,7 +62,9 @@ to point to the proper location of your plan9port's `mkwsysrules.sh`.

### Bugs and Caveats Of the bugs and caveats not already mentioned in Rio's readme: -- Rendering of windows with RGBA surfaces is bound to RGB space (xshove and transset can be leveraged to get transparent terminals if you want it) + +- Rendering of windows with RGBA surfaces is bound to RGB space (ie, transparency cannot be set on a per-pixel level beyond a binary resolution) +- Switching back and forth between virtual desktops very quickly can cause some windows to glitch out, lose their parent, and become unfocusable (doesn't happen if switching just in one direction). - Multimonitor setups are treated like one giant monitor. This is on the short list. - Some applications that render fullscreen or dedicated OSD windows (Virtualbox, Zoom, etc) will need to be manually maximized to fix their alignment (in the former case) or otherwise misbehave. - Probably more!
M build.shbuild.sh

@@ -4,6 +4,8 @@ if [ ! -e config.h ]; then

cp config.def.h config.h fi +clang-format -i ./*.c ./*.h ./*/*.c ./*/*.h + mk clean mk o.rio
M client.cclient.c

@@ -337,6 +337,47 @@ return 0;

} #endif +#ifdef ALWAYSDRAW +int shouldalwaysdraw(Client* c) { + static char* alwaysdraw[] = ALWAYSDRAW; + char** a = alwaysdraw; + + while (*a) { + if (c && c->class && strstr(c->class, *a)) { + return 1; + } + ++a; + } + return 0; +} +#endif + +int isterminalwindow(Client* c) { + static char* termnames[] = TERMINALS; + char** t = termnames; + + while (*t) { + if (c && c->class && strstr(c->class, *t)) { + return 1; + } + ++t; + } + return 0; +} + +int istransparent(Client* c) { + static char* transnames[] = TRANSPARENTLIST; + char** t = transnames; + + while (*t) { + if (c && c->class && strstr(c->class, *t)) { + return 1; + } + ++t; + } + return 0; +} + void ensureactive() { if (!current) shuffle(0);
M config.def.hconfig.def.h

@@ -5,7 +5,7 @@

/*************** * LOOK & FEEL * [All of these are required options] **************/ - + /* Border colors */ #define SBORDERCOL 0x17736C #define BORDERCOL 0x000000

@@ -37,8 +37,26 @@ /* Selected menu colors */

#define SMENUFGCOL 0x000000 #define SMENUBGCOL 0x1F9B92 +/* You must use a compositor (eg xcompmgr, picom) for the next 2 settings + * to have any effect! + */ + +/* From 0 - 255, the opacity of windows marked 'transparent' */ + +#define OPACITY 217 + // clang-format off +/* Window classes marked 'transparent' */ + +#define TRANSPARENTLIST { \ + "Alacritty", \ + "kate", \ + "acme", \ + 0 \ +} + + /* List of fonts to try, in order, for rendering the menus. * Remember the backslash at the end of non-terminating lines! */

@@ -77,7 +95,7 @@ 0 \

} // clang-format on - + /************ * BEHAVIOR * [Everything in this section is optional unless otherwise noted] ***********/

@@ -163,12 +181,12 @@ * Mod3 = (1<<5)

* Mod4 = (1<<6) * Mod5 = (1<<7) */ - + #define SHORTCUTMOD Mod4Mask #define MODBITS (1 << 6) /* Shortcut keys */ - + #define MAX_KEY XK_m #define ICON_KEY XK_i #define UNHIDE_KEY XK_u
M dat.hdat.h

@@ -6,16 +6,16 @@ #endif

#define CORNER _corner #define INSET _inset #define MAXHIDDEN 128 -#if defined (SHOWMAX) && defined (SHOWSTICK) +#if defined(SHOWMAX) && defined(SHOWSTICK) #define B3FIXED 7 -#elif defined (SHOWMAX) || defined (SHOWSTICK) +#elif defined(SHOWMAX) || defined(SHOWSTICK) #define B3FIXED 6 #else #define B3FIXED 5 #endif #define NUMVIRTUALS 12 -#define AllButtonMask \ +#define AllButtonMask \ (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask) #define ButtonMask (ButtonPressMask | ButtonReleaseMask) #define MenuMask (ButtonMask | ButtonMotionMask | ExposureMask)
M event.cevent.c

@@ -283,6 +283,30 @@ c->screen = s;

if (c->parent == None) c->parent = c->screen->root; } + if (istransparent(c)) { + /* We need to set the atom on both the window and its parent */ + const Atom alpha_atom = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", 0); + unsigned long opacity = (unsigned long)OPACITY * 0x1010101; + XChangeProperty( + dpy, + c->window, + alpha_atom, + XA_CARDINAL, + 32, + PropModeReplace, + (unsigned char*)&opacity, + 1); + XChangeProperty( + dpy, + c->parent, + alpha_atom, + XA_CARDINAL, + 32, + PropModeReplace, + (unsigned char*)&opacity, + 1); + } + if (kbLaunch) { usleep(100000); #ifdef CENTERVMAX

@@ -529,7 +553,7 @@ return;

c = getclient(e->window, 0); if (c != 0 && c->window == e->window && c != current) { #ifdef AUTOSTICK - if (isautostick(c)) { + if (!isautostick(c)) { #endif /* someone grabbed keyboard or seized focus; make them current */ XMapRaised(dpy, c->parent);
M fns.hfns.h

@@ -9,8 +9,8 @@

#define setstate setstaterio /* color.c */ -unsigned long -colorpixel(Display*, ScreenInfo*, int, unsigned long, unsigned long); +unsigned long colorpixel( + Display*, ScreenInfo*, int, unsigned long, unsigned long); /* main.c */ void usage();

@@ -60,8 +60,6 @@ void setstate();

void setlabel(); void getproto(); void gettrans(); -int shouldalwaysdraw(Client* c); -int isterminalwindow(Client* c); /* key.c */ void keypress();

@@ -99,6 +97,9 @@ void dump_revert();

void dump_clients(); void shuffle(int); int isautostick(Client* c); +int istransparent(Client* c); +int shouldalwaysdraw(Client* c); +int isterminalwindow(Client* c); void ensureactive(); /* grab.c */
M install.shinstall.sh

@@ -22,7 +22,7 @@ chmod a+x /usr/bin/startryudo

chmod a+x ${PLAN9}/bin/ryudo echo "ryudo has been installed to '${PLAN9}/bin/';" - echo "xsession has been installed to '/usr/share/xsessions';" + echo "xsession has been installed to '/usr/share/xsessions/';" echo "startryudo script has been installed to '/usr/bin/';" echo "The manual pages have been installed to '${PLAN9}/man/'" fi
M main.cmain.c

@@ -224,14 +224,14 @@

for (i = 0; i < num_screens; i++) scanwins(&screens[i]); - #ifdef VIRTNOTIFY +#ifdef VIRTNOTIFY notify_init("ryudo"); - #endif +#endif keysetup(); mainloop(shape_event); - #ifdef VIRTNOTIFY +#ifdef VIRTNOTIFY notify_uninit(); - #endif +#endif return 0; }
M manage.cmanage.c

@@ -546,31 +546,3 @@ c->proto |= Plosefocus;

XFree((char*)p); } - -#ifdef ALWAYSDRAW -int shouldalwaysdraw(Client* c) { - static char* alwaysdraw[] = ALWAYSDRAW; - char** a = alwaysdraw; - - while (*a) { - if (c && c->class && strstr(c->class, *a)) { - return 1; - } - ++a; - } - return 0; -} -#endif - -int isterminalwindow(Client* c) { - static char* termnames[] = TERMINALS; - char** t = termnames; - - while (*t) { - if (c && c->class && strstr(c->class, *t)) { - return 1; - } - ++t; - } - return 0; -}
M ryudo.1ryudo.1

@@ -149,7 +149,7 @@ .P

Click events don\'t pass through when clicking to activate a window\. . .P -Clicking mouse button 3 on an inactive window brings up the Button 3 Menu instead of focusing the window\. I personally sometimes find this behavior useful\. +Clicking mouse button 2/3 on an inactive window brings up the Button 2/3 Menu instead of focusing the window\. I personally sometimes find this behavior useful\. . .P Programs that expect to run fullscreen will probably just open in a window the size of whatever resolution they expect to run at\. Depending on the implementation, they may respond well to being maximized or you may have to change your screen resolution manually before doing so\.

@@ -158,7 +158,7 @@ .P

Fullscreen Virtualbox VM windows are a strange outlier and start with their graphics offset\. Maximize the window after opening and it should be good\. . .P -There is no native support for compositing, but included is a shell script (\fBtranssetter\.sh\fR) which I use for translucent terminal and editor windows\. It works well and is decently lightweight\. +While there is naitive support for per\-window opacity via the \fBOPACITY\fR and \fBTRANSPARENTLIST\fR configuration macros, there is no support for per\-pixel opacity\. Programs that expect this behavior will render all pixels at the same opacity (unless using the \fBXSHAPE\fR extension for boolean opacity per\-pixel (eg, \fBxeyes\fR), which works\.) . .SH "AUTHORS" .
M ryudo.1.htmlryudo.1.html

@@ -162,19 +162,19 @@ <p>Multimonitor output is not currently supported -- the whole "screen" (collection of active monitors) is treated as one monitor, and keybinds and automatic window placement will not work properly.</p>

<p>Click events don't pass through when clicking to activate a window.</p> -<p>Clicking mouse button 3 on an inactive window brings up the Button 3 Menu instead of focusing the window. I personally sometimes find this behavior useful.</p> +<p>Clicking mouse button 2/3 on an inactive window brings up the Button 2/3 Menu instead of focusing the window. I personally sometimes find this behavior useful.</p> <p>Programs that expect to run fullscreen will probably just open in a window the size of whatever resolution they expect to run at. Depending on the implementation, they may respond well to being maximized or you may have to change your screen resolution manually before doing so.</p> <p>Fullscreen Virtualbox VM windows are a strange outlier and start with their graphics offset. Maximize the window after opening and it should be good.</p> -<p>There is no native support for compositing, but included is a shell script (<code>transsetter.sh</code>) which I use for translucent terminal and editor windows. It works well and is decently lightweight.</p> +<p>While there is naitive support for per-window opacity via the <code>OPACITY</code> and <code>TRANSPARENTLIST</code> configuration macros, there is no support for per-pixel opacity. Programs that expect this behavior will render all pixels at the same opacity (unless using the <code>XSHAPE</code> extension for boolean opacity per-pixel (eg, <code>xeyes</code>), which works.)</p> <h2 id="AUTHORS">AUTHORS</h2> <ul> -<li>Derek Stevens <a href="&#109;&#97;&#105;&#108;&#x74;&#111;&#x3a;&#x6e;&#x69;&#x6c;&#x69;&#120;&#64;&#x6e;&#x69;&#108;&#x66;&#109;&#x2e;&#99;&#x63;" data-bare-link="true">&#110;&#105;&#108;&#105;&#120;&#x40;&#x6e;&#x69;&#x6c;&#102;&#x6d;&#x2e;&#99;&#99;</a></li> -<li>Russ Cox <a href="&#109;&#x61;&#x69;&#x6c;&#116;&#111;&#58;&#114;&#115;&#99;&#x40;&#115;&#x77;&#x74;&#99;&#104;&#x2e;&#99;&#111;&#x6d;" data-bare-link="true">&#114;&#x73;&#99;&#x40;&#115;&#119;&#116;&#x63;&#x68;&#46;&#x63;&#111;&#x6d;</a></li> +<li>Derek Stevens <a href="&#x6d;&#x61;&#105;&#108;&#116;&#x6f;&#x3a;&#x6e;&#x69;&#x6c;&#105;&#x78;&#x40;&#110;&#105;&#108;&#x66;&#x6d;&#x2e;&#99;&#99;" data-bare-link="true">&#110;&#x69;&#x6c;&#x69;&#120;&#64;&#110;&#105;&#108;&#102;&#x6d;&#x2e;&#x63;&#x63;</a></li> +<li>Russ Cox <a href="&#109;&#97;&#105;&#x6c;&#x74;&#111;&#58;&#x72;&#x73;&#99;&#x40;&#x73;&#x77;&#x74;&#99;&#104;&#x2e;&#99;&#x6f;&#109;" data-bare-link="true">&#x72;&#x73;&#99;&#x40;&#x73;&#119;&#116;&#99;&#104;&#x2e;&#99;&#111;&#x6d;</a></li> <li>David Hogan, RIP</li> </ul>
M ryudo.1.mdryudo.1.md

@@ -83,13 +83,13 @@ Multimonitor output is not currently supported -- the whole "screen" (collection of active monitors) is treated as one monitor, and keybinds and automatic window placement will not work properly.

Click events don't pass through when clicking to activate a window. -Clicking mouse button 3 on an inactive window brings up the Button 3 Menu instead of focusing the window. I personally sometimes find this behavior useful. +Clicking mouse button 2/3 on an inactive window brings up the Button 2/3 Menu instead of focusing the window. I personally sometimes find this behavior useful. Programs that expect to run fullscreen will probably just open in a window the size of whatever resolution they expect to run at. Depending on the implementation, they may respond well to being maximized or you may have to change your screen resolution manually before doing so. Fullscreen Virtualbox VM windows are a strange outlier and start with their graphics offset. Maximize the window after opening and it should be good. -There is no native support for compositing, but included is a shell script (`transsetter.sh`) which I use for translucent terminal and editor windows. It works well and is decently lightweight. +While there is naitive support for per-window opacity via the `OPACITY` and `TRANSPARENTLIST` configuration macros, there is no support for per-pixel opacity. Programs that expect this behavior will render all pixels at the same opacity (unless using the `XSHAPE` extension for boolean opacity per-pixel (eg, `xeyes`), which works.) ## AUTHORS
M showevent/ShowEvent.cshowevent/ShowEvent.c

@@ -12,11 +12,14 @@ /* Returns the string equivalent of a boolean parameter */

static char* TorF(bool) int bool; { switch (bool) { - case True: return ("True"); + case True: + return ("True"); - case False: return ("False"); + case False: + return ("False"); - default: return ("?"); + default: + return ("?"); } }

@@ -24,11 +27,14 @@ /* Returns the string equivalent of a property notify state */

static char* PropertyState(state) int state; { switch (state) { - case PropertyNewValue: return ("PropertyNewValue"); + case PropertyNewValue: + return ("PropertyNewValue"); - case PropertyDelete: return ("PropertyDelete"); + case PropertyDelete: + return ("PropertyDelete"); - default: return ("?"); + default: + return ("?"); } }

@@ -36,13 +42,17 @@ /* Returns the string equivalent of a visibility notify state */

static char* VisibilityState(state) int state; { switch (state) { - case VisibilityUnobscured: return ("VisibilityUnobscured"); + case VisibilityUnobscured: + return ("VisibilityUnobscured"); - case VisibilityPartiallyObscured: return ("VisibilityPartiallyObscured"); + case VisibilityPartiallyObscured: + return ("VisibilityPartiallyObscured"); - case VisibilityFullyObscured: return ("VisibilityFullyObscured"); + case VisibilityFullyObscured: + return ("VisibilityFullyObscured"); - default: return ("?"); + default: + return ("?"); } }

@@ -157,11 +167,14 @@ /* Returns the string equivalent of a motion hint */

static char* IsHint(is_hint) char is_hint; { switch (is_hint) { - case NotifyNormal: return ("NotifyNormal"); + case NotifyNormal: + return ("NotifyNormal"); - case NotifyHint: return ("NotifyHint"); + case NotifyHint: + return ("NotifyHint"); - default: return ("?"); + default: + return ("?"); } }

@@ -182,11 +195,14 @@ /* Returns the string equivalent of a colormap state */

static char* ColormapState(state) int state; { switch (state) { - case ColormapInstalled: return ("ColormapInstalled"); + case ColormapInstalled: + return ("ColormapInstalled"); - case ColormapUninstalled: return ("ColormapUninstalled"); + case ColormapUninstalled: + return ("ColormapUninstalled"); - default: return ("?"); + default: + return ("?"); } }

@@ -194,17 +210,23 @@ /* Returns the string equivalent of a crossing detail */

static char* CrossingDetail(detail) int detail; { switch (detail) { - case NotifyAncestor: return ("NotifyAncestor"); + case NotifyAncestor: + return ("NotifyAncestor"); - case NotifyInferior: return ("NotifyInferior"); + case NotifyInferior: + return ("NotifyInferior"); - case NotifyVirtual: return ("NotifyVirtual"); + case NotifyVirtual: + return ("NotifyVirtual"); - case NotifyNonlinear: return ("NotifyNonlinear"); + case NotifyNonlinear: + return ("NotifyNonlinear"); - case NotifyNonlinearVirtual: return ("NotifyNonlinearVirtual"); + case NotifyNonlinearVirtual: + return ("NotifyNonlinearVirtual"); - default: return ("?"); + default: + return ("?"); } }

@@ -212,23 +234,32 @@ /* Returns the string equivalent of a focus change detail */

static char* FocusChangeDetail(detail) int detail; { switch (detail) { - case NotifyAncestor: return ("NotifyAncestor"); + case NotifyAncestor: + return ("NotifyAncestor"); - case NotifyInferior: return ("NotifyInferior"); + case NotifyInferior: + return ("NotifyInferior"); - case NotifyVirtual: return ("NotifyVirtual"); + case NotifyVirtual: + return ("NotifyVirtual"); - case NotifyNonlinear: return ("NotifyNonlinear"); + case NotifyNonlinear: + return ("NotifyNonlinear"); - case NotifyNonlinearVirtual: return ("NotifyNonlinearVirtual"); + case NotifyNonlinearVirtual: + return ("NotifyNonlinearVirtual"); - case NotifyPointer: return ("NotifyPointer"); + case NotifyPointer: + return ("NotifyPointer"); - case NotifyPointerRoot: return ("NotifyPointerRoot"); + case NotifyPointerRoot: + return ("NotifyPointerRoot"); - case NotifyDetailNone: return ("NotifyDetailNone"); + case NotifyDetailNone: + return ("NotifyDetailNone"); - default: return ("?"); + default: + return ("?"); } }

@@ -236,17 +267,23 @@ /* Returns the string equivalent of a configure detail */

static char* ConfigureDetail(detail) int detail; { switch (detail) { - case Above: return ("Above"); + case Above: + return ("Above"); - case Below: return ("Below"); + case Below: + return ("Below"); - case TopIf: return ("TopIf"); + case TopIf: + return ("TopIf"); - case BottomIf: return ("BottomIf"); + case BottomIf: + return ("BottomIf"); - case Opposite: return ("Opposite"); + case Opposite: + return ("Opposite"); - default: return ("?"); + default: + return ("?"); } }

@@ -254,15 +291,20 @@ /* Returns the string equivalent of a grab mode */

static char* GrabMode(mode) int mode; { switch (mode) { - case NotifyNormal: return ("NotifyNormal"); + case NotifyNormal: + return ("NotifyNormal"); - case NotifyGrab: return ("NotifyGrab"); + case NotifyGrab: + return ("NotifyGrab"); - case NotifyUngrab: return ("NotifyUngrab"); + case NotifyUngrab: + return ("NotifyUngrab"); - case NotifyWhileGrabbed: return ("NotifyWhileGrabbed"); + case NotifyWhileGrabbed: + return ("NotifyWhileGrabbed"); - default: return ("?"); + default: + return ("?"); } }

@@ -270,13 +312,17 @@ /* Returns the string equivalent of a mapping request */

static char* MappingRequest(request) int request; { switch (request) { - case MappingModifier: return ("MappingModifier"); + case MappingModifier: + return ("MappingModifier"); - case MappingKeyboard: return ("MappingKeyboard"); + case MappingKeyboard: + return ("MappingKeyboard"); - case MappingPointer: return ("MappingPointer"); + case MappingPointer: + return ("MappingPointer"); - default: return ("?"); + default: + return ("?"); } }

@@ -284,11 +330,14 @@ /* Returns the string equivalent of a stacking order place */

static char* Place(place) int place; { switch (place) { - case PlaceOnTop: return ("PlaceOnTop"); + case PlaceOnTop: + return ("PlaceOnTop"); - case PlaceOnBottom: return ("PlaceOnBottom"); + case PlaceOnBottom: + return ("PlaceOnBottom"); - default: return ("?"); + default: + return ("?"); } }

@@ -298,11 +347,15 @@ {

static char buffer[32]; switch (code) { - case X_CopyArea: return ("X_CopyArea"); + case X_CopyArea: + return ("X_CopyArea"); - case X_CopyPlane: return ("X_CopyPlane"); + case X_CopyPlane: + return ("X_CopyPlane"); - default: sprintf(buffer, "0x%x", code); return (buffer); + default: + sprintf(buffer, "0x%x", code); + return (buffer); } }

@@ -330,12 +383,12 @@ return (buffer);

} /* Returns the string equivalent of an atom or "None"*/ -static char* -AtomName(Display* dpy, Atom atom) { +static char* AtomName(Display* dpy, Atom atom) { static char buffer[256]; char* atom_name; - if (atom == None) return ("None"); + if (atom == None) + return ("None"); atom_name = XGetAtomName(dpy, atom); strncpy(buffer, atom_name, 256);

@@ -347,8 +400,7 @@ /******************************************************************************/

/**** Routines to print out readable values for the field of various events ***/ /******************************************************************************/ -static void -VerbMotion(XMotionEvent* ev) { +static void VerbMotion(XMotionEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("root=0x%x%s", (unsigned)ev->root, sep); printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);

@@ -360,8 +412,7 @@ printf("is_hint=%s%s", IsHint(ev->is_hint), sep);

printf("same_screen=%s\n", TorF(ev->same_screen)); } -static void -VerbButton(XButtonEvent* ev) { +static void VerbButton(XButtonEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("root=0x%x%s", (unsigned)ev->root, sep); printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);

@@ -373,16 +424,14 @@ printf("button=%s%s", ButtonAndOrModifierState(ev->button), sep);

printf("same_screen=%s\n", TorF(ev->same_screen)); } -static void -VerbColormap(XColormapEvent* ev) { +static void VerbColormap(XColormapEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("colormap=%s%s", MaybeNone(ev->colormap), sep); printf("new=%s%s", TorF(ev->new), sep); printf("state=%s\n", ColormapState(ev->state)); } -static void -VerbCrossing(XCrossingEvent* ev) { +static void VerbCrossing(XCrossingEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("root=0x%x%s", (unsigned)ev->root, sep); printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);

@@ -396,16 +445,14 @@ printf("focus=%s%s", TorF(ev->focus), sep);

printf("state=%s\n", ButtonAndOrModifierState(ev->state)); } -static void -VerbExpose(XExposeEvent* ev) { +static void VerbExpose(XExposeEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("x=%d y=%d%s", ev->x, ev->y, sep); printf("width=%d height=%d%s", ev->width, ev->height, sep); printf("count=%d\n", ev->count); } -static void -VerbGraphicsExpose(XGraphicsExposeEvent* ev) { +static void VerbGraphicsExpose(XGraphicsExposeEvent* ev) { printf("drawable=0x%x%s", (unsigned)ev->drawable, sep); printf("x=%d y=%d%s", ev->x, ev->y, sep); printf("width=%d height=%d%s", ev->width, ev->height, sep);

@@ -413,32 +460,29 @@ printf("major_code=%s%s", MajorCode(ev->major_code), sep);

printf("minor_code=%d\n", ev->minor_code); } -static void -VerbNoExpose(XNoExposeEvent* ev) { +static void VerbNoExpose(XNoExposeEvent* ev) { printf("drawable=0x%x%s", (unsigned)ev->drawable, sep); printf("major_code=%s%s", MajorCode(ev->major_code), sep); printf("minor_code=%d\n", ev->minor_code); } -static void -VerbFocus(XFocusChangeEvent* ev) { +static void VerbFocus(XFocusChangeEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("mode=%s%s", GrabMode(ev->mode), sep); printf("detail=%s\n", FocusChangeDetail(ev->detail)); } -static void -VerbKeymap(XKeymapEvent* ev) { +static void VerbKeymap(XKeymapEvent* ev) { int i; printf("window=0x%x%s", (unsigned)ev->window, sep); printf("key_vector="); - for (i = 0; i < 32; i++) printf("%02x", ev->key_vector[i]); + for (i = 0; i < 32; i++) + printf("%02x", ev->key_vector[i]); printf("\n"); } -static void -VerbKey(XKeyEvent* ev) { +static void VerbKey(XKeyEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("root=0x%x%s", (unsigned)ev->root, sep); printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);

@@ -450,29 +494,25 @@ printf("keycode=%s%s", Keycode(ev), sep);

printf("same_screen=%s\n", TorF(ev->same_screen)); } -static void -VerbProperty(XPropertyEvent* ev) { +static void VerbProperty(XPropertyEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("atom=%s%s", AtomName(ev->display, ev->atom), sep); printf("time=%s%s", ServerTime(ev->time), sep); printf("state=%s\n", PropertyState(ev->state)); } -static void -VerbResizeRequest(XResizeRequestEvent* ev) { +static void VerbResizeRequest(XResizeRequestEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("width=%d height=%d\n", ev->width, ev->height); } -static void -VerbCirculate(XCirculateEvent* ev) { +static void VerbCirculate(XCirculateEvent* ev) { printf("event=0x%x%s", (unsigned)ev->event, sep); printf("window=0x%x%s", (unsigned)ev->window, sep); printf("place=%s\n", Place(ev->place)); } -static void -VerbConfigure(XConfigureEvent* ev) { +static void VerbConfigure(XConfigureEvent* ev) { printf("event=0x%x%s", (unsigned)ev->event, sep); printf("window=0x%x%s", (unsigned)ev->window, sep); printf("x=%d y=%d%s", ev->x, ev->y, sep);

@@ -482,8 +522,7 @@ printf("above=%s%s", MaybeNone(ev->above), sep);

printf("override_redirect=%s\n", TorF(ev->override_redirect)); } -static void -VerbCreateWindow(XCreateWindowEvent* ev) { +static void VerbCreateWindow(XCreateWindowEvent* ev) { printf("parent=0x%x%s", (unsigned)ev->parent, sep); printf("window=0x%x%s", (unsigned)ev->window, sep); printf("x=%d y=%d%s", ev->x, ev->y, sep);

@@ -492,28 +531,24 @@ printf("border_width=%d%s", ev->border_width, sep);

printf("override_redirect=%s\n", TorF(ev->override_redirect)); } -static void -VerbDestroyWindow(XDestroyWindowEvent* ev) { +static void VerbDestroyWindow(XDestroyWindowEvent* ev) { printf("event=0x%x%s", (unsigned)ev->event, sep); printf("window=0x%x\n", (unsigned)ev->window); } -static void -VerbGravity(XGravityEvent* ev) { +static void VerbGravity(XGravityEvent* ev) { printf("event=0x%x%s", (unsigned)ev->event, sep); printf("window=0x%x%s", (unsigned)ev->window, sep); printf("x=%d y=%d\n", ev->x, ev->y); } -static void -VerbMap(XMapEvent* ev) { +static void VerbMap(XMapEvent* ev) { printf("event=0x%x%s", (unsigned)ev->event, sep); printf("window=0x%x%s", (unsigned)ev->window, sep); printf("override_redirect=%s\n", TorF(ev->override_redirect)); } -static void -VerbReparent(XReparentEvent* ev) { +static void VerbReparent(XReparentEvent* ev) { printf("event=0x%x%s", (unsigned)ev->event, sep); printf("window=0x%x%s", (unsigned)ev->window, sep); printf("parent=0x%x%s", (unsigned)ev->parent, sep);

@@ -521,22 +556,19 @@ printf("x=%d y=%d%s", ev->x, ev->y, sep);

printf("override_redirect=%s\n", TorF(ev->override_redirect)); } -static void -VerbUnmap(XUnmapEvent* ev) { +static void VerbUnmap(XUnmapEvent* ev) { printf("event=0x%x%s", (unsigned)ev->event, sep); printf("window=0x%x%s", (unsigned)ev->window, sep); printf("from_configure=%s\n", TorF(ev->from_configure)); } -static void -VerbCirculateRequest(XCirculateRequestEvent* ev) { +static void VerbCirculateRequest(XCirculateRequestEvent* ev) { printf("parent=0x%x%s", (unsigned)ev->parent, sep); printf("window=0x%x%s", (unsigned)ev->window, sep); printf("place=%s\n", Place(ev->place)); } -static void -VerbConfigureRequest(XConfigureRequestEvent* ev) { +static void VerbConfigureRequest(XConfigureRequestEvent* ev) { printf("parent=0x%x%s", (unsigned)ev->parent, sep); printf("window=0x%x%s", (unsigned)ev->window, sep); printf("x=%d y=%d%s", ev->x, ev->y, sep);

@@ -547,41 +579,37 @@ printf("detail=%s%s", ConfigureDetail(ev->detail), sep);

printf("value_mask=%s\n", ConfigureValueMask(ev->value_mask)); } -static void -VerbMapRequest(XMapRequestEvent* ev) { +static void VerbMapRequest(XMapRequestEvent* ev) { printf("parent=0x%x%s", (unsigned)ev->parent, sep); printf("window=0x%x\n", (unsigned)ev->window); } -static void -VerbClient(XClientMessageEvent* ev) { +static void VerbClient(XClientMessageEvent* ev) { int i; printf("window=0x%x%s", (unsigned)ev->window, sep); printf("message_type=%s%s", AtomName(ev->display, ev->message_type), sep); printf("format=%d\n", ev->format); printf("data (shown as longs)="); - for (i = 0; i < 5; i++) printf(" 0x%08lx", ev->data.l[i]); + for (i = 0; i < 5; i++) + printf(" 0x%08lx", ev->data.l[i]); printf("\n"); } -static void -VerbMapping(XMappingEvent* ev) { +static void VerbMapping(XMappingEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("request=%s%s", MappingRequest(ev->request), sep); printf("first_keycode=0x%x%s", ev->first_keycode, sep); printf("count=0x%x\n", ev->count); } -static void -VerbSelectionClear(XSelectionClearEvent* ev) { +static void VerbSelectionClear(XSelectionClearEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("selection=%s%s", AtomName(ev->display, ev->selection), sep); printf("time=%s\n", ServerTime(ev->time)); } -static void -VerbSelection(XSelectionEvent* ev) { +static void VerbSelection(XSelectionEvent* ev) { printf("requestor=0x%x%s", (unsigned)ev->requestor, sep); printf("selection=%s%s", AtomName(ev->display, ev->selection), sep); printf("target=%s%s", AtomName(ev->display, ev->target), sep);

@@ -589,8 +617,7 @@ printf("property=%s%s", AtomName(ev->display, ev->property), sep);

printf("time=%s\n", ServerTime(ev->time)); } -static void -VerbSelectionRequest(XSelectionRequestEvent* ev) { +static void VerbSelectionRequest(XSelectionRequestEvent* ev) { printf("owner=0x%x%s", (unsigned)ev->owner, sep); printf("requestor=0x%x%s", (unsigned)ev->requestor, sep); printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);

@@ -599,8 +626,7 @@ printf("property=%s%s", AtomName(ev->display, ev->property), sep);

printf("time=%s\n", ServerTime(ev->time)); } -static void -VerbVisibility(XVisibilityEvent* ev) { +static void VerbVisibility(XVisibilityEvent* ev) { printf("window=0x%x%s", (unsigned)ev->window, sep); printf("state=%s\n", VisibilityState(ev->state)); }

@@ -612,39 +638,72 @@

char* GetType(ev) XEvent* ev; { switch (ev->type) { - case KeyPress: return ("KeyPress"); - case KeyRelease: return ("KeyRelease"); - case ButtonPress: return ("ButtonPress"); - case ButtonRelease: return ("ButtonRelease"); - case MotionNotify: return ("MotionNotify"); - case EnterNotify: return ("EnterNotify"); - case LeaveNotify: return ("LeaveNotify"); - case FocusIn: return ("FocusIn"); - case FocusOut: return ("FocusOut"); - case KeymapNotify: return ("KeymapNotify"); - case Expose: return ("Expose"); - case GraphicsExpose: return ("GraphicsExpose"); - case NoExpose: return ("NoExpose"); - case VisibilityNotify: return ("VisibilityNotify"); - case CreateNotify: return ("CreateNotify"); - case DestroyNotify: return ("DestroyNotify"); - case UnmapNotify: return ("UnmapNotify"); - case MapNotify: return ("MapNotify"); - case MapRequest: return ("MapRequest"); - case ReparentNotify: return ("ReparentNotify"); - case ConfigureNotify: return ("ConfigureNotify"); - case ConfigureRequest: return ("ConfigureRequest"); - case GravityNotify: return ("GravityNotify"); - case ResizeRequest: return ("ResizeRequest"); - case CirculateNotify: return ("CirculateNotify"); - case CirculateRequest: return ("CirculateRequest"); - case PropertyNotify: return ("PropertyNotify"); - case SelectionClear: return ("SelectionClear"); - case SelectionRequest: return ("SelectionRequest"); - case SelectionNotify: return ("SelectionNotify"); - case ColormapNotify: return ("ColormapNotify"); - case ClientMessage: return ("ClientMessage"); - case MappingNotify: return ("MappingNotify"); + case KeyPress: + return ("KeyPress"); + case KeyRelease: + return ("KeyRelease"); + case ButtonPress: + return ("ButtonPress"); + case ButtonRelease: + return ("ButtonRelease"); + case MotionNotify: + return ("MotionNotify"); + case EnterNotify: + return ("EnterNotify"); + case LeaveNotify: + return ("LeaveNotify"); + case FocusIn: + return ("FocusIn"); + case FocusOut: + return ("FocusOut"); + case KeymapNotify: + return ("KeymapNotify"); + case Expose: + return ("Expose"); + case GraphicsExpose: + return ("GraphicsExpose"); + case NoExpose: + return ("NoExpose"); + case VisibilityNotify: + return ("VisibilityNotify"); + case CreateNotify: + return ("CreateNotify"); + case DestroyNotify: + return ("DestroyNotify"); + case UnmapNotify: + return ("UnmapNotify"); + case MapNotify: + return ("MapNotify"); + case MapRequest: + return ("MapRequest"); + case ReparentNotify: + return ("ReparentNotify"); + case ConfigureNotify: + return ("ConfigureNotify"); + case ConfigureRequest: + return ("ConfigureRequest"); + case GravityNotify: + return ("GravityNotify"); + case ResizeRequest: + return ("ResizeRequest"); + case CirculateNotify: + return ("CirculateNotify"); + case CirculateRequest: + return ("CirculateRequest"); + case PropertyNotify: + return ("PropertyNotify"); + case SelectionClear: + return ("SelectionClear"); + case SelectionRequest: + return ("SelectionRequest"); + case SelectionNotify: + return ("SelectionNotify"); + case ColormapNotify: + return ("ColormapNotify"); + case ClientMessage: + return ("ClientMessage"); + case MappingNotify: + return ("MappingNotify"); } return "???"; }

@@ -653,8 +712,7 @@ /******************************************************************************/

/**************** Print the values of all fields for any event ****************/ /******************************************************************************/ -void -ShowEvent(XEvent* eev) { +void ShowEvent(XEvent* eev) { XAnyEvent* ev = (XAnyEvent*)eev; /* determine which field separator to use */ if (use_separate_lines)

@@ -668,66 +726,124 @@ printf("send_event=%s%s", TorF(ev->send_event), sep);

printf("display=0x%p%s", ev->display, sep); switch (ev->type) { - case MotionNotify: VerbMotion((void*)ev); break; + case MotionNotify: + VerbMotion((void*)ev); + break; case ButtonPress: - case ButtonRelease: VerbButton((void*)ev); break; + case ButtonRelease: + VerbButton((void*)ev); + break; - case ColormapNotify: VerbColormap((void*)ev); break; + case ColormapNotify: + VerbColormap((void*)ev); + break; case EnterNotify: - case LeaveNotify: VerbCrossing((void*)ev); break; + case LeaveNotify: + VerbCrossing((void*)ev); + break; - case Expose: VerbExpose((void*)ev); break; + case Expose: + VerbExpose((void*)ev); + break; - case GraphicsExpose: VerbGraphicsExpose((void*)ev); break; + case GraphicsExpose: + VerbGraphicsExpose((void*)ev); + break; - case NoExpose: VerbNoExpose((void*)ev); break; + case NoExpose: + VerbNoExpose((void*)ev); + break; case FocusIn: - case FocusOut: VerbFocus((void*)ev); break; + case FocusOut: + VerbFocus((void*)ev); + break; - case KeymapNotify: VerbKeymap((void*)ev); break; + case KeymapNotify: + VerbKeymap((void*)ev); + break; case KeyPress: - case KeyRelease: VerbKey((void*)ev); break; + case KeyRelease: + VerbKey((void*)ev); + break; - case PropertyNotify: VerbProperty((void*)ev); break; + case PropertyNotify: + VerbProperty((void*)ev); + break; - case ResizeRequest: VerbResizeRequest((void*)ev); break; + case ResizeRequest: + VerbResizeRequest((void*)ev); + break; - case CirculateNotify: VerbCirculate((void*)ev); break; + case CirculateNotify: + VerbCirculate((void*)ev); + break; - case ConfigureNotify: VerbConfigure((void*)ev); break; + case ConfigureNotify: + VerbConfigure((void*)ev); + break; - case CreateNotify: VerbCreateWindow((void*)ev); break; + case CreateNotify: + VerbCreateWindow((void*)ev); + break; - case DestroyNotify: VerbDestroyWindow((void*)ev); break; + case DestroyNotify: + VerbDestroyWindow((void*)ev); + break; - case GravityNotify: VerbGravity((void*)ev); break; + case GravityNotify: + VerbGravity((void*)ev); + break; - case MapNotify: VerbMap((void*)ev); break; + case MapNotify: + VerbMap((void*)ev); + break; - case ReparentNotify: VerbReparent((void*)ev); break; + case ReparentNotify: + VerbReparent((void*)ev); + break; - case UnmapNotify: VerbUnmap((void*)ev); break; + case UnmapNotify: + VerbUnmap((void*)ev); + break; - case CirculateRequest: VerbCirculateRequest((void*)ev); break; + case CirculateRequest: + VerbCirculateRequest((void*)ev); + break; - case ConfigureRequest: VerbConfigureRequest((void*)ev); break; + case ConfigureRequest: + VerbConfigureRequest((void*)ev); + break; - case MapRequest: VerbMapRequest((void*)ev); break; + case MapRequest: + VerbMapRequest((void*)ev); + break; - case ClientMessage: VerbClient((void*)ev); break; + case ClientMessage: + VerbClient((void*)ev); + break; - case MappingNotify: VerbMapping((void*)ev); break; + case MappingNotify: + VerbMapping((void*)ev); + break; - case SelectionClear: VerbSelectionClear((void*)ev); break; + case SelectionClear: + VerbSelectionClear((void*)ev); + break; - case SelectionNotify: VerbSelection((void*)ev); break; + case SelectionNotify: + VerbSelection((void*)ev); + break; - case SelectionRequest: VerbSelectionRequest((void*)ev); break; + case SelectionRequest: + VerbSelectionRequest((void*)ev); + break; - case VisibilityNotify: VerbVisibility((void*)ev); break; + case VisibilityNotify: + VerbVisibility((void*)ev); + break; } }