summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-11-08 22:48:43 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-11-08 22:48:43 +0100
commit3c91283ede911916452345d545435b08dce9d556 (patch)
treea4da41ed799abaffda5d7166a6c84d97cc4a4625
parentsort include + whitespace fix (diff)
downloaddwm-3c91283ede911916452345d545435b08dce9d556.tar.gz
dwm-3c91283ede911916452345d545435b08dce9d556.zip
unboolification
-rw-r--r--config.def.h14
-rw-r--r--dwm.c141
2 files changed, 77 insertions, 78 deletions
diff --git a/config.def.h b/config.def.h
index 76073a5..7054c06 100644
--- a/config.def.h
+++ b/config.def.h
@@ -13,8 +13,8 @@ static const char selbgcolor[] = "#005577";
13static const char selfgcolor[] = "#eeeeee"; 13static const char selfgcolor[] = "#eeeeee";
14static const unsigned int borderpx = 1; /* border pixel of windows */ 14static const unsigned int borderpx = 1; /* border pixel of windows */
15static const unsigned int snap = 32; /* snap pixel */ 15static const unsigned int snap = 32; /* snap pixel */
16static const bool showbar = true; /* false means no bar */ 16static const int showbar = 1; /* 0 means no bar */
17static const bool topbar = true; /* false means bottom bar */ 17static const int topbar = 1; /* 0 means bottom bar */
18 18
19/* tagging */ 19/* tagging */
20static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; 20static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
@@ -25,14 +25,14 @@ static const Rule rules[] = {
25 * WM_NAME(STRING) = title 25 * WM_NAME(STRING) = title
26 */ 26 */
27 /* class instance title tags mask isfloating monitor */ 27 /* class instance title tags mask isfloating monitor */
28 { "Gimp", NULL, NULL, 0, true, -1 }, 28 { "Gimp", NULL, NULL, 0, 1, -1 },
29 { "Firefox", NULL, NULL, 1 << 8, false, -1 }, 29 { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
30}; 30};
31 31
32/* layout(s) */ 32/* layout(s) */
33static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ 33static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
34static const int nmaster = 1; /* number of clients in master area */ 34static const int nmaster = 1; /* number of clients in master area */
35static const bool resizehints = true; /* true means respect size hints in tiled resizals */ 35static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
36 36
37static const Layout layouts[] = { 37static const Layout layouts[] = {
38 /* symbol arrange function */ 38 /* symbol arrange function */
diff --git a/dwm.c b/dwm.c
index 9f99640..fb56d55 100644
--- a/dwm.c
+++ b/dwm.c
@@ -24,7 +24,6 @@
24#include <locale.h> 24#include <locale.h>
25#include <signal.h> 25#include <signal.h>
26#include <stdarg.h> 26#include <stdarg.h>
27#include <stdbool.h>
28#include <stdio.h> 27#include <stdio.h>
29#include <stdlib.h> 28#include <stdlib.h>
30#include <string.h> 29#include <string.h>
@@ -93,7 +92,7 @@ struct Client {
93 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 92 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
94 int bw, oldbw; 93 int bw, oldbw;
95 unsigned int tags; 94 unsigned int tags;
96 bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; 95 int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
97 Client *next; 96 Client *next;
98 Client *snext; 97 Client *snext;
99 Monitor *mon; 98 Monitor *mon;
@@ -123,8 +122,8 @@ struct Monitor {
123 unsigned int seltags; 122 unsigned int seltags;
124 unsigned int sellt; 123 unsigned int sellt;
125 unsigned int tagset[2]; 124 unsigned int tagset[2];
126 bool showbar; 125 int showbar;
127 bool topbar; 126 int topbar;
128 Client *clients; 127 Client *clients;
129 Client *sel; 128 Client *sel;
130 Client *stack; 129 Client *stack;
@@ -138,13 +137,13 @@ typedef struct {
138 const char *instance; 137 const char *instance;
139 const char *title; 138 const char *title;
140 unsigned int tags; 139 unsigned int tags;
141 bool isfloating; 140 int isfloating;
142 int monitor; 141 int monitor;
143} Rule; 142} Rule;
144 143
145/* function declarations */ 144/* function declarations */
146static void applyrules(Client *c); 145static void applyrules(Client *c);
147static bool applysizehints(Client *c, int *x, int *y, int *w, int *h, bool interact); 146static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
148static void arrange(Monitor *m); 147static void arrange(Monitor *m);
149static void arrangemon(Monitor *m); 148static void arrangemon(Monitor *m);
150static void attach(Client *c); 149static void attach(Client *c);
@@ -171,10 +170,10 @@ static void focus(Client *c);
171static void focusin(XEvent *e); 170static void focusin(XEvent *e);
172static void focusmon(const Arg *arg); 171static void focusmon(const Arg *arg);
173static void focusstack(const Arg *arg); 172static void focusstack(const Arg *arg);
174static bool getrootptr(int *x, int *y); 173static int getrootptr(int *x, int *y);
175static long getstate(Window w); 174static long getstate(Window w);
176static bool gettextprop(Window w, Atom atom, char *text, unsigned int size); 175static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
177static void grabbuttons(Client *c, bool focused); 176static void grabbuttons(Client *c, int focused);
178static void grabkeys(void); 177static void grabkeys(void);
179static void incnmaster(const Arg *arg); 178static void incnmaster(const Arg *arg);
180static void keypress(XEvent *e); 179static void keypress(XEvent *e);
@@ -190,17 +189,17 @@ static void pop(Client *);
190static void propertynotify(XEvent *e); 189static void propertynotify(XEvent *e);
191static void quit(const Arg *arg); 190static void quit(const Arg *arg);
192static Monitor *recttomon(int x, int y, int w, int h); 191static Monitor *recttomon(int x, int y, int w, int h);
193static void resize(Client *c, int x, int y, int w, int h, bool interact); 192static void resize(Client *c, int x, int y, int w, int h, int interact);
194static void resizeclient(Client *c, int x, int y, int w, int h); 193static void resizeclient(Client *c, int x, int y, int w, int h);
195static void resizemouse(const Arg *arg); 194static void resizemouse(const Arg *arg);
196static void restack(Monitor *m); 195static void restack(Monitor *m);
197static void run(void); 196static void run(void);
198static void scan(void); 197static void scan(void);
199static bool sendevent(Client *c, Atom proto); 198static int sendevent(Client *c, Atom proto);
200static void sendmon(Client *c, Monitor *m); 199static void sendmon(Client *c, Monitor *m);
201static void setclientstate(Client *c, long state); 200static void setclientstate(Client *c, long state);
202static void setfocus(Client *c); 201static void setfocus(Client *c);
203static void setfullscreen(Client *c, bool fullscreen); 202static void setfullscreen(Client *c, int fullscreen);
204static void setlayout(const Arg *arg); 203static void setlayout(const Arg *arg);
205static void setmfact(const Arg *arg); 204static void setmfact(const Arg *arg);
206static void setup(void); 205static void setup(void);
@@ -214,10 +213,10 @@ static void togglebar(const Arg *arg);
214static void togglefloating(const Arg *arg); 213static void togglefloating(const Arg *arg);
215static void toggletag(const Arg *arg); 214static void toggletag(const Arg *arg);
216static void toggleview(const Arg *arg); 215static void toggleview(const Arg *arg);
217static void unfocus(Client *c, bool setfocus); 216static void unfocus(Client *c, int setfocus);
218static void unmanage(Client *c, bool destroyed); 217static void unmanage(Client *c, int destroyed);
219static void unmapnotify(XEvent *e); 218static void unmapnotify(XEvent *e);
220static bool updategeom(void); 219static int updategeom(void);
221static void updatebarpos(Monitor *m); 220static void updatebarpos(Monitor *m);
222static void updatebars(void); 221static void updatebars(void);
223static void updateclientlist(void); 222static void updateclientlist(void);
@@ -260,7 +259,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
260 [UnmapNotify] = unmapnotify 259 [UnmapNotify] = unmapnotify
261}; 260};
262static Atom wmatom[WMLast], netatom[NetLast]; 261static Atom wmatom[WMLast], netatom[NetLast];
263static bool running = true; 262static int running = 1;
264static Cur *cursor[CurLast]; 263static Cur *cursor[CurLast];
265static ClrScheme scheme[SchemeLast]; 264static ClrScheme scheme[SchemeLast];
266static Display *dpy; 265static Display *dpy;
@@ -284,7 +283,7 @@ applyrules(Client *c) {
284 XClassHint ch = { NULL, NULL }; 283 XClassHint ch = { NULL, NULL };
285 284
286 /* rule matching */ 285 /* rule matching */
287 c->isfloating = false; 286 c->isfloating = 0;
288 c->tags = 0; 287 c->tags = 0;
289 XGetClassHint(dpy, c->win, &ch); 288 XGetClassHint(dpy, c->win, &ch);
290 class = ch.res_class ? ch.res_class : broken; 289 class = ch.res_class ? ch.res_class : broken;
@@ -310,9 +309,9 @@ applyrules(Client *c) {
310 c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; 309 c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
311} 310}
312 311
313bool 312int
314applysizehints(Client *c, int *x, int *y, int *w, int *h, bool interact) { 313applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) {
315 bool baseismin; 314 int baseismin;
316 Monitor *m = c->mon; 315 Monitor *m = c->mon;
317 316
318 /* set minimum possible */ 317 /* set minimum possible */
@@ -419,7 +418,7 @@ buttonpress(XEvent *e) {
419 click = ClkRootWin; 418 click = ClkRootWin;
420 /* focus monitor if necessary */ 419 /* focus monitor if necessary */
421 if((m = wintomon(ev->window)) && m != selmon) { 420 if((m = wintomon(ev->window)) && m != selmon) {
422 unfocus(selmon->sel, true); 421 unfocus(selmon->sel, 1);
423 selmon = m; 422 selmon = m;
424 focus(NULL); 423 focus(NULL);
425 } 424 }
@@ -470,7 +469,7 @@ cleanup(void) {
470 selmon->lt[selmon->sellt] = &foo; 469 selmon->lt[selmon->sellt] = &foo;
471 for(m = mons; m; m = m->next) 470 for(m = mons; m; m = m->next)
472 while(m->stack) 471 while(m->stack)
473 unmanage(m->stack, false); 472 unmanage(m->stack, 0);
474 XUngrabKey(dpy, AnyKey, AnyModifier, root); 473 XUngrabKey(dpy, AnyKey, AnyModifier, root);
475 while(mons) 474 while(mons)
476 cleanupmon(mons); 475 cleanupmon(mons);
@@ -506,7 +505,7 @@ void
506clearurgent(Client *c) { 505clearurgent(Client *c) {
507 XWMHints *wmh; 506 XWMHints *wmh;
508 507
509 c->isurgent = false; 508 c->isurgent = 0;
510 if(!(wmh = XGetWMHints(dpy, c->win))) 509 if(!(wmh = XGetWMHints(dpy, c->win)))
511 return; 510 return;
512 wmh->flags &= ~XUrgencyHint; 511 wmh->flags &= ~XUrgencyHint;
@@ -557,7 +556,7 @@ void
557configurenotify(XEvent *e) { 556configurenotify(XEvent *e) {
558 Monitor *m; 557 Monitor *m;
559 XConfigureEvent *ev = &e->xconfigure; 558 XConfigureEvent *ev = &e->xconfigure;
560 bool dirty; 559 int dirty;
561 560
562 /* TODO: updategeom handling sucks, needs to be simplified */ 561 /* TODO: updategeom handling sucks, needs to be simplified */
563 if(ev->window == root) { 562 if(ev->window == root) {
@@ -650,7 +649,7 @@ destroynotify(XEvent *e) {
650 XDestroyWindowEvent *ev = &e->xdestroywindow; 649 XDestroyWindowEvent *ev = &e->xdestroywindow;
651 650
652 if((c = wintoclient(ev->window))) 651 if((c = wintoclient(ev->window)))
653 unmanage(c, true); 652 unmanage(c, 1);
654} 653}
655 654
656void 655void
@@ -761,7 +760,7 @@ enternotify(XEvent *e) {
761 c = wintoclient(ev->window); 760 c = wintoclient(ev->window);
762 m = c ? c->mon : wintomon(ev->window); 761 m = c ? c->mon : wintomon(ev->window);
763 if(m != selmon) { 762 if(m != selmon) {
764 unfocus(selmon->sel, true); 763 unfocus(selmon->sel, 1);
765 selmon = m; 764 selmon = m;
766 } 765 }
767 else if(!c || c == selmon->sel) 766 else if(!c || c == selmon->sel)
@@ -784,7 +783,7 @@ focus(Client *c) {
784 for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); 783 for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
785 /* was if(selmon->sel) */ 784 /* was if(selmon->sel) */
786 if(selmon->sel && selmon->sel != c) 785 if(selmon->sel && selmon->sel != c)
787 unfocus(selmon->sel, false); 786 unfocus(selmon->sel, 0);
788 if(c) { 787 if(c) {
789 if(c->mon != selmon) 788 if(c->mon != selmon)
790 selmon = c->mon; 789 selmon = c->mon;
@@ -792,7 +791,7 @@ focus(Client *c) {
792 clearurgent(c); 791 clearurgent(c);
793 detachstack(c); 792 detachstack(c);
794 attachstack(c); 793 attachstack(c);
795 grabbuttons(c, true); 794 grabbuttons(c, 1);
796 XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix); 795 XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix);
797 setfocus(c); 796 setfocus(c);
798 } 797 }
@@ -820,7 +819,7 @@ focusmon(const Arg *arg) {
820 return; 819 return;
821 if((m = dirtomon(arg->i)) == selmon) 820 if((m = dirtomon(arg->i)) == selmon)
822 return; 821 return;
823 unfocus(selmon->sel, false); /* s/true/false/ fixes input focus issues 822 unfocus(selmon->sel, 0); /* s/1/0/ fixes input focus issues
824 in gedit and anjuta */ 823 in gedit and anjuta */
825 selmon = m; 824 selmon = m;
826 focus(NULL); 825 focus(NULL);
@@ -867,13 +866,13 @@ getatomprop(Client *c, Atom prop) {
867 return atom; 866 return atom;
868} 867}
869 868
870bool 869int
871getrootptr(int *x, int *y) { 870getrootptr(int *x, int *y) {
872 int di; 871 int di;
873 unsigned int dui; 872 unsigned int dui;
874 Window dummy; 873 Window dummy;
875 874
876 return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui) == True; 875 return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui);
877} 876}
878 877
879long 878long
@@ -893,18 +892,18 @@ getstate(Window w) {
893 return result; 892 return result;
894} 893}
895 894
896bool 895int
897gettextprop(Window w, Atom atom, char *text, unsigned int size) { 896gettextprop(Window w, Atom atom, char *text, unsigned int size) {
898 char **list = NULL; 897 char **list = NULL;
899 int n; 898 int n;
900 XTextProperty name; 899 XTextProperty name;
901 900
902 if(!text || size == 0) 901 if(!text || size == 0)
903 return false; 902 return 0;
904 text[0] = '\0'; 903 text[0] = '\0';
905 XGetTextProperty(dpy, w, &name, atom); 904 XGetTextProperty(dpy, w, &name, atom);
906 if(!name.nitems) 905 if(!name.nitems)
907 return false; 906 return 0;
908 if(name.encoding == XA_STRING) 907 if(name.encoding == XA_STRING)
909 strncpy(text, (char *)name.value, size - 1); 908 strncpy(text, (char *)name.value, size - 1);
910 else { 909 else {
@@ -915,11 +914,11 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) {
915 } 914 }
916 text[size - 1] = '\0'; 915 text[size - 1] = '\0';
917 XFree(name.value); 916 XFree(name.value);
918 return true; 917 return 1;
919} 918}
920 919
921void 920void
922grabbuttons(Client *c, bool focused) { 921grabbuttons(Client *c, int focused) {
923 updatenumlockmask(); 922 updatenumlockmask();
924 { 923 {
925 unsigned int i, j; 924 unsigned int i, j;
@@ -964,13 +963,13 @@ incnmaster(const Arg *arg) {
964} 963}
965 964
966#ifdef XINERAMA 965#ifdef XINERAMA
967static bool 966static int
968isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) { 967isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) {
969 while(n--) 968 while(n--)
970 if(unique[n].x_org == info->x_org && unique[n].y_org == info->y_org 969 if(unique[n].x_org == info->x_org && unique[n].y_org == info->y_org
971 && unique[n].width == info->width && unique[n].height == info->height) 970 && unique[n].width == info->width && unique[n].height == info->height)
972 return false; 971 return 0;
973 return true; 972 return 1;
974} 973}
975#endif /* XINERAMA */ 974#endif /* XINERAMA */
976 975
@@ -1046,7 +1045,7 @@ manage(Window w, XWindowAttributes *wa) {
1046 updatesizehints(c); 1045 updatesizehints(c);
1047 updatewmhints(c); 1046 updatewmhints(c);
1048 XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); 1047 XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
1049 grabbuttons(c, false); 1048 grabbuttons(c, 0);
1050 if(!c->isfloating) 1049 if(!c->isfloating)
1051 c->isfloating = c->oldstate = trans != None || c->isfixed; 1050 c->isfloating = c->oldstate = trans != None || c->isfixed;
1052 if(c->isfloating) 1051 if(c->isfloating)
@@ -1058,7 +1057,7 @@ manage(Window w, XWindowAttributes *wa) {
1058 XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ 1057 XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
1059 setclientstate(c, NormalState); 1058 setclientstate(c, NormalState);
1060 if (c->mon == selmon) 1059 if (c->mon == selmon)
1061 unfocus(selmon->sel, false); 1060 unfocus(selmon->sel, 0);
1062 c->mon->sel = c; 1061 c->mon->sel = c;
1063 arrange(c->mon); 1062 arrange(c->mon);
1064 XMapWindow(dpy, c->win); 1063 XMapWindow(dpy, c->win);
@@ -1098,7 +1097,7 @@ monocle(Monitor *m) {
1098 if(n > 0) /* override layout symbol */ 1097 if(n > 0) /* override layout symbol */
1099 snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); 1098 snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
1100 for(c = nexttiled(m->clients); c; c = nexttiled(c->next)) 1099 for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
1101 resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, false); 1100 resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
1102} 1101}
1103 1102
1104void 1103void
@@ -1110,7 +1109,7 @@ motionnotify(XEvent *e) {
1110 if(ev->window != root) 1109 if(ev->window != root)
1111 return; 1110 return;
1112 if((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { 1111 if((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
1113 unfocus(selmon->sel, true); 1112 unfocus(selmon->sel, 1);
1114 selmon = m; 1113 selmon = m;
1115 focus(NULL); 1114 focus(NULL);
1116 } 1115 }
@@ -1167,7 +1166,7 @@ movemouse(const Arg *arg) {
1167 togglefloating(NULL); 1166 togglefloating(NULL);
1168 } 1167 }
1169 if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) 1168 if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
1170 resize(c, nx, ny, c->w, c->h, true); 1169 resize(c, nx, ny, c->w, c->h, 1);
1171 break; 1170 break;
1172 } 1171 }
1173 } while(ev.type != ButtonRelease); 1172 } while(ev.type != ButtonRelease);
@@ -1231,7 +1230,7 @@ propertynotify(XEvent *e) {
1231 1230
1232void 1231void
1233quit(const Arg *arg) { 1232quit(const Arg *arg) {
1234 running = false; 1233 running = 0;
1235} 1234}
1236 1235
1237Monitor * 1236Monitor *
@@ -1248,7 +1247,7 @@ recttomon(int x, int y, int w, int h) {
1248} 1247}
1249 1248
1250void 1249void
1251resize(Client *c, int x, int y, int w, int h, bool interact) { 1250resize(Client *c, int x, int y, int w, int h, int interact) {
1252 if(applysizehints(c, &x, &y, &w, &h, interact)) 1251 if(applysizehints(c, &x, &y, &w, &h, interact))
1253 resizeclient(c, x, y, w, h); 1252 resizeclient(c, x, y, w, h);
1254} 1253}
@@ -1309,7 +1308,7 @@ resizemouse(const Arg *arg) {
1309 togglefloating(NULL); 1308 togglefloating(NULL);
1310 } 1309 }
1311 if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) 1310 if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
1312 resize(c, c->x, c->y, nw, nh, true); 1311 resize(c, c->x, c->y, nw, nh, 1);
1313 break; 1312 break;
1314 } 1313 }
1315 } while(ev.type != ButtonRelease); 1314 } while(ev.type != ButtonRelease);
@@ -1387,7 +1386,7 @@ void
1387sendmon(Client *c, Monitor *m) { 1386sendmon(Client *c, Monitor *m) {
1388 if(c->mon == m) 1387 if(c->mon == m)
1389 return; 1388 return;
1390 unfocus(c, true); 1389 unfocus(c, 1);
1391 detach(c); 1390 detach(c);
1392 detachstack(c); 1391 detachstack(c);
1393 c->mon = m; 1392 c->mon = m;
@@ -1406,11 +1405,11 @@ setclientstate(Client *c, long state) {
1406 PropModeReplace, (unsigned char *)data, 2); 1405 PropModeReplace, (unsigned char *)data, 2);
1407} 1406}
1408 1407
1409bool 1408int
1410sendevent(Client *c, Atom proto) { 1409sendevent(Client *c, Atom proto) {
1411 int n; 1410 int n;
1412 Atom *protocols; 1411 Atom *protocols;
1413 bool exists = false; 1412 int exists = 0;
1414 XEvent ev; 1413 XEvent ev;
1415 1414
1416 if(XGetWMProtocols(dpy, c->win, &protocols, &n)) { 1415 if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
@@ -1442,22 +1441,22 @@ setfocus(Client *c) {
1442} 1441}
1443 1442
1444void 1443void
1445setfullscreen(Client *c, bool fullscreen) { 1444setfullscreen(Client *c, int fullscreen) {
1446 if(fullscreen && !c->isfullscreen) { 1445 if(fullscreen && !c->isfullscreen) {
1447 XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, 1446 XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
1448 PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); 1447 PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
1449 c->isfullscreen = true; 1448 c->isfullscreen = 1;
1450 c->oldstate = c->isfloating; 1449 c->oldstate = c->isfloating;
1451 c->oldbw = c->bw; 1450 c->oldbw = c->bw;
1452 c->bw = 0; 1451 c->bw = 0;
1453 c->isfloating = true; 1452 c->isfloating = 1;
1454 resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh); 1453 resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
1455 XRaiseWindow(dpy, c->win); 1454 XRaiseWindow(dpy, c->win);
1456 } 1455 }
1457 else if(!fullscreen && c->isfullscreen){ 1456 else if(!fullscreen && c->isfullscreen){
1458 XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, 1457 XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
1459 PropModeReplace, (unsigned char*)0, 0); 1458 PropModeReplace, (unsigned char*)0, 0);
1460 c->isfullscreen = false; 1459 c->isfullscreen = 0;
1461 c->isfloating = c->oldstate; 1460 c->isfloating = c->oldstate;
1462 c->bw = c->oldbw; 1461 c->bw = c->oldbw;
1463 c->x = c->oldx; 1462 c->x = c->oldx;
@@ -1562,7 +1561,7 @@ showhide(Client *c) {
1562 if(ISVISIBLE(c)) { /* show clients top down */ 1561 if(ISVISIBLE(c)) { /* show clients top down */
1563 XMoveWindow(dpy, c->win, c->x, c->y); 1562 XMoveWindow(dpy, c->win, c->x, c->y);
1564 if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) 1563 if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
1565 resize(c, c->x, c->y, c->w, c->h, false); 1564 resize(c, c->x, c->y, c->w, c->h, 0);
1566 showhide(c->snext); 1565 showhide(c->snext);
1567 } 1566 }
1568 else { /* hide clients bottom up */ 1567 else { /* hide clients bottom up */
@@ -1625,12 +1624,12 @@ tile(Monitor *m) {
1625 for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) 1624 for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
1626 if(i < m->nmaster) { 1625 if(i < m->nmaster) {
1627 h = (m->wh - my) / (MIN(n, m->nmaster) - i); 1626 h = (m->wh - my) / (MIN(n, m->nmaster) - i);
1628 resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), false); 1627 resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
1629 my += HEIGHT(c); 1628 my += HEIGHT(c);
1630 } 1629 }
1631 else { 1630 else {
1632 h = (m->wh - ty) / (n - i); 1631 h = (m->wh - ty) / (n - i);
1633 resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), false); 1632 resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
1634 ty += HEIGHT(c); 1633 ty += HEIGHT(c);
1635 } 1634 }
1636} 1635}
@@ -1652,7 +1651,7 @@ togglefloating(const Arg *arg) {
1652 selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; 1651 selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
1653 if(selmon->sel->isfloating) 1652 if(selmon->sel->isfloating)
1654 resize(selmon->sel, selmon->sel->x, selmon->sel->y, 1653 resize(selmon->sel, selmon->sel->x, selmon->sel->y,
1655 selmon->sel->w, selmon->sel->h, false); 1654 selmon->sel->w, selmon->sel->h, 0);
1656 arrange(selmon); 1655 arrange(selmon);
1657} 1656}
1658 1657
@@ -1682,10 +1681,10 @@ toggleview(const Arg *arg) {
1682} 1681}
1683 1682
1684void 1683void
1685unfocus(Client *c, bool setfocus) { 1684unfocus(Client *c, int setfocus) {
1686 if(!c) 1685 if(!c)
1687 return; 1686 return;
1688 grabbuttons(c, false); 1687 grabbuttons(c, 0);
1689 XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->pix); 1688 XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->pix);
1690 if(setfocus) { 1689 if(setfocus) {
1691 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 1690 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
@@ -1694,7 +1693,7 @@ unfocus(Client *c, bool setfocus) {
1694} 1693}
1695 1694
1696void 1695void
1697unmanage(Client *c, bool destroyed) { 1696unmanage(Client *c, int destroyed) {
1698 Monitor *m = c->mon; 1697 Monitor *m = c->mon;
1699 XWindowChanges wc; 1698 XWindowChanges wc;
1700 1699
@@ -1727,7 +1726,7 @@ unmapnotify(XEvent *e) {
1727 if(ev->send_event) 1726 if(ev->send_event)
1728 setclientstate(c, WithdrawnState); 1727 setclientstate(c, WithdrawnState);
1729 else 1728 else
1730 unmanage(c, false); 1729 unmanage(c, 0);
1731 } 1730 }
1732} 1731}
1733 1732
@@ -1776,9 +1775,9 @@ updateclientlist() {
1776 (unsigned char *) &(c->win), 1); 1775 (unsigned char *) &(c->win), 1);
1777} 1776}
1778 1777
1779bool 1778int
1780updategeom(void) { 1779updategeom(void) {
1781 bool dirty = false; 1780 int dirty = 0;
1782 1781
1783#ifdef XINERAMA 1782#ifdef XINERAMA
1784 if(XineramaIsActive(dpy)) { 1783 if(XineramaIsActive(dpy)) {
@@ -1809,7 +1808,7 @@ updategeom(void) {
1809 || (unique[i].x_org != m->mx || unique[i].y_org != m->my 1808 || (unique[i].x_org != m->mx || unique[i].y_org != m->my
1810 || unique[i].width != m->mw || unique[i].height != m->mh)) 1809 || unique[i].width != m->mw || unique[i].height != m->mh))
1811 { 1810 {
1812 dirty = true; 1811 dirty = 1;
1813 m->num = i; 1812 m->num = i;
1814 m->mx = m->wx = unique[i].x_org; 1813 m->mx = m->wx = unique[i].x_org;
1815 m->my = m->wy = unique[i].y_org; 1814 m->my = m->wy = unique[i].y_org;
@@ -1822,7 +1821,7 @@ updategeom(void) {
1822 for(i = nn; i < n; i++) { 1821 for(i = nn; i < n; i++) {
1823 for(m = mons; m && m->next; m = m->next); 1822 for(m = mons; m && m->next; m = m->next);
1824 while(m->clients) { 1823 while(m->clients) {
1825 dirty = true; 1824 dirty = 1;
1826 c = m->clients; 1825 c = m->clients;
1827 m->clients = c->next; 1826 m->clients = c->next;
1828 detachstack(c); 1827 detachstack(c);
@@ -1844,7 +1843,7 @@ updategeom(void) {
1844 if(!mons) 1843 if(!mons)
1845 mons = createmon(); 1844 mons = createmon();
1846 if(mons->mw != sw || mons->mh != sh) { 1845 if(mons->mw != sw || mons->mh != sh) {
1847 dirty = true; 1846 dirty = 1;
1848 mons->mw = mons->ww = sw; 1847 mons->mw = mons->ww = sw;
1849 mons->mh = mons->wh = sh; 1848 mons->mh = mons->wh = sh;
1850 updatebarpos(mons); 1849 updatebarpos(mons);
@@ -1943,9 +1942,9 @@ updatewindowtype(Client *c) {
1943 Atom wtype = getatomprop(c, netatom[NetWMWindowType]); 1942 Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
1944 1943
1945 if(state == netatom[NetWMFullscreen]) 1944 if(state == netatom[NetWMFullscreen])
1946 setfullscreen(c, true); 1945 setfullscreen(c, 1);
1947 if(wtype == netatom[NetWMWindowTypeDialog]) 1946 if(wtype == netatom[NetWMWindowTypeDialog])
1948 c->isfloating = true; 1947 c->isfloating = 1;
1949} 1948}
1950 1949
1951void 1950void
@@ -1958,11 +1957,11 @@ updatewmhints(Client *c) {
1958 XSetWMHints(dpy, c->win, wmh); 1957 XSetWMHints(dpy, c->win, wmh);
1959 } 1958 }
1960 else 1959 else
1961 c->isurgent = (wmh->flags & XUrgencyHint) ? true : false; 1960 c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0;
1962 if(wmh->flags & InputHint) 1961 if(wmh->flags & InputHint)
1963 c->neverfocus = !wmh->input; 1962 c->neverfocus = !wmh->input;
1964 else 1963 else
1965 c->neverfocus = false; 1964 c->neverfocus = 0;
1966 XFree(wmh); 1965 XFree(wmh);
1967 } 1966 }
1968} 1967}