unboolification
This commit is contained in:
parent
e941181f46
commit
3c91283ede
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 int showbar = 1; /* 0 means no bar */
|
||||||
static const bool topbar = true; /* false means bottom bar */
|
static const int topbar = 1; /* 0 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, 1, -1 },
|
||||||
{ "Firefox", NULL, NULL, 1 << 8, false, -1 },
|
{ "Firefox", NULL, NULL, 1 << 8, 0, -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 int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
|
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
|
141
dwm.c
141
dwm.c
@ -24,7 +24,6 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -93,7 +92,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;
|
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
Client *next;
|
Client *next;
|
||||||
Client *snext;
|
Client *snext;
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
@ -123,8 +122,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;
|
int showbar;
|
||||||
bool topbar;
|
int topbar;
|
||||||
Client *clients;
|
Client *clients;
|
||||||
Client *sel;
|
Client *sel;
|
||||||
Client *stack;
|
Client *stack;
|
||||||
@ -138,13 +137,13 @@ typedef struct {
|
|||||||
const char *instance;
|
const char *instance;
|
||||||
const char *title;
|
const char *title;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
bool isfloating;
|
int 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 int applysizehints(Client *c, int *x, int *y, int *w, int *h, int 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);
|
||||||
@ -171,10 +170,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 int 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 int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||||
static void grabbuttons(Client *c, bool focused);
|
static void grabbuttons(Client *c, int 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);
|
||||||
@ -190,17 +189,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, int 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 int 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, int 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);
|
||||||
@ -214,10 +213,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, int setfocus);
|
||||||
static void unmanage(Client *c, bool destroyed);
|
static void unmanage(Client *c, int destroyed);
|
||||||
static void unmapnotify(XEvent *e);
|
static void unmapnotify(XEvent *e);
|
||||||
static bool updategeom(void);
|
static int 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);
|
||||||
@ -260,7 +259,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 int running = 1;
|
||||||
static Cur *cursor[CurLast];
|
static Cur *cursor[CurLast];
|
||||||
static ClrScheme scheme[SchemeLast];
|
static ClrScheme scheme[SchemeLast];
|
||||||
static Display *dpy;
|
static Display *dpy;
|
||||||
@ -284,7 +283,7 @@ applyrules(Client *c) {
|
|||||||
XClassHint ch = { NULL, NULL };
|
XClassHint ch = { NULL, NULL };
|
||||||
|
|
||||||
/* rule matching */
|
/* rule matching */
|
||||||
c->isfloating = false;
|
c->isfloating = 0;
|
||||||
c->tags = 0;
|
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;
|
||||||
@ -310,9 +309,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
|
int
|
||||||
applysizehints(Client *c, int *x, int *y, int *w, int *h, bool interact) {
|
applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact) {
|
||||||
bool baseismin;
|
int baseismin;
|
||||||
Monitor *m = c->mon;
|
Monitor *m = c->mon;
|
||||||
|
|
||||||
/* set minimum possible */
|
/* set minimum possible */
|
||||||
@ -419,7 +418,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, 1);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
}
|
}
|
||||||
@ -470,7 +469,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, 0);
|
||||||
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||||
while(mons)
|
while(mons)
|
||||||
cleanupmon(mons);
|
cleanupmon(mons);
|
||||||
@ -506,7 +505,7 @@ void
|
|||||||
clearurgent(Client *c) {
|
clearurgent(Client *c) {
|
||||||
XWMHints *wmh;
|
XWMHints *wmh;
|
||||||
|
|
||||||
c->isurgent = false;
|
c->isurgent = 0;
|
||||||
if(!(wmh = XGetWMHints(dpy, c->win)))
|
if(!(wmh = XGetWMHints(dpy, c->win)))
|
||||||
return;
|
return;
|
||||||
wmh->flags &= ~XUrgencyHint;
|
wmh->flags &= ~XUrgencyHint;
|
||||||
@ -557,7 +556,7 @@ void
|
|||||||
configurenotify(XEvent *e) {
|
configurenotify(XEvent *e) {
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
XConfigureEvent *ev = &e->xconfigure;
|
XConfigureEvent *ev = &e->xconfigure;
|
||||||
bool dirty;
|
int 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) {
|
||||||
@ -650,7 +649,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, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -761,7 +760,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, 1);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
}
|
}
|
||||||
else if(!c || c == selmon->sel)
|
else if(!c || c == selmon->sel)
|
||||||
@ -784,7 +783,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, 0);
|
||||||
if(c) {
|
if(c) {
|
||||||
if(c->mon != selmon)
|
if(c->mon != selmon)
|
||||||
selmon = c->mon;
|
selmon = c->mon;
|
||||||
@ -792,7 +791,7 @@ focus(Client *c) {
|
|||||||
clearurgent(c);
|
clearurgent(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
grabbuttons(c, true);
|
grabbuttons(c, 1);
|
||||||
XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix);
|
XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix);
|
||||||
setfocus(c);
|
setfocus(c);
|
||||||
}
|
}
|
||||||
@ -820,7 +819,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, 0); /* s/1/0/ fixes input focus issues
|
||||||
in gedit and anjuta */
|
in gedit and anjuta */
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
@ -867,13 +866,13 @@ getatomprop(Client *c, Atom prop) {
|
|||||||
return atom;
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
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) == True;
|
return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui);
|
||||||
}
|
}
|
||||||
|
|
||||||
long
|
long
|
||||||
@ -893,18 +892,18 @@ getstate(Window w) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
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 0;
|
||||||
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 0;
|
||||||
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 {
|
||||||
@ -915,11 +914,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 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
grabbuttons(Client *c, bool focused) {
|
grabbuttons(Client *c, int focused) {
|
||||||
updatenumlockmask();
|
updatenumlockmask();
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
@ -964,13 +963,13 @@ incnmaster(const Arg *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
static bool
|
static int
|
||||||
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 0;
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif /* XINERAMA */
|
#endif /* XINERAMA */
|
||||||
|
|
||||||
@ -1046,7 +1045,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, 0);
|
||||||
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)
|
||||||
@ -1058,7 +1057,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, 0);
|
||||||
c->mon->sel = c;
|
c->mon->sel = c;
|
||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
XMapWindow(dpy, c->win);
|
XMapWindow(dpy, c->win);
|
||||||
@ -1098,7 +1097,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, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1110,7 +1109,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, 1);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
}
|
}
|
||||||
@ -1167,7 +1166,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, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while(ev.type != ButtonRelease);
|
} while(ev.type != ButtonRelease);
|
||||||
@ -1231,7 +1230,7 @@ propertynotify(XEvent *e) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
quit(const Arg *arg) {
|
quit(const Arg *arg) {
|
||||||
running = false;
|
running = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor *
|
Monitor *
|
||||||
@ -1248,7 +1247,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, int 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);
|
||||||
}
|
}
|
||||||
@ -1309,7 +1308,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, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while(ev.type != ButtonRelease);
|
} while(ev.type != ButtonRelease);
|
||||||
@ -1387,7 +1386,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, 1);
|
||||||
detach(c);
|
detach(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
c->mon = m;
|
c->mon = m;
|
||||||
@ -1406,11 +1405,11 @@ setclientstate(Client *c, long state) {
|
|||||||
PropModeReplace, (unsigned char *)data, 2);
|
PropModeReplace, (unsigned char *)data, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
sendevent(Client *c, Atom proto) {
|
sendevent(Client *c, Atom proto) {
|
||||||
int n;
|
int n;
|
||||||
Atom *protocols;
|
Atom *protocols;
|
||||||
bool exists = false;
|
int exists = 0;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
|
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
|
||||||
@ -1442,22 +1441,22 @@ setfocus(Client *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setfullscreen(Client *c, bool fullscreen) {
|
setfullscreen(Client *c, int 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 = 1;
|
||||||
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 = 1;
|
||||||
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 = 0;
|
||||||
c->isfloating = c->oldstate;
|
c->isfloating = c->oldstate;
|
||||||
c->bw = c->oldbw;
|
c->bw = c->oldbw;
|
||||||
c->x = c->oldx;
|
c->x = c->oldx;
|
||||||
@ -1562,7 +1561,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, 0);
|
||||||
showhide(c->snext);
|
showhide(c->snext);
|
||||||
}
|
}
|
||||||
else { /* hide clients bottom up */
|
else { /* hide clients bottom up */
|
||||||
@ -1625,12 +1624,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), 0);
|
||||||
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), 0);
|
||||||
ty += HEIGHT(c);
|
ty += HEIGHT(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1652,7 +1651,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, 0);
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1682,10 +1681,10 @@ toggleview(const Arg *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unfocus(Client *c, bool setfocus) {
|
unfocus(Client *c, int setfocus) {
|
||||||
if(!c)
|
if(!c)
|
||||||
return;
|
return;
|
||||||
grabbuttons(c, false);
|
grabbuttons(c, 0);
|
||||||
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);
|
||||||
@ -1694,7 +1693,7 @@ unfocus(Client *c, bool setfocus) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
unmanage(Client *c, bool destroyed) {
|
unmanage(Client *c, int destroyed) {
|
||||||
Monitor *m = c->mon;
|
Monitor *m = c->mon;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
@ -1727,7 +1726,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, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1776,9 +1775,9 @@ updateclientlist() {
|
|||||||
(unsigned char *) &(c->win), 1);
|
(unsigned char *) &(c->win), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
int
|
||||||
updategeom(void) {
|
updategeom(void) {
|
||||||
bool dirty = false;
|
int dirty = 0;
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
if(XineramaIsActive(dpy)) {
|
if(XineramaIsActive(dpy)) {
|
||||||
@ -1809,7 +1808,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 = 1;
|
||||||
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;
|
||||||
@ -1822,7 +1821,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 = 1;
|
||||||
c = m->clients;
|
c = m->clients;
|
||||||
m->clients = c->next;
|
m->clients = c->next;
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
@ -1844,7 +1843,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 = 1;
|
||||||
mons->mw = mons->ww = sw;
|
mons->mw = mons->ww = sw;
|
||||||
mons->mh = mons->wh = sh;
|
mons->mh = mons->wh = sh;
|
||||||
updatebarpos(mons);
|
updatebarpos(mons);
|
||||||
@ -1943,9 +1942,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, 1);
|
||||||
if(wtype == netatom[NetWMWindowTypeDialog])
|
if(wtype == netatom[NetWMWindowTypeDialog])
|
||||||
c->isfloating = true;
|
c->isfloating = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1958,11 +1957,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) ? 1 : 0;
|
||||||
if(wmh->flags & InputHint)
|
if(wmh->flags & InputHint)
|
||||||
c->neverfocus = !wmh->input;
|
c->neverfocus = !wmh->input;
|
||||||
else
|
else
|
||||||
c->neverfocus = false;
|
c->neverfocus = 0;
|
||||||
XFree(wmh);
|
XFree(wmh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user