changeset 57:0c71b3505f6e

Push.c: clang-format
author ng0@n0.is
date Fri, 03 May 2019 21:11:08 +0000
parents 9d550591b721
children 27fe66ab381f
files Push.c
diffstat 1 files changed, 91 insertions(+), 92 deletions(-) [+]
line wrap: on
line diff
--- a/Push.c	Fri May 03 21:10:45 2019 +0000
+++ b/Push.c	Fri May 03 21:11:08 2019 +0000
@@ -1,6 +1,7 @@
 #ifndef lint
-static char *rcsid_Push_c = "$XConsortium: Push.c,v 1.4 88/09/06 17:28:36 jim Exp $";
-#endif	/* lint */
+static char *rcsid_Push_c =
+  "$XConsortium: Push.c,v 1.4 88/09/06 17:28:36 jim Exp $";
+#endif /* lint */
 
 /*
  * Copyright 1985, 1986, 1987, 1988, 1989 by the
@@ -41,7 +42,6 @@
  * SOFTWARE.
  */
 
- 
 
 /*
  * MODIFICATION HISTORY
@@ -58,115 +58,114 @@
 #include "uwm.h"
 #include <stdbool.h>
 
-#define PUSH_DOWN	1
-#define PUSH_UP		2
-#define PUSH_LEFT	3
-#define PUSH_RIGHT	4
-
-extern bool PushAll();
+#define PUSH_DOWN 1
+#define PUSH_UP 2
+#define PUSH_LEFT 3
+#define PUSH_RIGHT 4
 
-bool PushDown(window, mask, button, x, y)
-Window window;				/* Event window. */
-int mask;				/* Button/key mask. */
-int button;				/* Button event detail. */
-int x, y;				/* Event mouse position. */
+extern bool
+PushAll ();
+
+bool PushDown (window, mask, button, x, y) Window window; /* Event window. */
+int mask; /* Button/key mask. */
+int button; /* Button event detail. */
+int x, y; /* Event mouse position. */
 {
-    return(PushAll(window, PUSH_DOWN));
+        return (PushAll (window, PUSH_DOWN));
 }
 
-bool PushUp(window, mask, button, x, y)
-Window window;				/* Event window. */
-int mask;				/* Button/key mask. */
-int button;				/* Button event detail. */
-int x, y;				/* Event mouse position. */
+bool PushUp (window, mask, button, x, y) Window window; /* Event window. */
+int mask; /* Button/key mask. */
+int button; /* Button event detail. */
+int x, y; /* Event mouse position. */
 {
-    return(PushAll(window, PUSH_UP));
+        return (PushAll (window, PUSH_UP));
 }
 
-bool PushLeft(window, mask, button, x, y)
-Window window;				/* Event window. */
-int mask;				/* Button/key mask. */
-int button;				/* Button event detail. */
-int x, y;				/* Event mouse position. */
+bool PushLeft (window, mask, button, x, y) Window window; /* Event window. */
+int mask; /* Button/key mask. */
+int button; /* Button event detail. */
+int x, y; /* Event mouse position. */
 {
-    return(PushAll(window, PUSH_LEFT));
+        return (PushAll (window, PUSH_LEFT));
 }
 
-bool PushRight(window, mask, button, x, y)
-Window window;				/* Event window. */
-int mask;				/* Button/key mask. */
-int button;				/* Button event detail. */
-int x, y;				/* Event mouse position. */
+bool PushRight (window, mask, button, x, y) Window window; /* Event window. */
+int mask; /* Button/key mask. */
+int button; /* Button event detail. */
+int x, y; /* Event mouse position. */
 {
-    return(PushAll(window, PUSH_RIGHT));
+        return (PushAll (window, PUSH_RIGHT));
 }
 
-bool PushAll(w, direction)
-Window w;
+bool PushAll (w, direction) Window w;
 int direction;
 {
-    XWindowAttributes winfo;			/* Event window information. */
-    XWindowAttributes rinfo;			/* Root window information. */
-    int xofs, yofs;			/* Movement offsets. */
-    int x, y;				/* New window position. */
+        XWindowAttributes winfo; /* Event window information. */
+        XWindowAttributes rinfo; /* Root window information. */
+        int xofs, yofs; /* Movement offsets. */
+        int x, y; /* New window position. */
 
-    /*
-     * Do not try to move the root window.
-     */
-    if (w == RootWindow(dpy, scr))
-        return(FALSE);
+        /*
+         * Do not try to move the root window.
+         */
+        if (w == RootWindow (dpy, scr))
+                return (FALSE);
 
-    /*
-     * Gather info on the event window.
-     */
-    status = XGetWindowAttributes(dpy, w, &winfo);
-    if (status == FAILURE) return(FALSE);
+        /*
+         * Gather info on the event window.
+         */
+        status = XGetWindowAttributes (dpy, w, &winfo);
+        if (status == FAILURE)
+                return (FALSE);
 
-    /*
-     * Calculate the movement offsets.
-     */
-    switch(direction) {
-    case PUSH_DOWN:
-        xofs = 0;
-        yofs = Push ? (winfo.height / Pushval) : Pushval;
-        break;
-    case PUSH_UP:
-        xofs = 0;
-        yofs = 0 - (Push ? (winfo.height / Pushval) : Pushval);
-        break;
-    case PUSH_LEFT:
-        xofs = 0 - (Push ? (winfo.width / Pushval) : Pushval);
-        yofs = 0;
-        break;
-    case PUSH_RIGHT:
-        xofs = Push ? (winfo.width / Pushval) : Pushval;
-        yofs = 0;
-        break;
-    }
+        /*
+         * Calculate the movement offsets.
+         */
+        switch (direction)
+        {
+        case PUSH_DOWN:
+                xofs = 0;
+                yofs = Push ? (winfo.height / Pushval) : Pushval;
+                break;
+        case PUSH_UP:
+                xofs = 0;
+                yofs = 0 - (Push ? (winfo.height / Pushval) : Pushval);
+                break;
+        case PUSH_LEFT:
+                xofs = 0 - (Push ? (winfo.width / Pushval) : Pushval);
+                yofs = 0;
+                break;
+        case PUSH_RIGHT:
+                xofs = Push ? (winfo.width / Pushval) : Pushval;
+                yofs = 0;
+                break;
+        }
 
-    /*
-     * Calculate the new window position.
-     */
-    x = winfo.x + xofs;
-    y = winfo.y + yofs;
+        /*
+         * Calculate the new window position.
+         */
+        x = winfo.x + xofs;
+        y = winfo.y + yofs;
 
-    /*
-     * Normalize the new window coordinates so we don't
-     * lose the window off the edge of the screen.
-     */
-    if (x < (0 - winfo.width + CURSOR_WIDTH - (winfo.border_width << 1)))
-        x = 0 - winfo.width + CURSOR_WIDTH - (winfo.border_width << 1);
-    if (y < (0 - winfo.height + CURSOR_HEIGHT - (winfo.border_width << 1)))
-        y = 0 - winfo.height + CURSOR_HEIGHT - (winfo.border_width << 1);
-    if (x > (ScreenWidth - CURSOR_WIDTH))
-        x = ScreenWidth - CURSOR_WIDTH;
-    if (y > (ScreenHeight - CURSOR_HEIGHT))
-        y = ScreenHeight - CURSOR_HEIGHT;
+        /*
+         * Normalize the new window coordinates so we don't
+         * lose the window off the edge of the screen.
+         */
+        if (x < (0 - winfo.width + CURSOR_WIDTH - (winfo.border_width << 1)))
+                x = 0 - winfo.width + CURSOR_WIDTH - (winfo.border_width << 1);
+        if (y < (0 - winfo.height + CURSOR_HEIGHT - (winfo.border_width << 1)))
+                y =
+                  0 - winfo.height + CURSOR_HEIGHT - (winfo.border_width << 1);
+        if (x > (ScreenWidth - CURSOR_WIDTH))
+                x = ScreenWidth - CURSOR_WIDTH;
+        if (y > (ScreenHeight - CURSOR_HEIGHT))
+                y = ScreenHeight - CURSOR_HEIGHT;
 
-    /*
-     * Move the window into place.
-     */
-    XMoveWindow(dpy, w, x, y);
+        /*
+         * Move the window into place.
+         */
+        XMoveWindow (dpy, w, x, y);
 
-    return(FALSE);
+        return (FALSE);
 }