separate program-specific c99 bool and X11
True, False are X11-specific (int), make sure to use c99 stdbool for program-specific things.
This commit is contained in:
parent
42cf1c7d8f
commit
43e82adf0d
10
config.def.h
10
config.def.h
@ -13,8 +13,8 @@ static const char selbgcolor[] = "#005577";
|
|||||||
static const char selfgcolor[] = "#eeeeee";
|
static const char selfgcolor[] = "#eeeeee";
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const Bool showbar = True; /* False means no bar */
|
static const bool showbar = true; /* false means no bar */
|
||||||
static const Bool topbar = True; /* False means bottom bar */
|
static const bool topbar = true; /* false means bottom bar */
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
@ -25,14 +25,14 @@ static const Rule rules[] = {
|
|||||||
* WM_NAME(STRING) = title
|
* WM_NAME(STRING) = title
|
||||||
*/
|
*/
|
||||||
/* class instance title tags mask isfloating monitor */
|
/* class instance title tags mask isfloating monitor */
|
||||||
{ "Gimp", NULL, NULL, 0, True, -1 },
|
{ "Gimp", NULL, NULL, 0, true, -1 },
|
||||||
{ "Firefox", NULL, NULL, 1 << 8, False, -1 },
|
{ "Firefox", NULL, NULL, 1 << 8, false, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
static const int nmaster = 1; /* number of clients in master area */
|
static const int nmaster = 1; /* number of clients in master area */
|
||||||
static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
|
static const bool resizehints = true; /* true means respect size hints in tiled resizals */
|
||||||
|
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
|
142
dwm.c
142
dwm.c
@ -24,6 +24,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -92,7 +93,7 @@ struct Client {
|
|||||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
int bw, oldbw;
|
int bw, oldbw;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
Client *next;
|
Client *next;
|
||||||
Client *snext;
|
Client *snext;
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
@ -122,8 +123,8 @@ struct Monitor {
|
|||||||
unsigned int seltags;
|
unsigned int seltags;
|
||||||
unsigned int sellt;
|
unsigned int sellt;
|
||||||
unsigned int tagset[2];
|
unsigned int tagset[2];
|
||||||
Bool showbar;
|
bool showbar;
|
||||||
Bool topbar;
|
bool topbar;
|
||||||
Client *clients;
|
Client *clients;
|
||||||
Client *sel;
|
Client *sel;
|
||||||
Client *stack;
|
Client *stack;
|
||||||
@ -137,13 +138,13 @@ typedef struct {
|
|||||||
const char *instance;
|
const char *instance;
|
||||||
const char *title;
|
const char *title;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
Bool isfloating;
|
bool isfloating;
|
||||||
int monitor;
|
int monitor;
|
||||||
} Rule;
|
} Rule;
|
||||||
|
|
||||||
/* function declarations */
|
/* function declarations */
|
||||||
static void applyrules(Client *c);
|
static void applyrules(Client *c);
|
||||||
static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact);
|
static bool applysizehints(Client *c, int *x, int *y, int *w, int *h, bool interact);
|
||||||
static void arrange(Monitor *m);
|
static void arrange(Monitor *m);
|
||||||
static void arrangemon(Monitor *m);
|
static void arrangemon(Monitor *m);
|
||||||
static void attach(Client *c);
|
static void attach(Client *c);
|
||||||
@ -170,10 +171,10 @@ static void focus(Client *c);
|
|||||||
static void focusin(XEvent *e);
|
static void focusin(XEvent *e);
|
||||||
static void focusmon(const Arg *arg);
|
static void focusmon(const Arg *arg);
|
||||||
static void focusstack(const Arg *arg);
|
static void focusstack(const Arg *arg);
|
||||||
static Bool getrootptr(int *x, int *y);
|
static bool getrootptr(int *x, int *y);
|
||||||
static long getstate(Window w);
|
static long getstate(Window w);
|
||||||
static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
static bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||||
static void grabbuttons(Client *c, Bool focused);
|
static void grabbuttons(Client *c, bool focused);
|
||||||
static void grabkeys(void);
|
static void grabkeys(void);
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
static void keypress(XEvent *e);
|
static void keypress(XEvent *e);
|
||||||
@ -189,17 +190,17 @@ static void pop(Client *);
|
|||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
static void quit(const Arg *arg);
|
static void quit(const Arg *arg);
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
static void resize(Client *c, int x, int y, int w, int h, Bool interact);
|
static void resize(Client *c, int x, int y, int w, int h, bool interact);
|
||||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||||
static void resizemouse(const Arg *arg);
|
static void resizemouse(const Arg *arg);
|
||||||
static void restack(Monitor *m);
|
static void restack(Monitor *m);
|
||||||
static void run(void);
|
static void run(void);
|
||||||
static void scan(void);
|
static void scan(void);
|
||||||
static Bool sendevent(Client *c, Atom proto);
|
static bool sendevent(Client *c, Atom proto);
|
||||||
static void sendmon(Client *c, Monitor *m);
|
static void sendmon(Client *c, Monitor *m);
|
||||||
static void setclientstate(Client *c, long state);
|
static void setclientstate(Client *c, long state);
|
||||||
static void setfocus(Client *c);
|
static void setfocus(Client *c);
|
||||||
static void setfullscreen(Client *c, Bool fullscreen);
|
static void setfullscreen(Client *c, bool fullscreen);
|
||||||
static void setlayout(const Arg *arg);
|
static void setlayout(const Arg *arg);
|
||||||
static void setmfact(const Arg *arg);
|
static void setmfact(const Arg *arg);
|
||||||
static void setup(void);
|
static void setup(void);
|
||||||
@ -213,10 +214,10 @@ static void togglebar(const Arg *arg);
|
|||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
static void toggletag(const Arg *arg);
|
static void toggletag(const Arg *arg);
|
||||||
static void toggleview(const Arg *arg);
|
static void toggleview(const Arg *arg);
|
||||||
static void unfocus(Client *c, Bool setfocus);
|
static void unfocus(Client *c, bool setfocus);
|
||||||
static void unmanage(Client *c, Bool destroyed);
|
static void unmanage(Client *c, bool destroyed);
|
||||||
static void unmapnotify(XEvent *e);
|
static void unmapnotify(XEvent *e);
|
||||||
static Bool updategeom(void);
|
static bool updategeom(void);
|
||||||
static void updatebarpos(Monitor *m);
|
static void updatebarpos(Monitor *m);
|
||||||
static void updatebars(void);
|
static void updatebars(void);
|
||||||
static void updateclientlist(void);
|
static void updateclientlist(void);
|
||||||
@ -259,7 +260,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
|||||||
[UnmapNotify] = unmapnotify
|
[UnmapNotify] = unmapnotify
|
||||||
};
|
};
|
||||||
static Atom wmatom[WMLast], netatom[NetLast];
|
static Atom wmatom[WMLast], netatom[NetLast];
|
||||||
static Bool running = True;
|
static bool running = true;
|
||||||
static Cur *cursor[CurLast];
|
static Cur *cursor[CurLast];
|
||||||
static ClrScheme scheme[SchemeLast];
|
static ClrScheme scheme[SchemeLast];
|
||||||
static Display *dpy;
|
static Display *dpy;
|
||||||
@ -283,7 +284,8 @@ applyrules(Client *c) {
|
|||||||
XClassHint ch = { NULL, NULL };
|
XClassHint ch = { NULL, NULL };
|
||||||
|
|
||||||
/* rule matching */
|
/* rule matching */
|
||||||
c->isfloating = c->tags = 0;
|
c->isfloating = false;
|
||||||
|
c->tags = 0;
|
||||||
XGetClassHint(dpy, c->win, &ch);
|
XGetClassHint(dpy, c->win, &ch);
|
||||||
class = ch.res_class ? ch.res_class : broken;
|
class = ch.res_class ? ch.res_class : broken;
|
||||||
instance = ch.res_name ? ch.res_name : 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];
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
bool
|
||||||
applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact) {
|
applysizehints(Client *c, int *x, int *y, int *w, int *h, bool interact) {
|
||||||
Bool baseismin;
|
bool baseismin;
|
||||||
Monitor *m = c->mon;
|
Monitor *m = c->mon;
|
||||||
|
|
||||||
/* set minimum possible */
|
/* set minimum possible */
|
||||||
@ -417,7 +419,7 @@ buttonpress(XEvent *e) {
|
|||||||
click = ClkRootWin;
|
click = ClkRootWin;
|
||||||
/* focus monitor if necessary */
|
/* focus monitor if necessary */
|
||||||
if((m = wintomon(ev->window)) && m != selmon) {
|
if((m = wintomon(ev->window)) && m != selmon) {
|
||||||
unfocus(selmon->sel, True);
|
unfocus(selmon->sel, true);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
}
|
}
|
||||||
@ -468,7 +470,7 @@ cleanup(void) {
|
|||||||
selmon->lt[selmon->sellt] = &foo;
|
selmon->lt[selmon->sellt] = &foo;
|
||||||
for(m = mons; m; m = m->next)
|
for(m = mons; m; m = m->next)
|
||||||
while(m->stack)
|
while(m->stack)
|
||||||
unmanage(m->stack, False);
|
unmanage(m->stack, false);
|
||||||
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||||
while(mons)
|
while(mons)
|
||||||
cleanupmon(mons);
|
cleanupmon(mons);
|
||||||
@ -504,7 +506,7 @@ void
|
|||||||
clearurgent(Client *c) {
|
clearurgent(Client *c) {
|
||||||
XWMHints *wmh;
|
XWMHints *wmh;
|
||||||
|
|
||||||
c->isurgent = False;
|
c->isurgent = false;
|
||||||
if(!(wmh = XGetWMHints(dpy, c->win)))
|
if(!(wmh = XGetWMHints(dpy, c->win)))
|
||||||
return;
|
return;
|
||||||
wmh->flags &= ~XUrgencyHint;
|
wmh->flags &= ~XUrgencyHint;
|
||||||
@ -555,7 +557,7 @@ void
|
|||||||
configurenotify(XEvent *e) {
|
configurenotify(XEvent *e) {
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
XConfigureEvent *ev = &e->xconfigure;
|
XConfigureEvent *ev = &e->xconfigure;
|
||||||
Bool dirty;
|
bool dirty;
|
||||||
|
|
||||||
/* TODO: updategeom handling sucks, needs to be simplified */
|
/* TODO: updategeom handling sucks, needs to be simplified */
|
||||||
if(ev->window == root) {
|
if(ev->window == root) {
|
||||||
@ -648,7 +650,7 @@ destroynotify(XEvent *e) {
|
|||||||
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
||||||
|
|
||||||
if((c = wintoclient(ev->window)))
|
if((c = wintoclient(ev->window)))
|
||||||
unmanage(c, True);
|
unmanage(c, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -759,7 +761,7 @@ enternotify(XEvent *e) {
|
|||||||
c = wintoclient(ev->window);
|
c = wintoclient(ev->window);
|
||||||
m = c ? c->mon : wintomon(ev->window);
|
m = c ? c->mon : wintomon(ev->window);
|
||||||
if(m != selmon) {
|
if(m != selmon) {
|
||||||
unfocus(selmon->sel, True);
|
unfocus(selmon->sel, true);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
}
|
}
|
||||||
else if(!c || c == selmon->sel)
|
else if(!c || c == selmon->sel)
|
||||||
@ -782,7 +784,7 @@ focus(Client *c) {
|
|||||||
for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
|
for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
|
||||||
/* was if(selmon->sel) */
|
/* was if(selmon->sel) */
|
||||||
if(selmon->sel && selmon->sel != c)
|
if(selmon->sel && selmon->sel != c)
|
||||||
unfocus(selmon->sel, False);
|
unfocus(selmon->sel, false);
|
||||||
if(c) {
|
if(c) {
|
||||||
if(c->mon != selmon)
|
if(c->mon != selmon)
|
||||||
selmon = c->mon;
|
selmon = c->mon;
|
||||||
@ -790,7 +792,7 @@ focus(Client *c) {
|
|||||||
clearurgent(c);
|
clearurgent(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
grabbuttons(c, True);
|
grabbuttons(c, true);
|
||||||
XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix);
|
XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix);
|
||||||
setfocus(c);
|
setfocus(c);
|
||||||
}
|
}
|
||||||
@ -818,7 +820,7 @@ focusmon(const Arg *arg) {
|
|||||||
return;
|
return;
|
||||||
if((m = dirtomon(arg->i)) == selmon)
|
if((m = dirtomon(arg->i)) == selmon)
|
||||||
return;
|
return;
|
||||||
unfocus(selmon->sel, False); /* s/True/False/ fixes input focus issues
|
unfocus(selmon->sel, false); /* s/true/false/ fixes input focus issues
|
||||||
in gedit and anjuta */
|
in gedit and anjuta */
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
@ -865,13 +867,13 @@ getatomprop(Client *c, Atom prop) {
|
|||||||
return atom;
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
bool
|
||||||
getrootptr(int *x, int *y) {
|
getrootptr(int *x, int *y) {
|
||||||
int di;
|
int di;
|
||||||
unsigned int dui;
|
unsigned int dui;
|
||||||
Window dummy;
|
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
|
||||||
@ -891,18 +893,18 @@ getstate(Window w) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
bool
|
||||||
gettextprop(Window w, Atom atom, char *text, unsigned int size) {
|
gettextprop(Window w, Atom atom, char *text, unsigned int size) {
|
||||||
char **list = NULL;
|
char **list = NULL;
|
||||||
int n;
|
int n;
|
||||||
XTextProperty name;
|
XTextProperty name;
|
||||||
|
|
||||||
if(!text || size == 0)
|
if(!text || size == 0)
|
||||||
return False;
|
return false;
|
||||||
text[0] = '\0';
|
text[0] = '\0';
|
||||||
XGetTextProperty(dpy, w, &name, atom);
|
XGetTextProperty(dpy, w, &name, atom);
|
||||||
if(!name.nitems)
|
if(!name.nitems)
|
||||||
return False;
|
return false;
|
||||||
if(name.encoding == XA_STRING)
|
if(name.encoding == XA_STRING)
|
||||||
strncpy(text, (char *)name.value, size - 1);
|
strncpy(text, (char *)name.value, size - 1);
|
||||||
else {
|
else {
|
||||||
@ -913,11 +915,11 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) {
|
|||||||
}
|
}
|
||||||
text[size - 1] = '\0';
|
text[size - 1] = '\0';
|
||||||
XFree(name.value);
|
XFree(name.value);
|
||||||
return True;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
grabbuttons(Client *c, Bool focused) {
|
grabbuttons(Client *c, bool focused) {
|
||||||
updatenumlockmask();
|
updatenumlockmask();
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
@ -962,13 +964,13 @@ incnmaster(const Arg *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
static Bool
|
static bool
|
||||||
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) {
|
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) {
|
||||||
while(n--)
|
while(n--)
|
||||||
if(unique[n].x_org == info->x_org && unique[n].y_org == info->y_org
|
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)
|
&& unique[n].width == info->width && unique[n].height == info->height)
|
||||||
return False;
|
return false;
|
||||||
return True;
|
return true;
|
||||||
}
|
}
|
||||||
#endif /* XINERAMA */
|
#endif /* XINERAMA */
|
||||||
|
|
||||||
@ -1044,7 +1046,7 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
updatesizehints(c);
|
updatesizehints(c);
|
||||||
updatewmhints(c);
|
updatewmhints(c);
|
||||||
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
|
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
|
||||||
grabbuttons(c, False);
|
grabbuttons(c, false);
|
||||||
if(!c->isfloating)
|
if(!c->isfloating)
|
||||||
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
||||||
if(c->isfloating)
|
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 */
|
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
|
||||||
setclientstate(c, NormalState);
|
setclientstate(c, NormalState);
|
||||||
if (c->mon == selmon)
|
if (c->mon == selmon)
|
||||||
unfocus(selmon->sel, False);
|
unfocus(selmon->sel, false);
|
||||||
c->mon->sel = c;
|
c->mon->sel = c;
|
||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
XMapWindow(dpy, c->win);
|
XMapWindow(dpy, c->win);
|
||||||
@ -1096,7 +1098,7 @@ monocle(Monitor *m) {
|
|||||||
if(n > 0) /* override layout symbol */
|
if(n > 0) /* override layout symbol */
|
||||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
||||||
for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
|
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, False);
|
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1108,7 +1110,7 @@ motionnotify(XEvent *e) {
|
|||||||
if(ev->window != root)
|
if(ev->window != root)
|
||||||
return;
|
return;
|
||||||
if((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
|
if((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
|
||||||
unfocus(selmon->sel, True);
|
unfocus(selmon->sel, true);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
}
|
}
|
||||||
@ -1165,7 +1167,7 @@ movemouse(const Arg *arg) {
|
|||||||
togglefloating(NULL);
|
togglefloating(NULL);
|
||||||
}
|
}
|
||||||
if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
||||||
resize(c, nx, ny, c->w, c->h, True);
|
resize(c, nx, ny, c->w, c->h, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while(ev.type != ButtonRelease);
|
} while(ev.type != ButtonRelease);
|
||||||
@ -1229,7 +1231,7 @@ propertynotify(XEvent *e) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
quit(const Arg *arg) {
|
quit(const Arg *arg) {
|
||||||
running = False;
|
running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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, Bool interact) {
|
resize(Client *c, int x, int y, int w, int h, bool interact) {
|
||||||
if(applysizehints(c, &x, &y, &w, &h, interact))
|
if(applysizehints(c, &x, &y, &w, &h, interact))
|
||||||
resizeclient(c, x, y, w, h);
|
resizeclient(c, x, y, w, h);
|
||||||
}
|
}
|
||||||
@ -1307,7 +1309,7 @@ resizemouse(const Arg *arg) {
|
|||||||
togglefloating(NULL);
|
togglefloating(NULL);
|
||||||
}
|
}
|
||||||
if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
||||||
resize(c, c->x, c->y, nw, nh, True);
|
resize(c, c->x, c->y, nw, nh, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while(ev.type != ButtonRelease);
|
} while(ev.type != ButtonRelease);
|
||||||
@ -1385,7 +1387,7 @@ void
|
|||||||
sendmon(Client *c, Monitor *m) {
|
sendmon(Client *c, Monitor *m) {
|
||||||
if(c->mon == m)
|
if(c->mon == m)
|
||||||
return;
|
return;
|
||||||
unfocus(c, True);
|
unfocus(c, true);
|
||||||
detach(c);
|
detach(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
c->mon = m;
|
c->mon = m;
|
||||||
@ -1404,11 +1406,11 @@ setclientstate(Client *c, long state) {
|
|||||||
PropModeReplace, (unsigned char *)data, 2);
|
PropModeReplace, (unsigned char *)data, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
bool
|
||||||
sendevent(Client *c, Atom proto) {
|
sendevent(Client *c, Atom proto) {
|
||||||
int n;
|
int n;
|
||||||
Atom *protocols;
|
Atom *protocols;
|
||||||
Bool exists = False;
|
bool exists = false;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
|
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
|
||||||
@ -1440,22 +1442,22 @@ setfocus(Client *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setfullscreen(Client *c, Bool fullscreen) {
|
setfullscreen(Client *c, bool fullscreen) {
|
||||||
if(fullscreen && !c->isfullscreen) {
|
if(fullscreen && !c->isfullscreen) {
|
||||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||||
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
|
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
|
||||||
c->isfullscreen = True;
|
c->isfullscreen = true;
|
||||||
c->oldstate = c->isfloating;
|
c->oldstate = c->isfloating;
|
||||||
c->oldbw = c->bw;
|
c->oldbw = c->bw;
|
||||||
c->bw = 0;
|
c->bw = 0;
|
||||||
c->isfloating = True;
|
c->isfloating = true;
|
||||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||||
XRaiseWindow(dpy, c->win);
|
XRaiseWindow(dpy, c->win);
|
||||||
}
|
}
|
||||||
else if(!fullscreen && c->isfullscreen){
|
else if(!fullscreen && c->isfullscreen){
|
||||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||||
PropModeReplace, (unsigned char*)0, 0);
|
PropModeReplace, (unsigned char*)0, 0);
|
||||||
c->isfullscreen = False;
|
c->isfullscreen = false;
|
||||||
c->isfloating = c->oldstate;
|
c->isfloating = c->oldstate;
|
||||||
c->bw = c->oldbw;
|
c->bw = c->oldbw;
|
||||||
c->x = c->oldx;
|
c->x = c->oldx;
|
||||||
@ -1560,7 +1562,7 @@ showhide(Client *c) {
|
|||||||
if(ISVISIBLE(c)) { /* show clients top down */
|
if(ISVISIBLE(c)) { /* show clients top down */
|
||||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||||
if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
|
if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
|
||||||
resize(c, c->x, c->y, c->w, c->h, False);
|
resize(c, c->x, c->y, c->w, c->h, false);
|
||||||
showhide(c->snext);
|
showhide(c->snext);
|
||||||
}
|
}
|
||||||
else { /* hide clients bottom up */
|
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++)
|
for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
if(i < m->nmaster) {
|
if(i < m->nmaster) {
|
||||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
|
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), false);
|
||||||
my += HEIGHT(c);
|
my += HEIGHT(c);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
h = (m->wh - ty) / (n - i);
|
h = (m->wh - ty) / (n - i);
|
||||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
|
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), false);
|
||||||
ty += HEIGHT(c);
|
ty += HEIGHT(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1650,7 +1652,7 @@ togglefloating(const Arg *arg) {
|
|||||||
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
|
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
|
||||||
if(selmon->sel->isfloating)
|
if(selmon->sel->isfloating)
|
||||||
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
|
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
|
||||||
selmon->sel->w, selmon->sel->h, False);
|
selmon->sel->w, selmon->sel->h, false);
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1680,10 +1682,10 @@ toggleview(const Arg *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unfocus(Client *c, Bool setfocus) {
|
unfocus(Client *c, bool setfocus) {
|
||||||
if(!c)
|
if(!c)
|
||||||
return;
|
return;
|
||||||
grabbuttons(c, False);
|
grabbuttons(c, false);
|
||||||
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->pix);
|
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->pix);
|
||||||
if(setfocus) {
|
if(setfocus) {
|
||||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||||
@ -1692,7 +1694,7 @@ unfocus(Client *c, Bool setfocus) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unmanage(Client *c, Bool destroyed) {
|
unmanage(Client *c, bool destroyed) {
|
||||||
Monitor *m = c->mon;
|
Monitor *m = c->mon;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
@ -1725,7 +1727,7 @@ unmapnotify(XEvent *e) {
|
|||||||
if(ev->send_event)
|
if(ev->send_event)
|
||||||
setclientstate(c, WithdrawnState);
|
setclientstate(c, WithdrawnState);
|
||||||
else
|
else
|
||||||
unmanage(c, False);
|
unmanage(c, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1774,9 +1776,9 @@ updateclientlist() {
|
|||||||
(unsigned char *) &(c->win), 1);
|
(unsigned char *) &(c->win), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
bool
|
||||||
updategeom(void) {
|
updategeom(void) {
|
||||||
Bool dirty = False;
|
bool dirty = false;
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
if(XineramaIsActive(dpy)) {
|
if(XineramaIsActive(dpy)) {
|
||||||
@ -1807,7 +1809,7 @@ updategeom(void) {
|
|||||||
|| (unique[i].x_org != m->mx || unique[i].y_org != m->my
|
|| (unique[i].x_org != m->mx || unique[i].y_org != m->my
|
||||||
|| unique[i].width != m->mw || unique[i].height != m->mh))
|
|| unique[i].width != m->mw || unique[i].height != m->mh))
|
||||||
{
|
{
|
||||||
dirty = True;
|
dirty = true;
|
||||||
m->num = i;
|
m->num = i;
|
||||||
m->mx = m->wx = unique[i].x_org;
|
m->mx = m->wx = unique[i].x_org;
|
||||||
m->my = m->wy = unique[i].y_org;
|
m->my = m->wy = unique[i].y_org;
|
||||||
@ -1820,7 +1822,7 @@ updategeom(void) {
|
|||||||
for(i = nn; i < n; i++) {
|
for(i = nn; i < n; i++) {
|
||||||
for(m = mons; m && m->next; m = m->next);
|
for(m = mons; m && m->next; m = m->next);
|
||||||
while(m->clients) {
|
while(m->clients) {
|
||||||
dirty = True;
|
dirty = true;
|
||||||
c = m->clients;
|
c = m->clients;
|
||||||
m->clients = c->next;
|
m->clients = c->next;
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
@ -1842,7 +1844,7 @@ updategeom(void) {
|
|||||||
if(!mons)
|
if(!mons)
|
||||||
mons = createmon();
|
mons = createmon();
|
||||||
if(mons->mw != sw || mons->mh != sh) {
|
if(mons->mw != sw || mons->mh != sh) {
|
||||||
dirty = True;
|
dirty = true;
|
||||||
mons->mw = mons->ww = sw;
|
mons->mw = mons->ww = sw;
|
||||||
mons->mh = mons->wh = sh;
|
mons->mh = mons->wh = sh;
|
||||||
updatebarpos(mons);
|
updatebarpos(mons);
|
||||||
@ -1941,9 +1943,9 @@ updatewindowtype(Client *c) {
|
|||||||
Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
|
Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
|
||||||
|
|
||||||
if(state == netatom[NetWMFullscreen])
|
if(state == netatom[NetWMFullscreen])
|
||||||
setfullscreen(c, True);
|
setfullscreen(c, true);
|
||||||
if(wtype == netatom[NetWMWindowTypeDialog])
|
if(wtype == netatom[NetWMWindowTypeDialog])
|
||||||
c->isfloating = True;
|
c->isfloating = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1956,11 +1958,11 @@ updatewmhints(Client *c) {
|
|||||||
XSetWMHints(dpy, c->win, wmh);
|
XSetWMHints(dpy, c->win, wmh);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->isurgent = (wmh->flags & XUrgencyHint) ? True : False;
|
c->isurgent = (wmh->flags & XUrgencyHint) ? true : false;
|
||||||
if(wmh->flags & InputHint)
|
if(wmh->flags & InputHint)
|
||||||
c->neverfocus = !wmh->input;
|
c->neverfocus = !wmh->input;
|
||||||
else
|
else
|
||||||
c->neverfocus = False;
|
c->neverfocus = false;
|
||||||
XFree(wmh);
|
XFree(wmh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user