changeset 67:f61c6af3f9d8

colormap.c, globals.c, windowinfo.c: clang-format
author ng0@n0.is
date Fri, 03 May 2019 21:20:54 +0000
parents f8739845bfb0
children c94a45230654
files colormap.c globals.c windowinfo.c
diffstat 3 files changed, 669 insertions(+), 655 deletions(-) [+]
line wrap: on
line diff
--- a/colormap.c	Fri May 03 21:20:25 2019 +0000
+++ b/colormap.c	Fri May 03 21:20:54 2019 +0000
@@ -20,351 +20,378 @@
 #include <stdbool.h>
 #include "uwm.h"
 
-static void installColormap (Colormap colormap);
+static void
+installColormap (Colormap colormap);
 
-bool	focusPointerRoot;
+bool focusPointerRoot;
 
 Window
 getMouse ()
 {
-	Window root, child;
-	int root_x, root_y, x, y;
-	unsigned int mask;
+        Window root, child;
+        int root_x, root_y, x, y;
+        unsigned int mask;
 
-	XQueryPointer (dpy, RootWindow (dpy, scr), &root, &child, &root_x, &root_y, &x, &y, &mask);
-	return child ? child : root;
+        XQueryPointer (dpy,
+                       RootWindow (dpy, scr),
+                       &root,
+                       &child,
+                       &root_x,
+                       &root_y,
+                       &x,
+                       &y,
+                       &mask);
+        return child ? child : root;
 }
 
 initColormap ()
 {
-	Colormap	*colormaps;
-	int		ncolormaps;
-	int		i;
-	extern int	initColormapTrack (), colormapTrack ();
-	
-	colormaps = XListInstalledColormaps (dpy, RootWindow (dpy, scr), &ncolormaps);
-	for (i = 0; i < ncolormaps; i++)
-		noteInstalledColormap (colormaps[i]);
-	expressWindowInterest (initColormapTrack, colormapTrack);
-	focusPointerRoot = TRUE;
+        Colormap *colormaps;
+        int ncolormaps;
+        int i;
+        extern int initColormapTrack (), colormapTrack ();
+
+        colormaps =
+          XListInstalledColormaps (dpy, RootWindow (dpy, scr), &ncolormaps);
+        for (i = 0; i < ncolormaps; i++)
+                noteInstalledColormap (colormaps[i]);
+        expressWindowInterest (initColormapTrack, colormapTrack);
+        focusPointerRoot = TRUE;
 }
 
-initColormapTrack (wi, wa)
-	WindowInfo		*wi;
-	XWindowAttributes	*wa;
+initColormapTrack (wi, wa) WindowInfo *wi;
+XWindowAttributes *wa;
 {
-	if (wa)
-	{
-		wi->colormap = wa->colormap;
-		wi->event_mask |= EnterWindowMask|LeaveWindowMask|ColormapChangeMask|FocusChangeMask;
-		wi->in_window = FALSE;
-		noteWindowAttached (wi->window, wi->colormap);
-		if (getMouse () == wi->window)
-		{
-			wi->in_window = TRUE;
-			installColormap (wi->colormap);
-		}
-	}
-	else
-	{
-		wi->event_mask &= ~EnterWindowMask|LeaveWindowMask|ColormapChangeMask|FocusChangeMask;
-		if (wi->in_window)
-			uninstallColormap (wi->colormap);
-		noteWindowUnattached (wi->window, wi->colormap);
-	}
+        if (wa)
+        {
+                wi->colormap = wa->colormap;
+                wi->event_mask |= EnterWindowMask | LeaveWindowMask |
+                                  ColormapChangeMask | FocusChangeMask;
+                wi->in_window = FALSE;
+                noteWindowAttached (wi->window, wi->colormap);
+                if (getMouse () == wi->window)
+                {
+                        wi->in_window = TRUE;
+                        installColormap (wi->colormap);
+                }
+        }
+        else
+        {
+                wi->event_mask &= ~EnterWindowMask | LeaveWindowMask |
+                                  ColormapChangeMask | FocusChangeMask;
+                if (wi->in_window)
+                        uninstallColormap (wi->colormap);
+                noteWindowUnattached (wi->window, wi->colormap);
+        }
 }
 
-colormapTrack (wi, ev)
-	WindowInfo	*wi;
-	XAnyEvent	*ev;
+colormapTrack (wi, ev) WindowInfo *wi;
+XAnyEvent *ev;
 {
-	XColormapEvent	*cev;
-	XCrossingEvent	*eev;
-	XFocusChangeEvent	*fev;
+        XColormapEvent *cev;
+        XCrossingEvent *eev;
+        XFocusChangeEvent *fev;
 
-	switch (ev->type)
-	{
-	case ColormapNotify:
-		cev = (XColormapEvent *) ev;
-		switch (cev->state)
-		{
-		case ColormapInstalled:
-			noteInstalledColormap (cev->colormap);
-			break;
-		case ColormapUninstalled:
-			noteUninstalledColormap (cev->colormap);
-			break;
-		}
-		if (cev->new)
-		{
-			if (wi->in_window)
-			{
+        switch (ev->type)
+        {
+        case ColormapNotify:
+                cev = (XColormapEvent *) ev;
+                switch (cev->state)
+                {
+                case ColormapInstalled:
+                        noteInstalledColormap (cev->colormap);
+                        break;
+                case ColormapUninstalled:
+                        noteUninstalledColormap (cev->colormap);
+                        break;
+                }
+                if (cev->new)
+                {
+                        if (wi->in_window)
+                        {
 #ifdef DEBUG
-				printf ("reset colormap ");
+                                printf ("reset colormap ");
 #endif /* DEBUG */
-				uninstallColormap (wi->colormap);
-				wi->colormap = cev->colormap;
+                                uninstallColormap (wi->colormap);
+                                wi->colormap = cev->colormap;
 #ifdef DEBUG
-				printf ("reset colormap ");
+                                printf ("reset colormap ");
 #endif /* DEBUG */
-				installColormap (wi->colormap);
-			}
-			else
-				wi->colormap = cev->colormap;
-		}
-		break;
-	case FocusIn:
-		fev = (XFocusChangeEvent *) ev;
-		switch (fev->detail)
-		{
-		case NotifyInferior:	/* might be root */
-			if (fev->window != RootWindow (dpy, scr))
-				break;
-			goto focusIn;
-		case NotifyNonlinearVirtual:	/* don't want root */
-			if (fev->window == RootWindow (dpy, scr))
-				break;
-		case NotifyNonlinear:	/* might be root */
-		case NotifyVirtual:	/* can't be root */
-		case NotifyAncestor:
-		case NotifyPointer:
-		focusIn:
-			if (fev->window == RootWindow (dpy, scr))
-				focusPointerRoot = TRUE;
+                                installColormap (wi->colormap);
+                        }
+                        else
+                                wi->colormap = cev->colormap;
+                }
+                break;
+        case FocusIn:
+                fev = (XFocusChangeEvent *) ev;
+                switch (fev->detail)
+                {
+                case NotifyInferior: /* might be root */
+                        if (fev->window != RootWindow (dpy, scr))
+                                break;
+                        goto focusIn;
+                case NotifyNonlinearVirtual: /* don't want root */
+                        if (fev->window == RootWindow (dpy, scr))
+                                break;
+                case NotifyNonlinear: /* might be root */
+                case NotifyVirtual: /* can't be root */
+                case NotifyAncestor:
+                case NotifyPointer:
+                focusIn:
+                        if (fev->window == RootWindow (dpy, scr))
+                                focusPointerRoot = TRUE;
 #ifdef DEBUG
-			printf ("FocusIn ");
+                        printf ("FocusIn ");
 #endif /* DEBUG */
-			wi->in_window = TRUE;
-			installColormap (wi->colormap);
-			break;
-		case NotifyPointerRoot:
-			focusPointerRoot = TRUE;
-			break;
-		case NotifyDetailNone:
-			XSetInputFocus (dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
-			break;
-		}
-		break;
-	case FocusOut:
-		fev = (XFocusChangeEvent *) ev;
-		switch (fev->detail)
-		{
-		case NotifyInferior:	/* might be root */
-			if (fev->window != RootWindow (dpy, scr))
-				break;
-		case NotifyNonlinearVirtual:	/* don't want root */
-		case NotifyNonlinear:	/* might be root */
-		case NotifyVirtual:	/* can't be root */
-		case NotifyAncestor:
-		case NotifyPointer:
-			if (fev->window == RootWindow (dpy, scr))
-				focusPointerRoot = FALSE;
+                        wi->in_window = TRUE;
+                        installColormap (wi->colormap);
+                        break;
+                case NotifyPointerRoot:
+                        focusPointerRoot = TRUE;
+                        break;
+                case NotifyDetailNone:
+                        XSetInputFocus (dpy,
+                                        PointerRoot,
+                                        RevertToPointerRoot,
+                                        CurrentTime);
+                        break;
+                }
+                break;
+        case FocusOut:
+                fev = (XFocusChangeEvent *) ev;
+                switch (fev->detail)
+                {
+                case NotifyInferior: /* might be root */
+                        if (fev->window != RootWindow (dpy, scr))
+                                break;
+                case NotifyNonlinearVirtual: /* don't want root */
+                case NotifyNonlinear: /* might be root */
+                case NotifyVirtual: /* can't be root */
+                case NotifyAncestor:
+                case NotifyPointer:
+                        if (fev->window == RootWindow (dpy, scr))
+                                focusPointerRoot = FALSE;
 #ifdef DEBUG
-			printf ("FocusOut %x %d ", fev->window, fev->detail);
+                        printf ("FocusOut %x %d ", fev->window, fev->detail);
 #endif /* DEBUG */
-			wi->in_window = FALSE;
-			uninstallColormap (wi->colormap);
-			break;
-		case NotifyPointerRoot:
-			focusPointerRoot = FALSE;
-			break;
-		case NotifyDetailNone:
-			break;
-		}
-		break;
-		/*
-		 * simulate focusin/focusout events in pointer root mode
-		 */
-	case EnterNotify:
-		eev = (XCrossingEvent *) ev;
-		if (eev->mode != NotifyGrab && focusPointerRoot)
-		{
-			switch (eev->detail) {
-			case NotifyInferior:
-				if (eev->window != RootWindow (dpy, scr))
-					break;
-				goto enter;
-			case NotifyNonlinearVirtual:
-				if (eev->window == RootWindow (dpy, scr))
-					break;
-			case NotifyVirtual:
-			case NotifyAncestor:
-			case NotifyNonlinear:
-			enter:
-				wi->in_window = TRUE;
+                        wi->in_window = FALSE;
+                        uninstallColormap (wi->colormap);
+                        break;
+                case NotifyPointerRoot:
+                        focusPointerRoot = FALSE;
+                        break;
+                case NotifyDetailNone:
+                        break;
+                }
+                break;
+                /*
+                 * simulate focusin/focusout events in pointer root mode
+                 */
+        case EnterNotify:
+                eev = (XCrossingEvent *) ev;
+                if (eev->mode != NotifyGrab && focusPointerRoot)
+                {
+                        switch (eev->detail)
+                        {
+                        case NotifyInferior:
+                                if (eev->window != RootWindow (dpy, scr))
+                                        break;
+                                goto enter;
+                        case NotifyNonlinearVirtual:
+                                if (eev->window == RootWindow (dpy, scr))
+                                        break;
+                        case NotifyVirtual:
+                        case NotifyAncestor:
+                        case NotifyNonlinear:
+                        enter:
+                                wi->in_window = TRUE;
 #ifdef DEBUG
-				printf ("EnterNotify %6x %2d ", eev->window, eev->detail);
+                                printf ("EnterNotify %6x %2d ",
+                                        eev->window,
+                                        eev->detail);
 #endif /* DEBUG */
-				installColormap (wi->colormap);
-			}
-		}
-		break;
-	case LeaveNotify:
-		eev = (XCrossingEvent *) ev;
-		if (eev->mode != NotifyGrab && focusPointerRoot) {
-			switch (eev->detail) {
-			case NotifyInferior:
-				if (eev->window != RootWindow (dpy, scr))
-					break;
-			case NotifyNonlinearVirtual:
-			case NotifyVirtual:
-			case NotifyAncestor:
-			case NotifyNonlinear:
-				wi->in_window = FALSE;
+                                installColormap (wi->colormap);
+                        }
+                }
+                break;
+        case LeaveNotify:
+                eev = (XCrossingEvent *) ev;
+                if (eev->mode != NotifyGrab && focusPointerRoot)
+                {
+                        switch (eev->detail)
+                        {
+                        case NotifyInferior:
+                                if (eev->window != RootWindow (dpy, scr))
+                                        break;
+                        case NotifyNonlinearVirtual:
+                        case NotifyVirtual:
+                        case NotifyAncestor:
+                        case NotifyNonlinear:
+                                wi->in_window = FALSE;
 #ifdef DEBUG
-				printf ("LeaveNotify %6x %2d ", eev->window, eev->detail);
+                                printf ("LeaveNotify %6x %2d ",
+                                        eev->window,
+                                        eev->detail);
 #endif /* DEBUG */
-				uninstallColormap (wi->colormap);
-				break;
-			}
-		}
-		break;
-	}
+                                uninstallColormap (wi->colormap);
+                                break;
+                        }
+                }
+                break;
+        }
 }
 
-struct colormapInfo {
-	struct colormapInfo	*next;
-	Colormap		colormap;
-	int			window_count;	/* number of windows using this colormap */
-	bool			actual;
-	bool			desired;
+struct colormapInfo
+{
+        struct colormapInfo *next;
+        Colormap colormap;
+        int window_count; /* number of windows using this colormap */
+        bool actual;
+        bool desired;
 };
 
-static struct colormapInfo	*colormaps;
+static struct colormapInfo *colormaps;
 
-static struct colormapInfo *
-lookupColormap (colormap)
-	Colormap	colormap;
+static struct colormapInfo *lookupColormap (colormap) Colormap colormap;
 {
-	struct colormapInfo	*ci;
+        struct colormapInfo *ci;
 
-	for (ci = colormaps; ci; ci=ci->next)
-		if (ci->colormap == colormap)
-			return ci;
-	ci = (struct colormapInfo *) malloc (sizeof (*ci));
-	ci->actual = FALSE;
-	ci->desired = FALSE;
-	ci->window_count = 0;
-	ci->next = colormaps;
-	ci->colormap = colormap;
-	colormaps = ci;
-	return ci;
+        for (ci = colormaps; ci; ci = ci->next)
+                if (ci->colormap == colormap)
+                        return ci;
+        ci = (struct colormapInfo *) malloc (sizeof (*ci));
+        ci->actual = FALSE;
+        ci->desired = FALSE;
+        ci->window_count = 0;
+        ci->next = colormaps;
+        ci->colormap = colormap;
+        colormaps = ci;
+        return ci;
 }
 
-deleteColormap (colormap)
-	Colormap	colormap;
+deleteColormap (colormap) Colormap colormap;
 {
-	struct colormapInfo	*ci, *prev;
+        struct colormapInfo *ci, *prev;
 
-	prev = 0;
-	for (ci = colormaps; ci; ci=ci->next) {
-		if (ci->colormap == colormap) {
-			if (prev)
-				prev->next = ci->next;
-			else
-				colormaps = ci->next;
-			free ((char *) ci);
-			break;
-		}
-		prev = ci;
-	}
+        prev = 0;
+        for (ci = colormaps; ci; ci = ci->next)
+        {
+                if (ci->colormap == colormap)
+                {
+                        if (prev)
+                                prev->next = ci->next;
+                        else
+                                colormaps = ci->next;
+                        free ((char *) ci);
+                        break;
+                }
+                prev = ci;
+        }
 }
 
-noteWindowAttached (window, colormap)
-	Window	window;
-	Colormap	colormap;
+noteWindowAttached (window, colormap) Window window;
+Colormap colormap;
 {
-	struct colormapInfo	*ci;
+        struct colormapInfo *ci;
+
+        ci = lookupColormap (colormap);
+        ci->window_count++;
+}
 
-	ci = lookupColormap (colormap);
-	ci->window_count++;
+noteWindowUnattached (window, colormap) Window window;
+Colormap colormap;
+{
+        struct colormapInfo *ci;
+
+        ci = lookupColormap (colormap);
+        if (--ci->window_count == 0)
+                deleteColormap (colormap);
 }
 
-noteWindowUnattached (window, colormap)
-	Window	window;
-	Colormap	colormap;
-{
-	struct colormapInfo	*ci;
-
-	ci = lookupColormap (colormap);
-	if (--ci->window_count == 0)
-		deleteColormap (colormap);
-}
-    
-noteInstalledColormap (colormap)
-	Colormap	colormap;
+noteInstalledColormap (colormap) Colormap colormap;
 {
-	struct colormapInfo	*ci;
+        struct colormapInfo *ci;
 
-	ci = lookupColormap (colormap);
-	if (!ci->actual)
+        ci = lookupColormap (colormap);
+        if (! ci->actual)
 #ifdef DEBUG
-		printf ("note installed %x %d %s %s\n", colormap, ci->window_count,
-			ci->actual  ? "installed" : "uninstalled",
-			ci->desired ? "desired" : "not desired");
+                printf ("note installed %x %d %s %s\n",
+                        colormap,
+                        ci->window_count,
+                        ci->actual ? "installed" : "uninstalled",
+                        ci->desired ? "desired" : "not desired");
 #endif /* DEBUG */
-	ci->actual = TRUE;
-	/* any random colormaps don't get installed  */
-	if (ci->window_count == 0) {
-		for (ci = colormaps; ci; ci=ci->next)
-			if (ci->desired)
-				XInstallColormap (dpy, ci->colormap);
-	}
+        ci->actual = TRUE;
+        /* any random colormaps don't get installed  */
+        if (ci->window_count == 0)
+        {
+                for (ci = colormaps; ci; ci = ci->next)
+                        if (ci->desired)
+                                XInstallColormap (dpy, ci->colormap);
+        }
+}
+
+noteUninstalledColormap (colormap) Colormap colormap;
+{
+        struct colormapInfo *ci;
+
+        ci = lookupColormap (colormap);
+        if (ci->actual)
+#ifdef DEBUG
+                printf ("note uninstalled %x %d %s %s\n",
+                        colormap,
+                        ci->window_count,
+                        ci->actual ? "installed" : "uninstalled",
+                        ci->desired ? "desired" : "not desired");
+#endif /* DEBUG */
+        ci->actual = FALSE;
+        if (ci->desired)
+                XInstallColormap (dpy, colormap);
 }
 
-noteUninstalledColormap (colormap)
-	Colormap	colormap;
+static void
+installColormap (Colormap colormap)
 {
-	struct colormapInfo	*ci;
+        struct colormapInfo *ci;
 
-	ci = lookupColormap (colormap);
-	if (ci->actual)
+        for (ci = colormaps; ci; ci = ci->next)
+                if (ci->desired)
+                {
 #ifdef DEBUG
-		printf ("note uninstalled %x %d %s %s\n", colormap, ci->window_count,
-			ci->actual  ? "installed" : "uninstalled",
-			ci->desired ? "desired" : "not desired");
+                        printf ("apparently lost uninstall event for colormap %x\n",
+                                ci->colormap);
 #endif /* DEBUG */
-	ci->actual = FALSE;
-	if (ci->desired)
-		XInstallColormap (dpy, colormap);
+                        return;
+                }
+
+        ci = lookupColormap (colormap);
+#ifdef DEBUG
+        printf ("install %x %d %s %s\n",
+                ci->colormap,
+                ci->window_count,
+                ci->actual ? "installed" : "uninstalled",
+                ci->desired ? "desired" : "not desired");
+#endif /* DEBUG */
+        if (ci->desired)
+                return;
+        ci->desired = TRUE;
+        if (! ci->actual)
+                XInstallColormap (dpy, colormap);
 }
 
-static void installColormap (Colormap colormap)
+uninstallColormap (colormap) Colormap colormap;
 {
-	struct colormapInfo	*ci;
+        struct colormapInfo *ci;
 
-	for (ci = colormaps; ci; ci=ci->next)
-		if (ci->desired) {
+        ci = lookupColormap (colormap);
+        if (ci->desired)
 #ifdef DEBUG
-			printf ("apparently lost uninstall event for colormap %x\n", ci->colormap);
-#endif /* DEBUG */
-			return;
-		}
-
-	ci = lookupColormap (colormap);
-#ifdef DEBUG
-	printf ("install %x %d %s %s\n", ci->colormap, ci->window_count,
-		ci->actual  ? "installed" : "uninstalled",
-		ci->desired ? "desired" : "not desired");
+                printf ("uninstall %x %d %s %s\n",
+                        ci->colormap,
+                        ci->window_count,
+                        ci->actual ? "installed" : "uninstalled",
+                        ci->desired ? "desired" : "not desired");
 #endif /* DEBUG */
-	if (ci->desired)
-		return;
-	ci->desired = TRUE;
-	if (!ci->actual)
-		XInstallColormap (dpy, colormap);
+        ci->desired = FALSE;
 }
-
-uninstallColormap (colormap)
-	Colormap	colormap;
-{
-	struct colormapInfo	*ci;
-
-	ci = lookupColormap (colormap);
-	if (ci->desired)
-#ifdef DEBUG
-		printf ("uninstall %x %d %s %s\n", ci->colormap, ci->window_count,
-			ci->actual  ? "installed" : "uninstalled",
-			ci->desired ? "desired" : "not desired");
-#endif /* DEBUG */
-	ci->desired = FALSE;
-}
--- a/globals.c	Fri May 03 21:20:25 2019 +0000
+++ b/globals.c	Fri May 03 21:20:54 2019 +0000
@@ -39,18 +39,18 @@
  * SOFTWARE.
  */
 
- 
+
 /*
  * MODIFICATION HISTORY
  *
  * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  * 001 -- R. Kittell, DEC Storage A/D May 19, 1986
  *  Added global vars for warp options.
- * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group 
+ * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
  *  Western Software Lab. April 17, 1987
  *  Convert to X11
  */
- 
+
 #ifndef lint
 static char *sccsid = "%W%	%G%";
 #endif
@@ -58,234 +58,227 @@
  * globals.c - window manager global data
  *
  */
- 
+
 #include "uwm.h"
 #include <stdbool.h>
 #include <stdint.h>
- 
-Window Pop;			/* Pop up dimension display window. */
-Window Frozen;			/* Contains window id of "gridded" window. */
-XFontStruct *IFontInfo;		/* Icon text font information. */
-XFontStruct *PFontInfo;		/* Pop-up text font information. */
-XFontStruct *MFontInfo;		/* Menu text font information. */
-Pixmap GrayPixmap;		/* Gray pixmap. */
-Pixel IBorder;			/* Icon window border pixmap. */
-Pixmap IBackground;		/* Icon window background pixmap. */
-Pixel PBorder;			/* Pop-Up Window border pixmap. */
-Pixel PBackground;		/* Pop-up Window background pixmap. */
-Pixel MBorder;			/* Menu Window border pixmap. */
-Pixel MBackground;		/* Menu Window background pixmap. */
-Cursor ArrowCrossCursor;	/* Arrow cross cursor. */
-Cursor TextCursor;		/* Text cursor used in icon windows. */
-Cursor IconCursor;		/* Icon Cursor. */
-Cursor MenuCursor;		/* Menu cursor. */
-Cursor MenuMaskCursor;		/* Menu mask cursor. */
-Cursor LeftButtonCursor;	/* Left button main cursor. */
-Cursor MiddleButtonCursor;	/* Middle button main cursor. */
-Cursor RightButtonCursor;	/* Right button main cursor. */
-Cursor TargetCursor;		/* Target (select-a-window) cursor. */
-int ScreenWidth;		/* Display screen width. */
-int ScreenHeight;		/* Display screen height. */
-int ITextForeground;		/* Icon window text forground color. */
-int ITextBackground;		/* Icon window text background color. */
-int IBorderWidth;		/* Icon window border width. */
-int PTextForeground;		/* Pop-up window text forground color. */
-int PTextBackground;		/* Pop-up window text background color. */
-int MTextForeground;		/* Menu window text forground color. */
-int MTextBackground;		/* Menu window text background color. */
-int PWidth;			/* Pop-up window width. */
-int PHeight;			/* Pop-up window height. */
-int PBorderWidth;		/* Pop-up window border width. */
-int PPadding;			/* Pop-up window padding. */
-int MBorderWidth;		/* Menu window border width. */
-int MPadding;			/* Menu window padding. */
-int Delay;			/* Delay between clicks of a double click. */
-int Delta;			/* Mouse movement slop. */
-int HIconPad;			/* Icon horizontal padding. */
-int VIconPad;			/* Icon vertical padding. */
-int HMenuPad;			/* Menu horizontal padding. */
-int VMenuPad;			/* Menu vertical padding. */
-int MaxColors;			/* Maximum number of colors to use. */
-int Pushval = 5;		/* Number of pixels to push window by. */
-int Volume;			/* Audible alarm volume. */
-int status;			/* Routine return status. */
-int Maxfd;			/* Maximum file descriptors for select(2). */
-MenuLink *Menus;		/* Linked list of menus. */
-GC  IconGC;             	/* graphics context for icon */
-GC  PopGC;  	           	/* graphics context for pop */
-GC  MenuGC;             	/* graphics context for menu */
-GC  MenuInvGC;             	/* graphics context for menu background */
-GC  DrawGC;             	/* graphics context for drawing */
-Binding *Blist;			/* Button/key binding list. */
- 
-bool Autoselect;		/* Warp mouse to default menu selection? */
-bool Freeze;			/* Freeze server during move/resize? */
-bool Grid;			/* Should the m/r box contain a 9 seg. grid. */
-bool NWindow;           	 /* Normalize windows? */
-bool NIcon;             	 /* Normalize icons? */
-bool Push;			/* Relative=TRUE, Absolute=FALSE. */
-bool ResizeRelative;		/* resizes should be relative to window edge */
-bool Reverse;			/* Reverse video? */
-bool Zap;			/* Should the the zap effect be used. */
-bool WarpOnRaise;               /* Warp to upper right corner on raise. */
-bool WarpOnIconify;             /* Warp to icon center on iconify. */
-bool WarpOnDeIconify;           /* Warp to upper right corner on de-iconify. */
-bool FocusSetByUser;            /* True if f.focus called */
- 
-char PText[PTEXT_LENGTH] = INIT_PTEXT;	/* Pop-up window dummy text. */
-int PTextSize = PTEXT_LENGTH;	/* Pop-up window dummy text size. */
- 
-int Lineno = 1;			/* Line count for parser. */
-bool Startup_File_Error = FALSE;/* Startup file error flag. */
-char Startup_File[NAME_LEN] = "";/* Startup file name. */
-char IFontName[NAME_LEN];	/* Icon font name. */
-char PFontName[NAME_LEN];	/* Pop-up font name. */
-char MFontName[NAME_LEN];	/* Menu font name. */
-char PBackgroundName[NAME_LEN];	/* name of color to use for popup */
-char PForegroundName[NAME_LEN];	/* name of color to use for popup */
-char PBorderColor[NAME_LEN];	/* name of color to use for popup */
-char **Argv;			/* Pointer to command line parameters. */
-char **Environ;			/* Pointer to environment. */
+
+Window Pop; /* Pop up dimension display window. */
+Window Frozen; /* Contains window id of "gridded" window. */
+XFontStruct *IFontInfo; /* Icon text font information. */
+XFontStruct *PFontInfo; /* Pop-up text font information. */
+XFontStruct *MFontInfo; /* Menu text font information. */
+Pixmap GrayPixmap; /* Gray pixmap. */
+Pixel IBorder; /* Icon window border pixmap. */
+Pixmap IBackground; /* Icon window background pixmap. */
+Pixel PBorder; /* Pop-Up Window border pixmap. */
+Pixel PBackground; /* Pop-up Window background pixmap. */
+Pixel MBorder; /* Menu Window border pixmap. */
+Pixel MBackground; /* Menu Window background pixmap. */
+Cursor ArrowCrossCursor; /* Arrow cross cursor. */
+Cursor TextCursor; /* Text cursor used in icon windows. */
+Cursor IconCursor; /* Icon Cursor. */
+Cursor MenuCursor; /* Menu cursor. */
+Cursor MenuMaskCursor; /* Menu mask cursor. */
+Cursor LeftButtonCursor; /* Left button main cursor. */
+Cursor MiddleButtonCursor; /* Middle button main cursor. */
+Cursor RightButtonCursor; /* Right button main cursor. */
+Cursor TargetCursor; /* Target (select-a-window) cursor. */
+int ScreenWidth; /* Display screen width. */
+int ScreenHeight; /* Display screen height. */
+int ITextForeground; /* Icon window text forground color. */
+int ITextBackground; /* Icon window text background color. */
+int IBorderWidth; /* Icon window border width. */
+int PTextForeground; /* Pop-up window text forground color. */
+int PTextBackground; /* Pop-up window text background color. */
+int MTextForeground; /* Menu window text forground color. */
+int MTextBackground; /* Menu window text background color. */
+int PWidth; /* Pop-up window width. */
+int PHeight; /* Pop-up window height. */
+int PBorderWidth; /* Pop-up window border width. */
+int PPadding; /* Pop-up window padding. */
+int MBorderWidth; /* Menu window border width. */
+int MPadding; /* Menu window padding. */
+int Delay; /* Delay between clicks of a double click. */
+int Delta; /* Mouse movement slop. */
+int HIconPad; /* Icon horizontal padding. */
+int VIconPad; /* Icon vertical padding. */
+int HMenuPad; /* Menu horizontal padding. */
+int VMenuPad; /* Menu vertical padding. */
+int MaxColors; /* Maximum number of colors to use. */
+int Pushval = 5; /* Number of pixels to push window by. */
+int Volume; /* Audible alarm volume. */
+int status; /* Routine return status. */
+int Maxfd; /* Maximum file descriptors for select(2). */
+MenuLink *Menus; /* Linked list of menus. */
+GC IconGC; /* graphics context for icon */
+GC PopGC; /* graphics context for pop */
+GC MenuGC; /* graphics context for menu */
+GC MenuInvGC; /* graphics context for menu background */
+GC DrawGC; /* graphics context for drawing */
+Binding *Blist; /* Button/key binding list. */
+
+bool Autoselect; /* Warp mouse to default menu selection? */
+bool Freeze; /* Freeze server during move/resize? */
+bool Grid; /* Should the m/r box contain a 9 seg. grid. */
+bool NWindow; /* Normalize windows? */
+bool NIcon; /* Normalize icons? */
+bool Push; /* Relative=TRUE, Absolute=FALSE. */
+bool ResizeRelative; /* resizes should be relative to window edge */
+bool Reverse; /* Reverse video? */
+bool Zap; /* Should the the zap effect be used. */
+bool WarpOnRaise; /* Warp to upper right corner on raise. */
+bool WarpOnIconify; /* Warp to icon center on iconify. */
+bool WarpOnDeIconify; /* Warp to upper right corner on de-iconify. */
+bool FocusSetByUser; /* True if f.focus called */
+
+char PText[PTEXT_LENGTH] = INIT_PTEXT; /* Pop-up window dummy text. */
+int PTextSize = PTEXT_LENGTH; /* Pop-up window dummy text size. */
+
+int Lineno = 1; /* Line count for parser. */
+bool Startup_File_Error = FALSE; /* Startup file error flag. */
+char Startup_File[NAME_LEN] = ""; /* Startup file name. */
+char IFontName[NAME_LEN]; /* Icon font name. */
+char PFontName[NAME_LEN]; /* Pop-up font name. */
+char MFontName[NAME_LEN]; /* Menu font name. */
+char PBackgroundName[NAME_LEN]; /* name of color to use for popup */
+char PForegroundName[NAME_LEN]; /* name of color to use for popup */
+char PBorderColor[NAME_LEN]; /* name of color to use for popup */
+char **Argv; /* Pointer to command line parameters. */
+char **Environ; /* Pointer to environment. */
 
 int scr;
 Display *dpy;
- 
+
 /*
  * Keyword lookup table for parser.
  */
-Keyword KeywordTable[] = {
-    { "autoselect",	IsBoolTrue,	&Autoselect,0,0,0 },
-    { "background",	IsString,	0,0,PBackgroundName, 0},
-    { "bordercolor",	IsString,	0,0,PBorderColor, 0},
-    { "borderwidth",	IsNumeric,	0,&PBorderWidth,0,0},
-    { "delay",		IsNumeric,	0,&Delay,0,0 },
-    { "delta",		IsNumeric,	0,&Delta,0,0 },
-    { "foreground",	IsString,	0,0,PForegroundName, 0},
-    { "freeze",		IsBoolTrue,	&Freeze,0,0,0 },
-    { "iconfont",	IsString,	0,0,IFontName,0 },
-    { "f.beep",		IsQuitFunction,	0,0,0,Beep },
-    { "f.circledown",	IsQuitFunction,	0,0,0,CircleDown },
-    { "f.circleup",	IsQuitFunction,	0,0,0,CircleUp },
-    { "f.continue",	IsQuitFunction,	0,0,0,Continue },
-    { "f.exit",		IsQuitFunction,	0,0,0,Quit },
-    { "f.focus",	IsFunction,	0,0,0,Focus },
-    { "f.iconify",	IsFunction,	0,0,0,Iconify },
-    { "f.kill",		IsFunction,	0,0,0,Kill },
-    { "f.lower",	IsFunction,	0,0,0,Lower },
-    { "f.menu",		IsMenuMap,	0,0,0,Menu },
-    { "f.move",		IsDownFunction,	0,0,0,Move },
-    { "f.moveopaque",	IsDownFunction,	0,0,0,MoveOpaque },
-    { "f.newiconify",	IsDownFunction,	0,0,0,NewIconify },
-    { "f.pause",	IsQuitFunction,	0,0,0,Pause },
-    { "f.pushdown",	IsFunction,	0,0,0,PushDown },
-    { "f.pushleft",	IsFunction,	0,0,0,PushLeft },
-    { "f.pushright",	IsFunction,	0,0,0,PushRight },
-    { "f.pushup",	IsFunction,	0,0,0,PushUp },
-    { "f.raise",	IsFunction,	0,0,0,Raise },
-    { "f.redraw",	IsFunction,	0,0,0,Redraw },
-    { "f.refresh",	IsQuitFunction,	0,0,0,Refresh },
-    { "f.resize",	IsDownFunction,	0,0,0,Resize },
-    { "f.restart",	IsQuitFunction,	0,0,0,Restart },
-    { "grid",		IsBoolTrue,	&Grid,0,0,0 },
-    { "hiconpad",	IsNumeric,	0,&HIconPad,0,0 },
-    { "hmenupad",	IsNumeric,	0,&HMenuPad,0,0 },
-    { "iborderwidth",	IsNumeric,	0,&IBorderWidth,0,0 },
-    { "maxcolors",	IsNumeric,	0,&MaxColors,0,0 },
-    { "mborderwidth",	IsNumeric,	0,&MBorderWidth,0,0 },
-    { "menu",		IsMenu,		0,0,0,0 },
-    { "menufont",	IsString,	0,0,MFontName,0 },
-    { "noautoselect",	IsBoolFalse,	&Autoselect,0,0,0 },
-    { "nofreeze",	IsBoolFalse,	&Freeze,0,0,0 },
-    { "nogrid",		IsBoolFalse,	&Grid,0,0,0 },
-    { "nonormali",	IsBoolFalse,	&NIcon,0,0,0 },
-    { "nonormalw",	IsBoolFalse,	&NWindow,0,0,0 },
-    { "noresizerelative",	IsBoolFalse,	&ResizeRelative,0,0,0 },
-    { "noreverse",	IsBoolFalse,	&Reverse,0,0,0 },
-    { "normali",	IsBoolTrue,	&NIcon,0,0,0 },
-    { "normalw",	IsBoolTrue,	&NWindow,0,0,0 },
-    { "nowarpdi",	IsBoolFalse,	&WarpOnDeIconify,0,0,0 },
-    { "nowarpi",	IsBoolFalse,	&WarpOnIconify,0,0,0 },
-    { "nowarpr",	IsBoolFalse,	&WarpOnRaise,0,0,0 },
-    { "nozap",		IsBoolFalse,	&Zap,0,0,0 },
-    { "push",		IsNumeric,	0,&Pushval,0,0 },
-    { "pushabsolute",	IsBoolFalse,	&Push,0,0,0 },
-    { "pushrelative",	IsBoolTrue,	&Push,0,0,0 },
-    { "resetbindings",	IsParser,	0,0,0,ResetBindings },
-    { "resetmenus",	IsParser,	0,0,0,ResetMenus },
-    { "resetvariables",	IsParser,	0,0,0,ResetVariables },
-    { "resizefont",	IsString,	0,0,PFontName,0 },
-    { "resizerelative",	IsBoolTrue,	&ResizeRelative,0,0,0 },
-    { "reverse",	IsBoolTrue,	&Reverse,0,0,0 },
-    { "viconpad",	IsNumeric,	0,&VIconPad,0,0 },
-    { "vmenupad",	IsNumeric,	0,&VMenuPad,0,0 },
-    { "volume",		IsNumeric,	0,&Volume,0,0 },
-    { "warpdi",		IsBoolTrue,	&WarpOnDeIconify,0,0,0 },
-    { "warpi",		IsBoolTrue,	&WarpOnIconify,0,0,0 },
-    { "warpr",		IsBoolTrue,	&WarpOnRaise,0,0,0 },
-    { "zap",		IsBoolTrue,	&Zap,0,0,0 },
-    { NULL,		(uintptr_t) NULL,		NULL,NULL,NULL,NULL }
-};
- 
+Keyword KeywordTable[] =
+  {{"autoselect", IsBoolTrue, &Autoselect, 0, 0, 0},
+   {"background", IsString, 0, 0, PBackgroundName, 0},
+   {"bordercolor", IsString, 0, 0, PBorderColor, 0},
+   {"borderwidth", IsNumeric, 0, &PBorderWidth, 0, 0},
+   {"delay", IsNumeric, 0, &Delay, 0, 0},
+   {"delta", IsNumeric, 0, &Delta, 0, 0},
+   {"foreground", IsString, 0, 0, PForegroundName, 0},
+   {"freeze", IsBoolTrue, &Freeze, 0, 0, 0},
+   {"iconfont", IsString, 0, 0, IFontName, 0},
+   {"f.beep", IsQuitFunction, 0, 0, 0, Beep},
+   {"f.circledown", IsQuitFunction, 0, 0, 0, CircleDown},
+   {"f.circleup", IsQuitFunction, 0, 0, 0, CircleUp},
+   {"f.continue", IsQuitFunction, 0, 0, 0, Continue},
+   {"f.exit", IsQuitFunction, 0, 0, 0, Quit},
+   {"f.focus", IsFunction, 0, 0, 0, Focus},
+   {"f.iconify", IsFunction, 0, 0, 0, Iconify},
+   {"f.kill", IsFunction, 0, 0, 0, Kill},
+   {"f.lower", IsFunction, 0, 0, 0, Lower},
+   {"f.menu", IsMenuMap, 0, 0, 0, Menu},
+   {"f.move", IsDownFunction, 0, 0, 0, Move},
+   {"f.moveopaque", IsDownFunction, 0, 0, 0, MoveOpaque},
+   {"f.newiconify", IsDownFunction, 0, 0, 0, NewIconify},
+   {"f.pause", IsQuitFunction, 0, 0, 0, Pause},
+   {"f.pushdown", IsFunction, 0, 0, 0, PushDown},
+   {"f.pushleft", IsFunction, 0, 0, 0, PushLeft},
+   {"f.pushright", IsFunction, 0, 0, 0, PushRight},
+   {"f.pushup", IsFunction, 0, 0, 0, PushUp},
+   {"f.raise", IsFunction, 0, 0, 0, Raise},
+   {"f.redraw", IsFunction, 0, 0, 0, Redraw},
+   {"f.refresh", IsQuitFunction, 0, 0, 0, Refresh},
+   {"f.resize", IsDownFunction, 0, 0, 0, Resize},
+   {"f.restart", IsQuitFunction, 0, 0, 0, Restart},
+   {"grid", IsBoolTrue, &Grid, 0, 0, 0},
+   {"hiconpad", IsNumeric, 0, &HIconPad, 0, 0},
+   {"hmenupad", IsNumeric, 0, &HMenuPad, 0, 0},
+   {"iborderwidth", IsNumeric, 0, &IBorderWidth, 0, 0},
+   {"maxcolors", IsNumeric, 0, &MaxColors, 0, 0},
+   {"mborderwidth", IsNumeric, 0, &MBorderWidth, 0, 0},
+   {"menu", IsMenu, 0, 0, 0, 0},
+   {"menufont", IsString, 0, 0, MFontName, 0},
+   {"noautoselect", IsBoolFalse, &Autoselect, 0, 0, 0},
+   {"nofreeze", IsBoolFalse, &Freeze, 0, 0, 0},
+   {"nogrid", IsBoolFalse, &Grid, 0, 0, 0},
+   {"nonormali", IsBoolFalse, &NIcon, 0, 0, 0},
+   {"nonormalw", IsBoolFalse, &NWindow, 0, 0, 0},
+   {"noresizerelative", IsBoolFalse, &ResizeRelative, 0, 0, 0},
+   {"noreverse", IsBoolFalse, &Reverse, 0, 0, 0},
+   {"normali", IsBoolTrue, &NIcon, 0, 0, 0},
+   {"normalw", IsBoolTrue, &NWindow, 0, 0, 0},
+   {"nowarpdi", IsBoolFalse, &WarpOnDeIconify, 0, 0, 0},
+   {"nowarpi", IsBoolFalse, &WarpOnIconify, 0, 0, 0},
+   {"nowarpr", IsBoolFalse, &WarpOnRaise, 0, 0, 0},
+   {"nozap", IsBoolFalse, &Zap, 0, 0, 0},
+   {"push", IsNumeric, 0, &Pushval, 0, 0},
+   {"pushabsolute", IsBoolFalse, &Push, 0, 0, 0},
+   {"pushrelative", IsBoolTrue, &Push, 0, 0, 0},
+   {"resetbindings", IsParser, 0, 0, 0, ResetBindings},
+   {"resetmenus", IsParser, 0, 0, 0, ResetMenus},
+   {"resetvariables", IsParser, 0, 0, 0, ResetVariables},
+   {"resizefont", IsString, 0, 0, PFontName, 0},
+   {"resizerelative", IsBoolTrue, &ResizeRelative, 0, 0, 0},
+   {"reverse", IsBoolTrue, &Reverse, 0, 0, 0},
+   {"viconpad", IsNumeric, 0, &VIconPad, 0, 0},
+   {"vmenupad", IsNumeric, 0, &VMenuPad, 0, 0},
+   {"volume", IsNumeric, 0, &Volume, 0, 0},
+   {"warpdi", IsBoolTrue, &WarpOnDeIconify, 0, 0, 0},
+   {"warpi", IsBoolTrue, &WarpOnIconify, 0, 0, 0},
+   {"warpr", IsBoolTrue, &WarpOnRaise, 0, 0, 0},
+   {"zap", IsBoolTrue, &Zap, 0, 0, 0},
+   {NULL, (uintptr_t) NULL, NULL, NULL, NULL, NULL}};
+
 /*
  * Key expression table for parser.
  */
-KeyExpr KeyExprTbl[] = {
-    { "ctrl", ControlMask },
-    { "c", ControlMask },
-    { "lock", LockMask },
-    { "l", LockMask },
-    { "shift", ShiftMask },
-    { "s", ShiftMask },
-    { "meta", Mod1Mask },
-    { "m", Mod1Mask },
-    { "mod1", Mod1Mask },
-    { "1", Mod1Mask },
-    { "mod2", Mod2Mask },
-    { "2", Mod2Mask },
-    { "mod3", Mod3Mask },
-    { "3", Mod3Mask },
-    { "mod4", Mod4Mask },
-    { "4", Mod4Mask },
-    { "mod5", Mod5Mask },
-    { "5", Mod5Mask },
-    { NULL, (uintptr_t) NULL }
-};
- 
+KeyExpr KeyExprTbl[] = {{"ctrl", ControlMask},
+                        {"c", ControlMask},
+                        {"lock", LockMask},
+                        {"l", LockMask},
+                        {"shift", ShiftMask},
+                        {"s", ShiftMask},
+                        {"meta", Mod1Mask},
+                        {"m", Mod1Mask},
+                        {"mod1", Mod1Mask},
+                        {"1", Mod1Mask},
+                        {"mod2", Mod2Mask},
+                        {"2", Mod2Mask},
+                        {"mod3", Mod3Mask},
+                        {"3", Mod3Mask},
+                        {"mod4", Mod4Mask},
+                        {"4", Mod4Mask},
+                        {"mod5", Mod5Mask},
+                        {"5", Mod5Mask},
+                        {NULL, (uintptr_t) NULL}};
+
 /*
  * Context expression table for parser.
  */
-ContExpr ContExprTbl[] = {
-    { "icon", ICON },
-    { "i", ICON },
-    { "root", ROOT },
-    { "r", ROOT },
-    { "window", WINDOW },
-    { "w", WINDOW },
-    { NULL, (uintptr_t) NULL }
-};
- 
+ContExpr ContExprTbl[] = {{"icon", ICON},
+                          {"i", ICON},
+                          {"root", ROOT},
+                          {"r", ROOT},
+                          {"window", WINDOW},
+                          {"w", WINDOW},
+                          {NULL, (uintptr_t) NULL}};
+
 /*
  * Button expression table for parser.
  */
-ButtonModifier ButtModTbl[] = {
-    { "left", LeftMask },
-    { "leftbutton", LeftMask },
-    { "l", LeftMask },
-    { "middle", MiddleMask },
-    { "middlebutton", MiddleMask },
-    { "m", MiddleMask },
-    { "right", RightMask },
-    { "rightbutton", RightMask },
-    { "r", RightMask },
-    { "move", DeltaMotion },
-    { "motion", DeltaMotion },
-    { "delta", DeltaMotion },
-    { "down", ButtonDown },
-    { "d", ButtonDown },
-    { "up", ButtonUp },
-    { "u", ButtonUp },
-    { NULL, (uintptr_t) NULL }
-};
- 
+ButtonModifier ButtModTbl[] = {{"left", LeftMask},
+                               {"leftbutton", LeftMask},
+                               {"l", LeftMask},
+                               {"middle", MiddleMask},
+                               {"middlebutton", MiddleMask},
+                               {"m", MiddleMask},
+                               {"right", RightMask},
+                               {"rightbutton", RightMask},
+                               {"r", RightMask},
+                               {"move", DeltaMotion},
+                               {"motion", DeltaMotion},
+                               {"delta", DeltaMotion},
+                               {"down", ButtonDown},
+                               {"d", ButtonDown},
+                               {"up", ButtonUp},
+                               {"u", ButtonUp},
+                               {NULL, (uintptr_t) NULL}};
+
 bool x_error_occurred = FALSE;
 XErrorEvent last_error_event;
--- a/windowinfo.c	Fri May 03 21:20:25 2019 +0000
+++ b/windowinfo.c	Fri May 03 21:20:54 2019 +0000
@@ -21,194 +21,188 @@
 #include "caddr.h"
 #include "uwm.h"
 
-XContext	windowInfo;
+XContext windowInfo;
 
 typedef struct _windowInterest
 {
-	struct _windowInterest	*next;
-	int				(*initAndDone)();
-	int				(*eventHandler)();
+        struct _windowInterest *next;
+        int (*initAndDone) ();
+        int (*eventHandler) ();
 } WindowInterest;
 
-static WindowInterest		*interests;
-
-void
-expressWindowInterest (initAndDone, eventHandler)
-	int (*initAndDone)();
-	int (*eventHandler)();
-{
-	WindowInterest	*wi;
-
-	for (wi = interests; wi; wi=wi->next)
-		if (wi->eventHandler == eventHandler)
-			return;
-	wi = (WindowInterest *) malloc (sizeof (*wi));
-	wi->next = interests;
-	interests = wi;
-	wi->initAndDone = initAndDone;
-	wi->eventHandler = eventHandler;
-}
+static WindowInterest *interests;
 
 void
-expressWindowDisinterest (eventHandler)
-	int (*eventHandler)();
+expressWindowInterest (int *initAndDone,
+                       int *eventHandler) int (*initAndDone) ();
+int (*eventHandler) ();
 {
-	WindowInterest	*wi, *prev;
+        WindowInterest *wi;
 
-	prev = 0;
-	for (wi = interests; wi; wi=wi->next)
-	{
-		if (wi->eventHandler == eventHandler)
-		{
-			if (prev)
-				prev->next = wi->next;
-			else
-				interests = wi->next;
-			free ((char *) wi);
-			return;
-		}
-		prev = wi;
-	}
+        for (wi = interests; wi; wi = wi->next)
+                if (wi->eventHandler == eventHandler)
+                        return;
+        wi = (WindowInterest *) malloc (sizeof (*wi));
+        wi->next = interests;
+        interests = wi;
+        wi->initAndDone = initAndDone;
+        wi->eventHandler = eventHandler;
 }
 
-processInterestEvent (ev)
-	XAnyEvent	*ev;
+void expressWindowDisinterest (eventHandler) int (*eventHandler) ();
 {
-	WindowInfo	*i;
-	WindowInterest	*wi;
-	long eventTypeToMask();
+        WindowInterest *wi, *prev;
 
-	i = getWindowInfo (ev->window, 0);
-	if (i)
-	{
-		for (wi = interests; wi; wi=wi->next)
-			if (wi->eventHandler)
-				(*wi->eventHandler) (i, ev);
-		/*
-		 * nuke this event so uwm doesn't get confused
-		 */
-		if ((eventTypeToMask (ev->type) & i->uwm_event_mask) == 0)
-			ev->type = 0;
-	}
+        prev = 0;
+        for (wi = interests; wi; wi = wi->next)
+        {
+                if (wi->eventHandler == eventHandler)
+                {
+                        if (prev)
+                                prev->next = wi->next;
+                        else
+                                interests = wi->next;
+                        free ((char *) wi);
+                        return;
+                }
+                prev = wi;
+        }
+}
+
+processInterestEvent (ev) XAnyEvent *ev;
+{
+        WindowInfo *i;
+        WindowInterest *wi;
+        long eventTypeToMask ();
+
+        i = getWindowInfo (ev->window, 0);
+        if (i)
+        {
+                for (wi = interests; wi; wi = wi->next)
+                        if (wi->eventHandler)
+                                (*wi->eventHandler) (i, ev);
+                /*
+                 * nuke this event so uwm doesn't get confused
+                 */
+                if ((eventTypeToMask (ev->type) & i->uwm_event_mask) == 0)
+                        ev->type = 0;
+        }
 }
 
-static WindowInfo *
-initWindowInfo (w)
-	Window	w;
+static WindowInfo *initWindowInfo (w) Window w;
 {
-	WindowInfo	*i;
-	XWindowAttributes	wa;
-	WindowInterest	*wi;
+        WindowInfo *i;
+        XWindowAttributes wa;
+        WindowInterest *wi;
 
-	if (XGetWindowAttributes (dpy, w, &wa))
-	{
-		i = (WindowInfo *) malloc (sizeof (*i));
-		i->window = w;
-		i->event_mask = 0;
-		i->uwm_event_mask = 0;
-		XSaveContext (dpy, w, windowInfo, (caddr_t) i);
-		for (wi = interests; wi; wi=wi->next)
-			(*wi->initAndDone) (i, &wa);
-		if (i->event_mask)
-			XSelectInput (dpy, w, i->event_mask);
-		i->been_mapped = False;
-		bzero ((char *)&(i->stashedhints), sizeof (XSizeHints));
-		return i;
-	}
-	return 0;
+        if (XGetWindowAttributes (dpy, w, &wa))
+        {
+                i = (WindowInfo *) malloc (sizeof (*i));
+                i->window = w;
+                i->event_mask = 0;
+                i->uwm_event_mask = 0;
+                XSaveContext (dpy, w, windowInfo, (caddr_t) i);
+                for (wi = interests; wi; wi = wi->next)
+                        (*wi->initAndDone) (i, &wa);
+                if (i->event_mask)
+                        XSelectInput (dpy, w, i->event_mask);
+                i->been_mapped = False;
+                bzero ((char *) &(i->stashedhints), sizeof (XSizeHints));
+                return i;
+        }
+        return 0;
 }
 
-deleteWindowInfo (w)
-	Window	w;
+deleteWindowInfo (w) Window w;
 {
-	WindowInfo	*i;
-	WindowInterest	*wi;
+        WindowInfo *i;
+        WindowInterest *wi;
 
-	if (XFindContext (dpy, w, windowInfo, &i) == XCSUCCESS)
-	{
-		for (wi = interests; wi; wi = wi->next)
-			(*wi->initAndDone) (i, (XWindowAttributes *) 0);
-		XDeleteContext (dpy,  w, windowInfo);
-		free ((char *) i);
-	}
+        if (XFindContext (dpy, w, windowInfo, &i) == XCSUCCESS)
+        {
+                for (wi = interests; wi; wi = wi->next)
+                        (*wi->initAndDone) (i, (XWindowAttributes *) 0);
+                XDeleteContext (dpy, w, windowInfo);
+                free ((char *) i);
+        }
 }
 
-WindowInfo *
-getWindowInfo (w)
-	Window	w;
+WindowInfo *getWindowInfo (w) Window w;
 {
-	WindowInfo	*i = NULL;
+        WindowInfo *i = NULL;
 
-	if (!windowInfo)
-	{
-		windowInfo = XUniqueContext ();
-	}
-	if (XFindContext (dpy, w, windowInfo, (caddr_t *) &i) == XCNOENT)
-		i = initWindowInfo (w);
-	return i;
+        if (! windowInfo)
+        {
+                windowInfo = XUniqueContext ();
+        }
+        if (XFindContext (dpy, w, windowInfo, (caddr_t *) &i) == XCNOENT)
+                i = initWindowInfo (w);
+        return i;
 }
 
-uwmExpressInterest (w, eventMask)
-	Window	w;
-	long	eventMask;
+uwmExpressInterest (w, eventMask) Window w;
+long eventMask;
 {
-	WindowInfo	*i;
+        WindowInfo *i;
 
-	i = getWindowInfo (w);
-	if (i) {
-		if ((i->uwm_event_mask | eventMask) != (i->uwm_event_mask)) {
-			i->uwm_event_mask |= eventMask;
-			if (i->event_mask | i->uwm_event_mask != i->event_mask) {
-				i->event_mask |= i->uwm_event_mask;
-				XSelectInput (dpy, w, i->event_mask);
-			}
-		}
-	}
+        i = getWindowInfo (w);
+        if (i)
+        {
+                if ((i->uwm_event_mask | eventMask) != (i->uwm_event_mask))
+                {
+                        i->uwm_event_mask |= eventMask;
+                        if (i->event_mask | i->uwm_event_mask != i->event_mask)
+                        {
+                                i->event_mask |= i->uwm_event_mask;
+                                XSelectInput (dpy, w, i->event_mask);
+                        }
+                }
+        }
 }
 
 long foo_masks[] = {
-	0, 0,
-	KeyPressMask,					/* KeyPress */
-	KeyPressMask,					/* KeyRelease */
-	ButtonPressMask,				/* ButtonPress */
-	ButtonReleaseMask,				/* ButtonRelease */
-	PointerMotionMask|ButtonMotionMask|Button1MotionMask|Button2MotionMask|Button3MotionMask|Button4MotionMask|Button5MotionMask,
-							/* MotionNotify */
-	EnterWindowMask,				/* EnterNotify */
-	LeaveWindowMask,				/* LeaveNotify */
-	FocusChangeMask,				/* FocusIn */
-	FocusChangeMask,				/* FocusOut */
-	KeymapStateMask,				/* KeymapNotify */
-	ExposureMask,					/* Expose */
-	ExposureMask,					/* GraphicsExpose */
-	ExposureMask,					/* NoExpose */
-	VisibilityChangeMask,				/* VisibilityNotify */
-	SubstructureNotifyMask,				/* CreateNotify */
-	StructureNotifyMask|SubstructureNotifyMask,	/* DestroyNotify */
-	StructureNotifyMask|SubstructureNotifyMask,	/* UnmapNotify */
-	StructureNotifyMask|SubstructureNotifyMask,	/* MapNotify */
-	SubstructureRedirectMask,			/* MapRequest */
-	SubstructureNotifyMask,				/* ReparentNotify */
-	StructureNotifyMask|SubstructureNotifyMask,	/* ConfigureNotify */
-	SubstructureRedirectMask,			/* ConfigureRequest */
-	StructureNotifyMask|SubstructureNotifyMask,	/* GravityNotify */
-	SubstructureRedirectMask,			/* ResizeRequest */
-	StructureNotifyMask|SubstructureNotifyMask,	/* CirculateNotify */
-	SubstructureRedirectMask,			/* CirculateRequest */
-	PropertyChangeMask,				/* PropertyNotify */
-	~0,						/* SelectionClear */
-	~0,						/* SelectionRequest */
-	~0,						/* SelectionNotify */
-	ColormapChangeMask,				/* ColormapNotify */
-	SubstructureRedirectMask,			/* ClientMessage */
-	~0,						/* MappingNotify */
-    };
+  0,
+  0,
+  KeyPressMask, /* KeyPress */
+  KeyPressMask, /* KeyRelease */
+  ButtonPressMask, /* ButtonPress */
+  ButtonReleaseMask, /* ButtonRelease */
+  PointerMotionMask | ButtonMotionMask | Button1MotionMask | Button2MotionMask |
+    Button3MotionMask | Button4MotionMask | Button5MotionMask,
+  /* MotionNotify */
+  EnterWindowMask, /* EnterNotify */
+  LeaveWindowMask, /* LeaveNotify */
+  FocusChangeMask, /* FocusIn */
+  FocusChangeMask, /* FocusOut */
+  KeymapStateMask, /* KeymapNotify */
+  ExposureMask, /* Expose */
+  ExposureMask, /* GraphicsExpose */
+  ExposureMask, /* NoExpose */
+  VisibilityChangeMask, /* VisibilityNotify */
+  SubstructureNotifyMask, /* CreateNotify */
+  StructureNotifyMask | SubstructureNotifyMask, /* DestroyNotify */
+  StructureNotifyMask | SubstructureNotifyMask, /* UnmapNotify */
+  StructureNotifyMask | SubstructureNotifyMask, /* MapNotify */
+  SubstructureRedirectMask, /* MapRequest */
+  SubstructureNotifyMask, /* ReparentNotify */
+  StructureNotifyMask | SubstructureNotifyMask, /* ConfigureNotify */
+  SubstructureRedirectMask, /* ConfigureRequest */
+  StructureNotifyMask | SubstructureNotifyMask, /* GravityNotify */
+  SubstructureRedirectMask, /* ResizeRequest */
+  StructureNotifyMask | SubstructureNotifyMask, /* CirculateNotify */
+  SubstructureRedirectMask, /* CirculateRequest */
+  PropertyChangeMask, /* PropertyNotify */
+  ~0, /* SelectionClear */
+  ~0, /* SelectionRequest */
+  ~0, /* SelectionNotify */
+  ColormapChangeMask, /* ColormapNotify */
+  SubstructureRedirectMask, /* ClientMessage */
+  ~0, /* MappingNotify */
+};
 
-long
-eventTypeToMask (t)
-	int	t;
+long eventTypeToMask (t) int t;
 {
-	if (0 <= t && t < sizeof foo_masks / sizeof foo_masks[0])
-		return foo_masks[t];
-	return 0;
+        if (0 <= t && t < sizeof foo_masks / sizeof foo_masks[0])
+                return foo_masks[t];
+        return 0;
 }