From 28bbf705eb3ea53c3db28fa213c47a2639f3ba88 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 29 Sep 2013 13:22:48 +0200 Subject: [PATCH] wmaker: Converted #define to an Enum for the Program State tracking variables --- src/WindowMaker.h | 22 ++++++++++++---------- src/main.c | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 6c29c9ce..ec8d7467 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -227,13 +227,15 @@ typedef struct WObjDescriptor { /* program states */ -#define WSTATE_NORMAL 0 -#define WSTATE_NEED_EXIT 1 -#define WSTATE_NEED_RESTART 2 -#define WSTATE_EXITING 3 -#define WSTATE_RESTARTING 4 -#define WSTATE_MODAL 5 -#define WSTATE_NEED_REREAD 6 +typedef enum { + WSTATE_NORMAL = 0, + WSTATE_NEED_EXIT = 1, + WSTATE_NEED_RESTART = 2, + WSTATE_EXITING = 3, + WSTATE_RESTARTING = 4, + WSTATE_MODAL = 5, + WSTATE_NEED_REREAD = 6 +} wprog_state; #define WCHECK_STATE(state) (state == WProgramState) @@ -241,7 +243,7 @@ typedef struct WObjDescriptor { #define WCHANGE_STATE(nstate) {\ if (WProgramState == WSTATE_NORMAL\ - || nstate != WSTATE_MODAL)\ + || (nstate) != WSTATE_MODAL)\ WProgramState = (nstate); \ if (WProgramSigState != 0)\ WProgramState = WProgramSigState;\ @@ -452,8 +454,8 @@ extern struct WPreferences { /****** Global Variables ******/ extern Display *dpy; extern unsigned int ValidModMask; -extern char WProgramState; -extern char WProgramSigState; +extern wprog_state WProgramState; +extern wprog_state WProgramSigState; /****** Notifications ******/ extern const char WMNManaged[]; diff --git a/src/main.c b/src/main.c index 69a68e22..faed4fe9 100644 --- a/src/main.c +++ b/src/main.c @@ -145,8 +145,8 @@ int wXkbEventBase; #endif /* special flags */ -char WProgramSigState = 0; -char WProgramState = WSTATE_NORMAL; +wprog_state WProgramSigState = 0; +wprog_state WProgramState = WSTATE_NORMAL; char WDelayedActionSet = 0; /* notifications */ -- 2.11.4.GIT