Replace flags instead bool in global struct

This commit is contained in:
Martin Duquesnoy
2012-01-17 13:08:20 +01:00
parent 334d2d47e3
commit 717fa182d4
2 changed files with 11 additions and 10 deletions

View File

@@ -154,7 +154,7 @@ wmfs_xinit(void)
*/ */
SLIST_INIT(&W->h.barwin); SLIST_INIT(&W->h.barwin);
W->running = true; W->flags |= WMFS_RUNNING;
} }
void void
@@ -344,7 +344,7 @@ wmfs_loop(void)
int maxfd, fd = ConnectionNumber(W->dpy); int maxfd, fd = ConnectionNumber(W->dpy);
fd_set iset; fd_set iset;
while(W->running) while(W->flags & WMFS_RUNNING)
{ {
maxfd = fd + 1; maxfd = fd + 1;
@@ -361,7 +361,7 @@ wmfs_loop(void)
{ {
if(FD_ISSET(fd, &iset)) if(FD_ISSET(fd, &iset))
{ {
while(W->running && XPending(W->dpy)) while((W->flags & WMFS_RUNNING) && XPending(W->dpy))
{ {
XNextEvent(W->dpy, &ev); XNextEvent(W->dpy, &ev);
EVENT_HANDLE(&ev); EVENT_HANDLE(&ev);
@@ -446,7 +446,7 @@ wmfs_quit(void)
unlink(W->fifo.path); unlink(W->fifo.path);
} }
W->running = false; W->flags &= ~WMFS_RUNNING;
XCloseDisplay(W->dpy); XCloseDisplay(W->dpy);
} }
@@ -458,8 +458,8 @@ uicb_reload(Uicb cmd)
{ {
(void)cmd; (void)cmd;
W->running = false; W->flags &= ~WMFS_RUNNING;
W->reload = true; W->flags |= WMFS_RELOAD;
} }
void void
@@ -467,7 +467,7 @@ uicb_quit(Uicb cmd)
{ {
(void)cmd; (void)cmd;
W->running = false; W->flags &= ~WMFS_RUNNING;
} }
int int
@@ -519,7 +519,7 @@ main(int argc, char **argv)
wmfs_loop(); wmfs_loop();
wmfs_quit(); wmfs_quit();
r = W->reload; r = (W->flags & WMFS_RELOAD);
free(W); free(W);
if(r) if(r)

View File

@@ -271,13 +271,14 @@ struct wmfs
int xmaxw, xmaxh; int xmaxw, xmaxh;
int nscreen; int nscreen;
Flags numlockmask; Flags numlockmask;
#define WMFS_SCAN 0x01 #define WMFS_SCAN 0x01
#define WMFS_RUNNING 0x02
#define WMFS_RELOAD 0x04
Flags flags; Flags flags;
GC gc, rgc; GC gc, rgc;
Atom *net_atom; Atom *net_atom;
char **argv; char **argv;
char confpath[MAX_PATH_LEN]; char confpath[MAX_PATH_LEN];
bool running, reload;
/* FIFO stuffs */ /* FIFO stuffs */
struct struct