pinosaur
/
dwm.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
separate program-specific c99 bool and X11
[dwm.git]
/
dwm.c
diff --git
a/dwm.c
b/dwm.c
index
e2d7423
..
5d64141
100644
(file)
--- a/
dwm.c
+++ b/
dwm.c
@@
-24,6
+24,7
@@
#include <locale.h>
#include <stdarg.h>
#include <signal.h>
#include <locale.h>
#include <stdarg.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@
-92,7
+93,7
@@
struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw;
unsigned int tags;
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw;
unsigned int tags;
-
B
ool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
+
b
ool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
Client *next;
Client *snext;
Monitor *mon;
Client *next;
Client *snext;
Monitor *mon;
@@
-122,8
+123,8
@@
struct Monitor {
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
-
B
ool showbar;
-
B
ool topbar;
+
b
ool showbar;
+
b
ool topbar;
Client *clients;
Client *sel;
Client *stack;
Client *clients;
Client *sel;
Client *stack;
@@
-137,13
+138,13
@@
typedef struct {
const char *instance;
const char *title;
unsigned int tags;
const char *instance;
const char *title;
unsigned int tags;
-
B
ool isfloating;
+
b
ool isfloating;
int monitor;
} Rule;
/* function declarations */
static void applyrules(Client *c);
int monitor;
} Rule;
/* function declarations */
static void applyrules(Client *c);
-static
Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, B
ool interact);
+static
bool applysizehints(Client *c, int *x, int *y, int *w, int *h, b
ool interact);
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
@@
-170,10
+171,10
@@
static void focus(Client *c);
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
-static
B
ool getrootptr(int *x, int *y);
+static
b
ool getrootptr(int *x, int *y);
static long getstate(Window w);
static long getstate(Window w);
-static
B
ool gettextprop(Window w, Atom atom, char *text, unsigned int size);
-static void grabbuttons(Client *c,
B
ool focused);
+static
b
ool gettextprop(Window w, Atom atom, char *text, unsigned int size);
+static void grabbuttons(Client *c,
b
ool focused);
static void grabkeys(void);
static void incnmaster(const Arg *arg);
static void keypress(XEvent *e);
static void grabkeys(void);
static void incnmaster(const Arg *arg);
static void keypress(XEvent *e);
@@
-189,17
+190,17
@@
static void pop(Client *);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
-static void resize(Client *c, int x, int y, int w, int h,
B
ool interact);
+static void resize(Client *c, int x, int y, int w, int h,
b
ool interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
static void restack(Monitor *m);
static void run(void);
static void scan(void);
static void resizeclient(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
static void restack(Monitor *m);
static void run(void);
static void scan(void);
-static
B
ool sendevent(Client *c, Atom proto);
+static
b
ool sendevent(Client *c, Atom proto);
static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
-static void setfullscreen(Client *c,
B
ool fullscreen);
+static void setfullscreen(Client *c,
b
ool fullscreen);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
@@
-213,10
+214,10
@@
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
-static void unfocus(Client *c,
B
ool setfocus);
-static void unmanage(Client *c,
B
ool destroyed);
+static void unfocus(Client *c,
b
ool setfocus);
+static void unmanage(Client *c,
b
ool destroyed);
static void unmapnotify(XEvent *e);
static void unmapnotify(XEvent *e);
-static
B
ool updategeom(void);
+static
b
ool updategeom(void);
static void updatebarpos(Monitor *m);
static void updatebars(void);
static void updateclientlist(void);
static void updatebarpos(Monitor *m);
static void updatebars(void);
static void updateclientlist(void);
@@
-259,7
+260,7
@@
static void (*handler[LASTEvent]) (XEvent *) = {
[UnmapNotify] = unmapnotify
};
static Atom wmatom[WMLast], netatom[NetLast];
[UnmapNotify] = unmapnotify
};
static Atom wmatom[WMLast], netatom[NetLast];
-static
Bool running = T
rue;
+static
bool running = t
rue;
static Cur *cursor[CurLast];
static ClrScheme scheme[SchemeLast];
static Display *dpy;
static Cur *cursor[CurLast];
static ClrScheme scheme[SchemeLast];
static Display *dpy;
@@
-283,7
+284,8
@@
applyrules(Client *c) {
XClassHint ch = { NULL, NULL };
/* rule matching */
XClassHint ch = { NULL, NULL };
/* rule matching */
- c->isfloating = c->tags = 0;
+ c->isfloating = false;
+ c->tags = 0;
XGetClassHint(dpy, c->win, &ch);
class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken;
XGetClassHint(dpy, c->win, &ch);
class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken;
@@
-308,9
+310,9
@@
applyrules(Client *c) {
c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
}
c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
}
-
B
ool
-applysizehints(Client *c, int *x, int *y, int *w, int *h,
B
ool interact) {
-
B
ool baseismin;
+
b
ool
+applysizehints(Client *c, int *x, int *y, int *w, int *h,
b
ool interact) {
+
b
ool baseismin;
Monitor *m = c->mon;
/* set minimum possible */
Monitor *m = c->mon;
/* set minimum possible */
@@
-417,7
+419,7
@@
buttonpress(XEvent *e) {
click = ClkRootWin;
/* focus monitor if necessary */
if((m = wintomon(ev->window)) && m != selmon) {
click = ClkRootWin;
/* focus monitor if necessary */
if((m = wintomon(ev->window)) && m != selmon) {
- unfocus(selmon->sel,
T
rue);
+ unfocus(selmon->sel,
t
rue);
selmon = m;
focus(NULL);
}
selmon = m;
focus(NULL);
}
@@
-468,7
+470,7
@@
cleanup(void) {
selmon->lt[selmon->sellt] = &foo;
for(m = mons; m; m = m->next)
while(m->stack)
selmon->lt[selmon->sellt] = &foo;
for(m = mons; m; m = m->next)
while(m->stack)
- unmanage(m->stack,
F
alse);
+ unmanage(m->stack,
f
alse);
XUngrabKey(dpy, AnyKey, AnyModifier, root);
while(mons)
cleanupmon(mons);
XUngrabKey(dpy, AnyKey, AnyModifier, root);
while(mons)
cleanupmon(mons);
@@
-504,7
+506,7
@@
void
clearurgent(Client *c) {
XWMHints *wmh;
clearurgent(Client *c) {
XWMHints *wmh;
- c->isurgent =
F
alse;
+ c->isurgent =
f
alse;
if(!(wmh = XGetWMHints(dpy, c->win)))
return;
wmh->flags &= ~XUrgencyHint;
if(!(wmh = XGetWMHints(dpy, c->win)))
return;
wmh->flags &= ~XUrgencyHint;
@@
-555,7
+557,7
@@
void
configurenotify(XEvent *e) {
Monitor *m;
XConfigureEvent *ev = &e->xconfigure;
configurenotify(XEvent *e) {
Monitor *m;
XConfigureEvent *ev = &e->xconfigure;
-
B
ool dirty;
+
b
ool dirty;
/* TODO: updategeom handling sucks, needs to be simplified */
if(ev->window == root) {
/* TODO: updategeom handling sucks, needs to be simplified */
if(ev->window == root) {
@@
-630,8
+632,7
@@
Monitor *
createmon(void) {
Monitor *m;
createmon(void) {
Monitor *m;
- if(!(m = (Monitor *)calloc(1, sizeof(Monitor))))
- die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
+ m = ecalloc(1, sizeof(Monitor));
m->tagset[0] = m->tagset[1] = 1;
m->mfact = mfact;
m->nmaster = nmaster;
m->tagset[0] = m->tagset[1] = 1;
m->mfact = mfact;
m->nmaster = nmaster;
@@
-649,7
+650,7
@@
destroynotify(XEvent *e) {
XDestroyWindowEvent *ev = &e->xdestroywindow;
if((c = wintoclient(ev->window)))
XDestroyWindowEvent *ev = &e->xdestroywindow;
if((c = wintoclient(ev->window)))
- unmanage(c,
T
rue);
+ unmanage(c,
t
rue);
}
void
}
void
@@
-690,10
+691,12
@@
dirtomon(int dir) {
void
drawbar(Monitor *m) {
void
drawbar(Monitor *m) {
- int x, xx, w;
+ int x, xx, w
, dx
;
unsigned int i, occ = 0, urg = 0;
Client *c;
unsigned int i, occ = 0, urg = 0;
Client *c;
+ dx = (drw->fonts[0]->ascent + drw->fonts[0]->descent + 2) / 4;
+
for(c = m->clients; c; c = c->next) {
occ |= c->tags;
if(c->isurgent)
for(c = m->clients; c; c = c->next) {
occ |= c->tags;
if(c->isurgent)
@@
-704,7
+707,7
@@
drawbar(Monitor *m) {
w = TEXTW(tags[i]);
drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i);
w = TEXTW(tags[i]);
drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i);
- drw_rect(drw, x
, 0, w, bh
, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
+ drw_rect(drw, x
+ 1, 1, dx, dx
, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
occ & 1 << i, urg & 1 << i);
x += w;
}
occ & 1 << i, urg & 1 << i);
x += w;
}
@@
-729,11
+732,11
@@
drawbar(Monitor *m) {
if(m->sel) {
drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, m->sel->name, 0);
if(m->sel) {
drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, m->sel->name, 0);
- drw_rect(drw, x
, 0, w, bh
, m->sel->isfixed, m->sel->isfloating, 0);
+ drw_rect(drw, x
+ 1, 1, dx, dx
, m->sel->isfixed, m->sel->isfloating, 0);
}
else {
drw_setscheme(drw, &scheme[SchemeNorm]);
}
else {
drw_setscheme(drw, &scheme[SchemeNorm]);
- drw_
text(drw, x, 0, w, bh, NULL, 0
);
+ drw_
rect(drw, x, 0, w, bh, 1, 0, 1
);
}
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
}
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
@@
-758,7
+761,7
@@
enternotify(XEvent *e) {
c = wintoclient(ev->window);
m = c ? c->mon : wintomon(ev->window);
if(m != selmon) {
c = wintoclient(ev->window);
m = c ? c->mon : wintomon(ev->window);
if(m != selmon) {
- unfocus(selmon->sel,
T
rue);
+ unfocus(selmon->sel,
t
rue);
selmon = m;
}
else if(!c || c == selmon->sel)
selmon = m;
}
else if(!c || c == selmon->sel)
@@
-781,7
+784,7
@@
focus(Client *c) {
for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
/* was if(selmon->sel) */
if(selmon->sel && selmon->sel != c)
for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
/* was if(selmon->sel) */
if(selmon->sel && selmon->sel != c)
- unfocus(selmon->sel,
F
alse);
+ unfocus(selmon->sel,
f
alse);
if(c) {
if(c->mon != selmon)
selmon = c->mon;
if(c) {
if(c->mon != selmon)
selmon = c->mon;
@@
-789,7
+792,7
@@
focus(Client *c) {
clearurgent(c);
detachstack(c);
attachstack(c);
clearurgent(c);
detachstack(c);
attachstack(c);
- grabbuttons(c,
T
rue);
+ grabbuttons(c,
t
rue);
XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix);
setfocus(c);
}
XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix);
setfocus(c);
}
@@
-817,7
+820,7
@@
focusmon(const Arg *arg) {
return;
if((m = dirtomon(arg->i)) == selmon)
return;
return;
if((m = dirtomon(arg->i)) == selmon)
return;
- unfocus(selmon->sel,
False); /* s/True/F
alse/ fixes input focus issues
+ unfocus(selmon->sel,
false); /* s/true/f
alse/ fixes input focus issues
in gedit and anjuta */
selmon = m;
focus(NULL);
in gedit and anjuta */
selmon = m;
focus(NULL);
@@
-864,13
+867,13
@@
getatomprop(Client *c, Atom prop) {
return atom;
}
return atom;
}
-
B
ool
+
b
ool
getrootptr(int *x, int *y) {
int di;
unsigned int dui;
Window dummy;
getrootptr(int *x, int *y) {
int di;
unsigned int dui;
Window dummy;
- return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui);
+ return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui)
== True
;
}
long
}
long
@@
-890,18
+893,18
@@
getstate(Window w) {
return result;
}
return result;
}
-
B
ool
+
b
ool
gettextprop(Window w, Atom atom, char *text, unsigned int size) {
char **list = NULL;
int n;
XTextProperty name;
if(!text || size == 0)
gettextprop(Window w, Atom atom, char *text, unsigned int size) {
char **list = NULL;
int n;
XTextProperty name;
if(!text || size == 0)
- return
F
alse;
+ return
f
alse;
text[0] = '\0';
XGetTextProperty(dpy, w, &name, atom);
if(!name.nitems)
text[0] = '\0';
XGetTextProperty(dpy, w, &name, atom);
if(!name.nitems)
- return
F
alse;
+ return
f
alse;
if(name.encoding == XA_STRING)
strncpy(text, (char *)name.value, size - 1);
else {
if(name.encoding == XA_STRING)
strncpy(text, (char *)name.value, size - 1);
else {
@@
-912,11
+915,11
@@
gettextprop(Window w, Atom atom, char *text, unsigned int size) {
}
text[size - 1] = '\0';
XFree(name.value);
}
text[size - 1] = '\0';
XFree(name.value);
- return
T
rue;
+ return
t
rue;
}
void
}
void
-grabbuttons(Client *c,
B
ool focused) {
+grabbuttons(Client *c,
b
ool focused) {
updatenumlockmask();
{
unsigned int i, j;
updatenumlockmask();
{
unsigned int i, j;
@@
-961,13
+964,13
@@
incnmaster(const Arg *arg) {
}
#ifdef XINERAMA
}
#ifdef XINERAMA
-static
B
ool
+static
b
ool
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) {
while(n--)
if(unique[n].x_org == info->x_org && unique[n].y_org == info->y_org
&& unique[n].width == info->width && unique[n].height == info->height)
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) {
while(n--)
if(unique[n].x_org == info->x_org && unique[n].y_org == info->y_org
&& unique[n].width == info->width && unique[n].height == info->height)
- return
F
alse;
- return
T
rue;
+ return
f
alse;
+ return
t
rue;
}
#endif /* XINERAMA */
}
#endif /* XINERAMA */
@@
-1007,8
+1010,7
@@
manage(Window w, XWindowAttributes *wa) {
Window trans = None;
XWindowChanges wc;
Window trans = None;
XWindowChanges wc;
- if(!(c = calloc(1, sizeof(Client))))
- die("fatal: could not malloc() %u bytes\n", sizeof(Client));
+ c = ecalloc(1, sizeof(Client));
c->win = w;
updatetitle(c);
if(XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
c->win = w;
updatetitle(c);
if(XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
@@
-1044,7
+1046,7
@@
manage(Window w, XWindowAttributes *wa) {
updatesizehints(c);
updatewmhints(c);
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
updatesizehints(c);
updatewmhints(c);
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
- grabbuttons(c,
F
alse);
+ grabbuttons(c,
f
alse);
if(!c->isfloating)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if(c->isfloating)
if(!c->isfloating)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if(c->isfloating)
@@
-1056,7
+1058,7
@@
manage(Window w, XWindowAttributes *wa) {
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
setclientstate(c, NormalState);
if (c->mon == selmon)
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
setclientstate(c, NormalState);
if (c->mon == selmon)
- unfocus(selmon->sel,
F
alse);
+ unfocus(selmon->sel,
f
alse);
c->mon->sel = c;
arrange(c->mon);
XMapWindow(dpy, c->win);
c->mon->sel = c;
arrange(c->mon);
XMapWindow(dpy, c->win);
@@
-1096,7
+1098,7
@@
monocle(Monitor *m) {
if(n > 0) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
if(n > 0) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw,
F
alse);
+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw,
f
alse);
}
void
}
void
@@
-1108,7
+1110,7
@@
motionnotify(XEvent *e) {
if(ev->window != root)
return;
if((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
if(ev->window != root)
return;
if((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
- unfocus(selmon->sel,
T
rue);
+ unfocus(selmon->sel,
t
rue);
selmon = m;
focus(NULL);
}
selmon = m;
focus(NULL);
}
@@
-1165,7
+1167,7
@@
movemouse(const Arg *arg) {
togglefloating(NULL);
}
if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
togglefloating(NULL);
}
if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
- resize(c, nx, ny, c->w, c->h,
T
rue);
+ resize(c, nx, ny, c->w, c->h,
t
rue);
break;
}
} while(ev.type != ButtonRelease);
break;
}
} while(ev.type != ButtonRelease);
@@
-1229,7
+1231,7
@@
propertynotify(XEvent *e) {
void
quit(const Arg *arg) {
void
quit(const Arg *arg) {
- running =
F
alse;
+ running =
f
alse;
}
Monitor *
}
Monitor *
@@
-1246,7
+1248,7
@@
recttomon(int x, int y, int w, int h) {
}
void
}
void
-resize(Client *c, int x, int y, int w, int h,
B
ool interact) {
+resize(Client *c, int x, int y, int w, int h,
b
ool interact) {
if(applysizehints(c, &x, &y, &w, &h, interact))
resizeclient(c, x, y, w, h);
}
if(applysizehints(c, &x, &y, &w, &h, interact))
resizeclient(c, x, y, w, h);
}
@@
-1307,7
+1309,7
@@
resizemouse(const Arg *arg) {
togglefloating(NULL);
}
if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
togglefloating(NULL);
}
if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
- resize(c, c->x, c->y, nw, nh,
T
rue);
+ resize(c, c->x, c->y, nw, nh,
t
rue);
break;
}
} while(ev.type != ButtonRelease);
break;
}
} while(ev.type != ButtonRelease);
@@
-1385,7
+1387,7
@@
void
sendmon(Client *c, Monitor *m) {
if(c->mon == m)
return;
sendmon(Client *c, Monitor *m) {
if(c->mon == m)
return;
- unfocus(c,
T
rue);
+ unfocus(c,
t
rue);
detach(c);
detachstack(c);
c->mon = m;
detach(c);
detachstack(c);
c->mon = m;
@@
-1404,11
+1406,11
@@
setclientstate(Client *c, long state) {
PropModeReplace, (unsigned char *)data, 2);
}
PropModeReplace, (unsigned char *)data, 2);
}
-
B
ool
+
b
ool
sendevent(Client *c, Atom proto) {
int n;
Atom *protocols;
sendevent(Client *c, Atom proto) {
int n;
Atom *protocols;
-
Bool exists = F
alse;
+
bool exists = f
alse;
XEvent ev;
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
XEvent ev;
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
@@
-1440,22
+1442,22
@@
setfocus(Client *c) {
}
void
}
void
-setfullscreen(Client *c,
B
ool fullscreen) {
- if(fullscreen) {
+setfullscreen(Client *c,
b
ool fullscreen) {
+ if(fullscreen
&& !c->isfullscreen
) {
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
- c->isfullscreen =
T
rue;
+ c->isfullscreen =
t
rue;
c->oldstate = c->isfloating;
c->oldbw = c->bw;
c->bw = 0;
c->oldstate = c->isfloating;
c->oldbw = c->bw;
c->bw = 0;
- c->isfloating =
T
rue;
+ c->isfloating =
t
rue;
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
XRaiseWindow(dpy, c->win);
}
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
XRaiseWindow(dpy, c->win);
}
- else {
+ else
if(!fullscreen && c->isfullscreen)
{
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0);
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0);
- c->isfullscreen =
F
alse;
+ c->isfullscreen =
f
alse;
c->isfloating = c->oldstate;
c->bw = c->oldbw;
c->x = c->oldx;
c->isfloating = c->oldstate;
c->bw = c->oldbw;
c->x = c->oldx;
@@
-1560,7
+1562,7
@@
showhide(Client *c) {
if(ISVISIBLE(c)) { /* show clients top down */
XMoveWindow(dpy, c->win, c->x, c->y);
if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
if(ISVISIBLE(c)) { /* show clients top down */
XMoveWindow(dpy, c->win, c->x, c->y);
if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
- resize(c, c->x, c->y, c->w, c->h,
F
alse);
+ resize(c, c->x, c->y, c->w, c->h,
f
alse);
showhide(c->snext);
}
else { /* hide clients bottom up */
showhide(c->snext);
}
else { /* hide clients bottom up */
@@
-1623,12
+1625,12
@@
tile(Monitor *m) {
for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if(i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if(i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw),
F
alse);
+ resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw),
f
alse);
my += HEIGHT(c);
}
else {
h = (m->wh - ty) / (n - i);
my += HEIGHT(c);
}
else {
h = (m->wh - ty) / (n - i);
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw),
F
alse);
+ resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw),
f
alse);
ty += HEIGHT(c);
}
}
ty += HEIGHT(c);
}
}
@@
-1650,7
+1652,7
@@
togglefloating(const Arg *arg) {
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if(selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if(selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
- selmon->sel->w, selmon->sel->h,
F
alse);
+ selmon->sel->w, selmon->sel->h,
f
alse);
arrange(selmon);
}
arrange(selmon);
}
@@
-1680,10
+1682,10
@@
toggleview(const Arg *arg) {
}
void
}
void
-unfocus(Client *c,
B
ool setfocus) {
+unfocus(Client *c,
b
ool setfocus) {
if(!c)
return;
if(!c)
return;
- grabbuttons(c,
F
alse);
+ grabbuttons(c,
f
alse);
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->pix);
if(setfocus) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->pix);
if(setfocus) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
@@
-1692,7
+1694,7
@@
unfocus(Client *c, Bool setfocus) {
}
void
}
void
-unmanage(Client *c,
B
ool destroyed) {
+unmanage(Client *c,
b
ool destroyed) {
Monitor *m = c->mon;
XWindowChanges wc;
Monitor *m = c->mon;
XWindowChanges wc;
@@
-1725,7
+1727,7
@@
unmapnotify(XEvent *e) {
if(ev->send_event)
setclientstate(c, WithdrawnState);
else
if(ev->send_event)
setclientstate(c, WithdrawnState);
else
- unmanage(c,
F
alse);
+ unmanage(c,
f
alse);
}
}
}
}
@@
-1774,9
+1776,9
@@
updateclientlist() {
(unsigned char *) &(c->win), 1);
}
(unsigned char *) &(c->win), 1);
}
-
B
ool
+
b
ool
updategeom(void) {
updategeom(void) {
-
Bool dirty = F
alse;
+
bool dirty = f
alse;
#ifdef XINERAMA
if(XineramaIsActive(dpy)) {
#ifdef XINERAMA
if(XineramaIsActive(dpy)) {
@@
-1788,8
+1790,7
@@
updategeom(void) {
for(n = 0, m = mons; m; m = m->next, n++);
/* only consider unique geometries as separate screens */
for(n = 0, m = mons; m; m = m->next, n++);
/* only consider unique geometries as separate screens */
- if(!(unique = (XineramaScreenInfo *)malloc(sizeof(XineramaScreenInfo) * nn)))
- die("fatal: could not malloc() %u bytes\n", sizeof(XineramaScreenInfo) * nn);
+ unique = ecalloc(nn, sizeof(XineramaScreenInfo));
for(i = 0, j = 0; i < nn; i++)
if(isuniquegeom(unique, j, &info[i]))
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
for(i = 0, j = 0; i < nn; i++)
if(isuniquegeom(unique, j, &info[i]))
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
@@
-1808,7
+1809,7
@@
updategeom(void) {
|| (unique[i].x_org != m->mx || unique[i].y_org != m->my
|| unique[i].width != m->mw || unique[i].height != m->mh))
{
|| (unique[i].x_org != m->mx || unique[i].y_org != m->my
|| unique[i].width != m->mw || unique[i].height != m->mh))
{
- dirty =
T
rue;
+ dirty =
t
rue;
m->num = i;
m->mx = m->wx = unique[i].x_org;
m->my = m->wy = unique[i].y_org;
m->num = i;
m->mx = m->wx = unique[i].x_org;
m->my = m->wy = unique[i].y_org;
@@
-1821,7
+1822,7
@@
updategeom(void) {
for(i = nn; i < n; i++) {
for(m = mons; m && m->next; m = m->next);
while(m->clients) {
for(i = nn; i < n; i++) {
for(m = mons; m && m->next; m = m->next);
while(m->clients) {
- dirty =
T
rue;
+ dirty =
t
rue;
c = m->clients;
m->clients = c->next;
detachstack(c);
c = m->clients;
m->clients = c->next;
detachstack(c);
@@
-1843,7
+1844,7
@@
updategeom(void) {
if(!mons)
mons = createmon();
if(mons->mw != sw || mons->mh != sh) {
if(!mons)
mons = createmon();
if(mons->mw != sw || mons->mh != sh) {
- dirty =
T
rue;
+ dirty =
t
rue;
mons->mw = mons->ww = sw;
mons->mh = mons->wh = sh;
updatebarpos(mons);
mons->mw = mons->ww = sw;
mons->mh = mons->wh = sh;
updatebarpos(mons);
@@
-1942,9
+1943,9
@@
updatewindowtype(Client *c) {
Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
if(state == netatom[NetWMFullscreen])
Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
if(state == netatom[NetWMFullscreen])
- setfullscreen(c,
T
rue);
+ setfullscreen(c,
t
rue);
if(wtype == netatom[NetWMWindowTypeDialog])
if(wtype == netatom[NetWMWindowTypeDialog])
- c->isfloating =
T
rue;
+ c->isfloating =
t
rue;
}
void
}
void
@@
-1957,11
+1958,11
@@
updatewmhints(Client *c) {
XSetWMHints(dpy, c->win, wmh);
}
else
XSetWMHints(dpy, c->win, wmh);
}
else
- c->isurgent = (wmh->flags & XUrgencyHint) ?
True : F
alse;
+ c->isurgent = (wmh->flags & XUrgencyHint) ?
true : f
alse;
if(wmh->flags & InputHint)
c->neverfocus = !wmh->input;
else
if(wmh->flags & InputHint)
c->neverfocus = !wmh->input;
else
- c->neverfocus =
F
alse;
+ c->neverfocus =
f
alse;
XFree(wmh);
}
}
XFree(wmh);
}
}