[hackers] [wmii] Replace #defines with enums

From: Kris Maglione <jg_AT_suckless.org>
Date: Tue Feb 27 21:34:50 2007

changeset: 1972:42edcdd19d7b
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Feb 27 15:34:05 2007 -0500
summary: Replace #defines with enums

diff -r dc5626765b61 -r 42edcdd19d7b client.c
--- a/client.c Tue Feb 27 03:39:40 2007 -0500
+++ b/client.c Tue Feb 27 15:34:05 2007 -0500
@@ -12,8 +12,15 @@ static char Ebadcmd[] = "bad command",
 static char Ebadcmd[] = "bad command",
             Ebadvalue[] = "bad value";
 
-#define CLIENT_MASK (StructureNotifyMask | PropertyChangeMask | EnterWindowMask | FocusChangeMask)
-#define ButtonMask (ButtonPressMask | ButtonReleaseMask)
+enum {
+ ClientMask =
+ StructureNotifyMask
+ | PropertyChangeMask
+ | EnterWindowMask
+ | FocusChangeMask,
+ ButtonMask =
+ ButtonPressMask | ButtonReleaseMask
+};
 
 Client *
 create_client(Window w, XWindowAttributes *wa) {
@@ -230,9 +237,9 @@ void
 void
 map_client(Client *c) {
         if(!c->mapped) {
- XSelectInput(blz.dpy, c->win, CLIENT_MASK & ~StructureNotifyMask);
+ XSelectInput(blz.dpy, c->win, ClientMask & ~StructureNotifyMask);
                 XMapWindow(blz.dpy, c->win);
- XSelectInput(blz.dpy, c->win, CLIENT_MASK);
+ XSelectInput(blz.dpy, c->win, ClientMask);
                 set_client_state(c, NormalState);
                 c->mapped = 1;
         }
@@ -241,9 +248,9 @@ void
 void
 unmap_client(Client *c, int state) {
         if(c->mapped) {
- XSelectInput(blz.dpy, c->win, CLIENT_MASK & ~StructureNotifyMask);
+ XSelectInput(blz.dpy, c->win, ClientMask & ~StructureNotifyMask);
                 XUnmapWindow(blz.dpy, c->win);
- XSelectInput(blz.dpy, c->win, CLIENT_MASK);
+ XSelectInput(blz.dpy, c->win, ClientMask);
                 c->unmapped++;
                 set_client_state(c, state);
                 c->mapped = 0;
@@ -279,9 +286,9 @@ unmap_frame(Client *c) {
 
 void
 reparent_client(Client *c, Window w, int x, int y) {
- XSelectInput(blz.dpy, c->win, CLIENT_MASK & ~StructureNotifyMask);
+ XSelectInput(blz.dpy, c->win, ClientMask & ~StructureNotifyMask);
         XReparentWindow(blz.dpy, c->win, w, x, y);
- XSelectInput(blz.dpy, c->win, CLIENT_MASK);
+ XSelectInput(blz.dpy, c->win, ClientMask);
 }
 
 void
diff -r dc5626765b61 -r 42edcdd19d7b mouse.c
--- a/mouse.c Tue Feb 27 03:39:40 2007 -0500
+++ b/mouse.c Tue Feb 27 15:34:05 2007 -0500
@@ -7,8 +7,12 @@
 #include <string.h>
 #include <unistd.h>
 
-#define ButtonMask (ButtonPressMask | ButtonReleaseMask)
-#define MouseMask (ButtonMask | PointerMotionMask)
+enum {
+ ButtonMask =
+ ButtonPressMask | ButtonReleaseMask,
+ MouseMask =
+ ButtonMask | PointerMotionMask
+};
 
 static void
 rect_morph_xy(XRectangle *rect, int dx, int dy, BlitzAlign *mask) {
Received on Tue Feb 27 2007 - 21:34:50 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:59 UTC