Fix code style of old DWM code
This commit is contained in:
parent
6eab90a115
commit
f47259928b
236
src/dwm.c
236
src/dwm.c
|
@ -150,11 +150,11 @@ static void attach(Client *c);
|
||||||
static void attachstack(Client *c);
|
static void attachstack(Client *c);
|
||||||
static void configborder(const Arg *arg);
|
static void configborder(const Arg *arg);
|
||||||
static void configgap(const Arg *arg);
|
static void configgap(const Arg *arg);
|
||||||
static void checkotherwm(void);
|
static void checkotherwm();
|
||||||
static void cleanup(void);
|
static void cleanup();
|
||||||
static void cleanupmon(Monitor *mon);
|
static void cleanupmon(Monitor *mon);
|
||||||
static void configure(Client *c);
|
static void configure(Client *c);
|
||||||
static Monitor *createmon(void);
|
static Monitor *createmon();
|
||||||
static void detach(Client *c);
|
static void detach(Client *c);
|
||||||
static void detachstack(Client *c);
|
static void detachstack(Client *c);
|
||||||
static Monitor *dirtomon(int dir);
|
static Monitor *dirtomon(int dir);
|
||||||
|
@ -166,8 +166,9 @@ static int getrootptr(int *x, int *y);
|
||||||
static long getstate(Window w);
|
static long getstate(Window w);
|
||||||
static int 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, int focused);
|
static void grabbuttons(Client *c, int focused);
|
||||||
static void grabkeys(void);
|
static void grabkeys();
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
|
static int isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info);
|
||||||
static void killclient(const Arg *arg);
|
static void killclient(const Arg *arg);
|
||||||
static void manage(Window w, XWindowAttributes *wa);
|
static void manage(Window w, XWindowAttributes *wa);
|
||||||
static void movemouse(const Arg *arg);
|
static void movemouse(const Arg *arg);
|
||||||
|
@ -181,8 +182,8 @@ static void resize(Client *c, int x, int y, int w, int h, int bw, int interact);
|
||||||
static void resizeclient(Client *c, int x, int y, int w, int h, int bw);
|
static void resizeclient(Client *c, int x, int y, int w, int h, int bw);
|
||||||
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();
|
||||||
static void scan(void);
|
static void scan();
|
||||||
static int 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);
|
||||||
|
@ -190,7 +191,7 @@ static void setfocus(Client *c);
|
||||||
static void setfullscreen(Client *c, int 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 bool setup(void);
|
static bool setup();
|
||||||
static void seturgent(Client *c, int urg);
|
static void seturgent(Client *c, int urg);
|
||||||
static void showhide(Client *c);
|
static void showhide(Client *c);
|
||||||
static void sigchld(int unused);
|
static void sigchld(int unused);
|
||||||
|
@ -200,9 +201,9 @@ static void tagmon(const Arg *arg);
|
||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
static void unfocus(Client *c, int setfocus);
|
static void unfocus(Client *c, int setfocus);
|
||||||
static void unmanage(Client *c, int destroyed);
|
static void unmanage(Client *c, int destroyed);
|
||||||
static void updateclientlist(void);
|
static void updateclientlist();
|
||||||
static int updategeom(void);
|
static int updategeom();
|
||||||
static void updatenumlockmask(void);
|
static void updatenumlockmask();
|
||||||
static void updatesizehints(Client *c);
|
static void updatesizehints(Client *c);
|
||||||
static void updatetitle(Client *c);
|
static void updatetitle(Client *c);
|
||||||
static void updatewindowtype(Client *c);
|
static void updatewindowtype(Client *c);
|
||||||
|
@ -265,8 +266,7 @@ static xcb_connection_t *xcon;
|
||||||
#include "dwm/swallow.c"
|
#include "dwm/swallow.c"
|
||||||
#include "dwm/xerror.c"
|
#include "dwm/xerror.c"
|
||||||
|
|
||||||
int
|
int main(int argc, char *argv[])
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
if (argc == 2 && !strcmp("-v", argv[1])) {
|
if (argc == 2 && !strcmp("-v", argv[1])) {
|
||||||
die("polytreewm-"VERSION);
|
die("polytreewm-"VERSION);
|
||||||
|
@ -308,8 +308,7 @@ main(int argc, char *argv[])
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void applyrules(Client *c)
|
||||||
applyrules(Client *c)
|
|
||||||
{
|
{
|
||||||
const char *class, *instance;
|
const char *class, *instance;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -343,9 +342,15 @@ applyrules(Client *c)
|
||||||
XFree(ch.res_name);
|
XFree(ch.res_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int applysizehints(
|
||||||
applysizehints(Client *c, int *x, int *y, int *w, int *h, int bw, int interact)
|
Client *c,
|
||||||
{
|
int *x,
|
||||||
|
int *y,
|
||||||
|
int *w,
|
||||||
|
int *h,
|
||||||
|
int bw,
|
||||||
|
int interact
|
||||||
|
) {
|
||||||
int baseismin;
|
int baseismin;
|
||||||
Monitor *m = c->mon;
|
Monitor *m = c->mon;
|
||||||
|
|
||||||
|
@ -413,8 +418,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int bw, int interact)
|
||||||
return *x != c->x || *y != c->y || *w != c->w || *h != c->h || bw != c->bw;
|
return *x != c->x || *y != c->y || *w != c->w || *h != c->h || bw != c->bw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void arrange(Monitor *m)
|
||||||
arrange(Monitor *m)
|
|
||||||
{
|
{
|
||||||
if (m) {
|
if (m) {
|
||||||
showhide(m->stack);
|
showhide(m->stack);
|
||||||
|
@ -434,8 +438,7 @@ arrange(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void arrangemon(Monitor *m)
|
||||||
arrangemon(Monitor *m)
|
|
||||||
{
|
{
|
||||||
unsigned int visible_clients = 0;
|
unsigned int visible_clients = 0;
|
||||||
|
|
||||||
|
@ -452,15 +455,13 @@ arrangemon(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void attach(Client *c)
|
||||||
attach(Client *c)
|
|
||||||
{
|
{
|
||||||
c->next = c->mon->clients;
|
c->next = c->mon->clients;
|
||||||
c->mon->clients = c;
|
c->mon->clients = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void attachstack(Client *c)
|
||||||
attachstack(Client *c)
|
|
||||||
{
|
{
|
||||||
c->snext = c->mon->stack;
|
c->snext = c->mon->stack;
|
||||||
c->mon->stack = c;
|
c->mon->stack = c;
|
||||||
|
@ -484,8 +485,7 @@ void configgap(const Arg *const arg)
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void checkotherwm()
|
||||||
checkotherwm(void)
|
|
||||||
{
|
{
|
||||||
xerrorxlib = XSetErrorHandler(xerrorstart);
|
xerrorxlib = XSetErrorHandler(xerrorstart);
|
||||||
/* this causes an error if some other window manager is running */
|
/* this causes an error if some other window manager is running */
|
||||||
|
@ -495,8 +495,7 @@ checkotherwm(void)
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void cleanup()
|
||||||
cleanup(void)
|
|
||||||
{
|
{
|
||||||
Layout foo = { NULL, NULL };
|
Layout foo = { NULL, NULL };
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
@ -523,8 +522,7 @@ cleanup(void)
|
||||||
if (global_unit) UNIT_DELETE(global_unit);
|
if (global_unit) UNIT_DELETE(global_unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void cleanupmon(Monitor *mon)
|
||||||
cleanupmon(Monitor *mon)
|
|
||||||
{
|
{
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
|
||||||
|
@ -539,8 +537,7 @@ cleanupmon(Monitor *mon)
|
||||||
free(mon);
|
free(mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void configure(Client *c)
|
||||||
configure(Client *c)
|
|
||||||
{
|
{
|
||||||
XConfigureEvent ce;
|
XConfigureEvent ce;
|
||||||
|
|
||||||
|
@ -558,8 +555,7 @@ configure(Client *c)
|
||||||
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
|
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor *
|
Monitor *createmon()
|
||||||
createmon(void)
|
|
||||||
{
|
{
|
||||||
Monitor *const m = ecalloc(1, sizeof(Monitor));
|
Monitor *const m = ecalloc(1, sizeof(Monitor));
|
||||||
|
|
||||||
|
@ -581,8 +577,7 @@ fail_without_mon:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void detach(Client *c)
|
||||||
detach(Client *c)
|
|
||||||
{
|
{
|
||||||
Client **tc;
|
Client **tc;
|
||||||
|
|
||||||
|
@ -590,8 +585,7 @@ detach(Client *c)
|
||||||
*tc = c->next;
|
*tc = c->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void detachstack(Client *c)
|
||||||
detachstack(Client *c)
|
|
||||||
{
|
{
|
||||||
Client **tc, *t;
|
Client **tc, *t;
|
||||||
|
|
||||||
|
@ -604,8 +598,7 @@ detachstack(Client *c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor *
|
Monitor *dirtomon(int dir)
|
||||||
dirtomon(int dir)
|
|
||||||
{
|
{
|
||||||
Monitor *m = NULL;
|
Monitor *m = NULL;
|
||||||
|
|
||||||
|
@ -619,8 +612,7 @@ dirtomon(int dir)
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void focus(Client *c)
|
||||||
focus(Client *c)
|
|
||||||
{
|
{
|
||||||
if (!c || !ISVISIBLE(c))
|
if (!c || !ISVISIBLE(c))
|
||||||
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
|
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
|
||||||
|
@ -643,8 +635,7 @@ focus(Client *c)
|
||||||
selmon->sel = c;
|
selmon->sel = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void focusmon(const Arg *arg)
|
||||||
focusmon(const Arg *arg)
|
|
||||||
{
|
{
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
|
||||||
|
@ -657,8 +648,7 @@ focusmon(const Arg *arg)
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void focusstack(const Arg *arg)
|
||||||
focusstack(const Arg *arg)
|
|
||||||
{
|
{
|
||||||
if (!selmon->sel) return;
|
if (!selmon->sel) return;
|
||||||
|
|
||||||
|
@ -707,8 +697,7 @@ focusstack(const Arg *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Atom
|
Atom getatomprop(Client *c, Atom prop)
|
||||||
getatomprop(Client *c, Atom prop)
|
|
||||||
{
|
{
|
||||||
int di;
|
int di;
|
||||||
unsigned long dl;
|
unsigned long dl;
|
||||||
|
@ -723,8 +712,7 @@ getatomprop(Client *c, Atom prop)
|
||||||
return atom;
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int getrootptr(int *x, int *y)
|
||||||
getrootptr(int *x, int *y)
|
|
||||||
{
|
{
|
||||||
int di;
|
int di;
|
||||||
unsigned int dui;
|
unsigned int dui;
|
||||||
|
@ -733,8 +721,7 @@ getrootptr(int *x, int *y)
|
||||||
return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui);
|
return XQueryPointer(dpy, root, &dummy, &dummy, x, y, &di, &di, &dui);
|
||||||
}
|
}
|
||||||
|
|
||||||
long
|
long getstate(Window w)
|
||||||
getstate(Window w)
|
|
||||||
{
|
{
|
||||||
int format;
|
int format;
|
||||||
long result = -1;
|
long result = -1;
|
||||||
|
@ -751,8 +738,7 @@ getstate(Window w)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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;
|
||||||
|
@ -776,8 +762,7 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void grabbuttons(Client *c, int focused)
|
||||||
grabbuttons(Client *c, int focused)
|
|
||||||
{
|
{
|
||||||
updatenumlockmask();
|
updatenumlockmask();
|
||||||
{
|
{
|
||||||
|
@ -797,8 +782,7 @@ grabbuttons(Client *c, int focused)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void grabkeys()
|
||||||
grabkeys(void)
|
|
||||||
{
|
{
|
||||||
updatenumlockmask();
|
updatenumlockmask();
|
||||||
{
|
{
|
||||||
|
@ -815,8 +799,7 @@ grabkeys(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void incnmaster(const Arg *arg)
|
||||||
incnmaster(const Arg *arg)
|
|
||||||
{
|
{
|
||||||
const int max_clients_in_master = settings_get_max_clients_in_master();
|
const int max_clients_in_master = settings_get_max_clients_in_master();
|
||||||
const int new_clients_in_master = MAX(0, selmon->nmaster + arg->i);
|
const int new_clients_in_master = MAX(0, selmon->nmaster + arg->i);
|
||||||
|
@ -830,8 +813,7 @@ incnmaster(const Arg *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_XINERAMA
|
#ifdef ENABLE_XINERAMA
|
||||||
static int
|
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
|
||||||
|
@ -841,8 +823,7 @@ isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_XINERAMA */
|
#endif /* ENABLE_XINERAMA */
|
||||||
|
|
||||||
void
|
void killclient(__attribute__((unused)) const Arg *arg)
|
||||||
killclient(__attribute__((unused)) const Arg *arg)
|
|
||||||
{
|
{
|
||||||
if (!selmon->sel)
|
if (!selmon->sel)
|
||||||
return;
|
return;
|
||||||
|
@ -857,8 +838,7 @@ killclient(__attribute__((unused)) const Arg *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void manage(Window w, XWindowAttributes *wa)
|
||||||
manage(Window w, XWindowAttributes *wa)
|
|
||||||
{
|
{
|
||||||
Client *const c = ecalloc(1, sizeof(Client));
|
Client *const c = ecalloc(1, sizeof(Client));
|
||||||
|
|
||||||
|
@ -969,8 +949,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void movemouse(__attribute__((unused)) const Arg *arg)
|
||||||
movemouse(__attribute__((unused)) const Arg *arg)
|
|
||||||
{
|
{
|
||||||
Client *const c = selmon->sel;
|
Client *const c = selmon->sel;
|
||||||
if (c == NULL) return;
|
if (c == NULL) return;
|
||||||
|
@ -1050,8 +1029,8 @@ movemouse(__attribute__((unused)) const Arg *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void movestack(const Arg *arg)
|
||||||
movestack(const Arg *arg) {
|
{
|
||||||
Client *c = NULL, *p = NULL, *pc = NULL, *i;
|
Client *c = NULL, *p = NULL, *pc = NULL, *i;
|
||||||
|
|
||||||
if(arg->i > 0) {
|
if(arg->i > 0) {
|
||||||
|
@ -1099,15 +1078,13 @@ movestack(const Arg *arg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *
|
Client *nexttiled(Client *c)
|
||||||
nexttiled(Client *c)
|
|
||||||
{
|
{
|
||||||
for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
|
for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void pop(Client *c)
|
||||||
pop(Client *c)
|
|
||||||
{
|
{
|
||||||
detach(c);
|
detach(c);
|
||||||
attach(c);
|
attach(c);
|
||||||
|
@ -1115,14 +1092,12 @@ pop(Client *c)
|
||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void quit(__attribute__((unused)) const Arg *arg)
|
||||||
quit(__attribute__((unused)) const Arg *arg)
|
|
||||||
{
|
{
|
||||||
running = 0;
|
running = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor *
|
Monitor *recttomon(int x, int y, int w, int h)
|
||||||
recttomon(int x, int y, int w, int h)
|
|
||||||
{
|
{
|
||||||
Monitor *m, *r = selmon;
|
Monitor *m, *r = selmon;
|
||||||
int a, area = 0;
|
int a, area = 0;
|
||||||
|
@ -1135,8 +1110,7 @@ recttomon(int x, int y, int w, int h)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void resetnmaster(const Arg *arg)
|
||||||
resetnmaster(const Arg *arg)
|
|
||||||
{
|
{
|
||||||
const int max_clients_in_master = settings_get_max_clients_in_master();
|
const int max_clients_in_master = settings_get_max_clients_in_master();
|
||||||
const int new_clients_in_master = arg->i == 0 ? 0 : settings_get_default_clients_in_master();
|
const int new_clients_in_master = arg->i == 0 ? 0 : settings_get_default_clients_in_master();
|
||||||
|
@ -1149,15 +1123,13 @@ resetnmaster(const Arg *arg)
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void resize(Client *c, int x, int y, int w, int h, int bw, int interact)
|
||||||
resize(Client *c, int x, int y, int w, int h, int bw, int interact)
|
|
||||||
{
|
{
|
||||||
if (applysizehints(c, &x, &y, &w, &h, bw, interact))
|
if (applysizehints(c, &x, &y, &w, &h, bw, interact))
|
||||||
resizeclient(c, x, y, w, h, bw);
|
resizeclient(c, x, y, w, h, bw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void resizeclient(Client *c, int x, int y, int w, int h, int bw)
|
||||||
resizeclient(Client *c, int x, int y, int w, int h, int bw)
|
|
||||||
{
|
{
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
|
@ -1171,8 +1143,7 @@ resizeclient(Client *c, int x, int y, int w, int h, int bw)
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void resizemouse(__attribute__((unused)) const Arg *arg)
|
||||||
resizemouse(__attribute__((unused)) const Arg *arg)
|
|
||||||
{
|
{
|
||||||
Client *const c = selmon->sel;
|
Client *const c = selmon->sel;
|
||||||
if (c == NULL) return;
|
if (c == NULL) return;
|
||||||
|
@ -1249,8 +1220,7 @@ resizemouse(__attribute__((unused)) const Arg *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void restack(Monitor *m)
|
||||||
restack(Monitor *m)
|
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
@ -1275,8 +1245,7 @@ restack(Monitor *m)
|
||||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void run()
|
||||||
run(void)
|
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
/* main event loop */
|
/* main event loop */
|
||||||
|
@ -1286,8 +1255,7 @@ run(void)
|
||||||
handler[ev.type](&ev); /* call handler */
|
handler[ev.type](&ev); /* call handler */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void scan()
|
||||||
scan(void)
|
|
||||||
{
|
{
|
||||||
unsigned int i, num;
|
unsigned int i, num;
|
||||||
Window d1, d2, *wins = NULL;
|
Window d1, d2, *wins = NULL;
|
||||||
|
@ -1313,8 +1281,7 @@ scan(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void sendmon(Client *c, Monitor *m)
|
||||||
sendmon(Client *c, Monitor *m)
|
|
||||||
{
|
{
|
||||||
if (c->mon == m)
|
if (c->mon == m)
|
||||||
return;
|
return;
|
||||||
|
@ -1328,8 +1295,7 @@ sendmon(Client *c, Monitor *m)
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void setclientstate(Client *c, long state)
|
||||||
setclientstate(Client *c, long state)
|
|
||||||
{
|
{
|
||||||
long data[] = { state, None };
|
long data[] = { state, None };
|
||||||
|
|
||||||
|
@ -1337,8 +1303,7 @@ setclientstate(Client *c, long state)
|
||||||
PropModeReplace, (unsigned char *)data, 2);
|
PropModeReplace, (unsigned char *)data, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int sendevent(Client *c, Atom proto)
|
||||||
sendevent(Client *c, Atom proto)
|
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
Atom *protocols;
|
Atom *protocols;
|
||||||
|
@ -1362,8 +1327,7 @@ sendevent(Client *c, Atom proto)
|
||||||
return exists;
|
return exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void setfocus(Client *c)
|
||||||
setfocus(Client *c)
|
|
||||||
{
|
{
|
||||||
if (!c->neverfocus) {
|
if (!c->neverfocus) {
|
||||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||||
|
@ -1374,8 +1338,7 @@ setfocus(Client *c)
|
||||||
sendevent(c, atoms->wmatom[WMTakeFocus]);
|
sendevent(c, atoms->wmatom[WMTakeFocus]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void setfullscreen(Client *c, int fullscreen)
|
||||||
setfullscreen(Client *c, int fullscreen)
|
|
||||||
{
|
{
|
||||||
if (fullscreen && !c->isfullscreen) {
|
if (fullscreen && !c->isfullscreen) {
|
||||||
XChangeProperty(dpy, c->win, atoms->netatom[NetWMState], XA_ATOM, 32,
|
XChangeProperty(dpy, c->win, atoms->netatom[NetWMState], XA_ATOM, 32,
|
||||||
|
@ -1392,8 +1355,7 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void setlayout(const Arg *arg)
|
||||||
setlayout(const Arg *arg)
|
|
||||||
{
|
{
|
||||||
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) {
|
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) {
|
||||||
selmon->sellt ^= 1;
|
selmon->sellt ^= 1;
|
||||||
|
@ -1414,8 +1376,7 @@ setlayout(const Arg *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void setmfact(const Arg *arg)
|
||||||
setmfact(const Arg *arg)
|
|
||||||
{
|
{
|
||||||
if (!arg) return;
|
if (!arg) return;
|
||||||
|
|
||||||
|
@ -1426,8 +1387,7 @@ setmfact(const Arg *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool setup()
|
||||||
setup(void)
|
|
||||||
{
|
{
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
|
|
||||||
|
@ -1517,9 +1477,7 @@ setup(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void seturgent(Client *c, int urg)
|
||||||
void
|
|
||||||
seturgent(Client *c, int urg)
|
|
||||||
{
|
{
|
||||||
XWMHints *wmh;
|
XWMHints *wmh;
|
||||||
|
|
||||||
|
@ -1531,8 +1489,7 @@ seturgent(Client *c, int urg)
|
||||||
XFree(wmh);
|
XFree(wmh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void showhide(Client *c)
|
||||||
showhide(Client *c)
|
|
||||||
{
|
{
|
||||||
if (!c)
|
if (!c)
|
||||||
return;
|
return;
|
||||||
|
@ -1549,40 +1506,35 @@ showhide(Client *c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void sigchld(__attribute__((unused)) int unused)
|
||||||
sigchld(__attribute__((unused)) int unused)
|
|
||||||
{
|
{
|
||||||
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
||||||
die("can't install SIGCHLD handler:");
|
die("can't install SIGCHLD handler:");
|
||||||
while (0 < waitpid(-1, NULL, WNOHANG));
|
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void spawn(const Arg *arg)
|
||||||
spawn(const Arg *arg)
|
|
||||||
{
|
{
|
||||||
const char *const command_name = arg->v;
|
const char *const command_name = arg->v;
|
||||||
|
|
||||||
spawn_command(command_name, spawn_callback, selmon->num);
|
spawn_command(command_name, spawn_callback, selmon->num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void spawn_callback()
|
||||||
spawn_callback()
|
|
||||||
{
|
{
|
||||||
if (dpy) {
|
if (dpy) {
|
||||||
close(ConnectionNumber(dpy));
|
close(ConnectionNumber(dpy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void tagmon(const Arg *arg)
|
||||||
tagmon(const Arg *arg)
|
|
||||||
{
|
{
|
||||||
if (!selmon->sel || !mons->next)
|
if (!selmon->sel || !mons->next)
|
||||||
return;
|
return;
|
||||||
sendmon(selmon->sel, dirtomon(arg->i));
|
sendmon(selmon->sel, dirtomon(arg->i));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void togglefloating(__attribute__((unused)) const Arg *arg)
|
||||||
togglefloating(__attribute__((unused)) const Arg *arg)
|
|
||||||
{
|
{
|
||||||
if (!selmon->sel) return;
|
if (!selmon->sel) return;
|
||||||
|
|
||||||
|
@ -1605,8 +1557,7 @@ togglefloating(__attribute__((unused)) const Arg *arg)
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void unfocus(Client *c, int setfocus)
|
||||||
unfocus(Client *c, int setfocus)
|
|
||||||
{
|
{
|
||||||
if (!c)
|
if (!c)
|
||||||
return;
|
return;
|
||||||
|
@ -1618,8 +1569,7 @@ unfocus(Client *c, int setfocus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void unmanage(Client *c, int destroyed)
|
||||||
unmanage(Client *c, int destroyed)
|
|
||||||
{
|
{
|
||||||
Monitor *m = c->mon;
|
Monitor *m = c->mon;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
@ -1660,8 +1610,7 @@ unmanage(Client *c, int destroyed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void updateclientlist()
|
||||||
updateclientlist()
|
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
@ -1674,8 +1623,7 @@ updateclientlist()
|
||||||
(unsigned char *) &(c->win), 1);
|
(unsigned char *) &(c->win), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int updategeom()
|
||||||
updategeom(void)
|
|
||||||
{
|
{
|
||||||
int dirty = 0;
|
int dirty = 0;
|
||||||
|
|
||||||
|
@ -1750,8 +1698,7 @@ updategeom(void)
|
||||||
return dirty;
|
return dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void updatenumlockmask()
|
||||||
updatenumlockmask(void)
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
XModifierKeymap *modmap;
|
XModifierKeymap *modmap;
|
||||||
|
@ -1766,8 +1713,7 @@ updatenumlockmask(void)
|
||||||
XFreeModifiermap(modmap);
|
XFreeModifiermap(modmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void updatesizehints(Client *c)
|
||||||
updatesizehints(Client *c)
|
|
||||||
{
|
{
|
||||||
long msize;
|
long msize;
|
||||||
XSizeHints size;
|
XSizeHints size;
|
||||||
|
@ -1809,8 +1755,7 @@ updatesizehints(Client *c)
|
||||||
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void updatetitle(Client *c)
|
||||||
updatetitle(Client *c)
|
|
||||||
{
|
{
|
||||||
if (!gettextprop(c->win, atoms->netatom[NetWMName], c->name, sizeof c->name))
|
if (!gettextprop(c->win, atoms->netatom[NetWMName], c->name, sizeof c->name))
|
||||||
gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
|
gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
|
||||||
|
@ -1818,8 +1763,7 @@ updatetitle(Client *c)
|
||||||
strcpy(c->name, broken);
|
strcpy(c->name, broken);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void updatewindowtype(Client *c)
|
||||||
updatewindowtype(Client *c)
|
|
||||||
{
|
{
|
||||||
Atom state = getatomprop(c, atoms->netatom[NetWMState]);
|
Atom state = getatomprop(c, atoms->netatom[NetWMState]);
|
||||||
Atom wtype = getatomprop(c, atoms->netatom[NetWMWindowType]);
|
Atom wtype = getatomprop(c, atoms->netatom[NetWMWindowType]);
|
||||||
|
@ -1830,8 +1774,7 @@ updatewindowtype(Client *c)
|
||||||
c->isfloating = 1;
|
c->isfloating = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void updatewmhints(Client *c)
|
||||||
updatewmhints(Client *c)
|
|
||||||
{
|
{
|
||||||
XWMHints *wmh;
|
XWMHints *wmh;
|
||||||
|
|
||||||
|
@ -1849,8 +1792,7 @@ updatewmhints(Client *c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *
|
Client *wintoclient(Window w)
|
||||||
wintoclient(Window w)
|
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
@ -1862,8 +1804,7 @@ wintoclient(Window w)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor *
|
Monitor *wintomon(Window w)
|
||||||
wintomon(Window w)
|
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
@ -1875,8 +1816,7 @@ wintomon(Window w)
|
||||||
return selmon;
|
return selmon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void zoom(__attribute__((unused)) const Arg *arg)
|
||||||
zoom(__attribute__((unused)) const Arg *arg)
|
|
||||||
{
|
{
|
||||||
Client *c = selmon->sel;
|
Client *c = selmon->sel;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#ifndef _DWM_HANDLERS_C
|
#ifndef _DWM_HANDLERS_C
|
||||||
#define _DWM_HANDLERS_C
|
#define _DWM_HANDLERS_C
|
||||||
|
|
||||||
void
|
void on_button_press(XEvent *e)
|
||||||
on_button_press(XEvent *e)
|
|
||||||
{
|
{
|
||||||
unsigned int i, click;
|
unsigned int i, click;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
@ -36,8 +35,7 @@ on_button_press(XEvent *e)
|
||||||
buttons[i].func(&buttons[i].arg);
|
buttons[i].func(&buttons[i].arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void on_client_message(XEvent *e)
|
||||||
on_client_message(XEvent *e)
|
|
||||||
{
|
{
|
||||||
XClientMessageEvent *cme = &e->xclient;
|
XClientMessageEvent *cme = &e->xclient;
|
||||||
Client *c = wintoclient(cme->window);
|
Client *c = wintoclient(cme->window);
|
||||||
|
@ -66,8 +64,7 @@ on_client_message(XEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void on_configure_request(XEvent *e)
|
||||||
on_configure_request(XEvent *e)
|
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
@ -118,8 +115,7 @@ on_configure_request(XEvent *e)
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void on_configure_notify(XEvent *e)
|
||||||
on_configure_notify(XEvent *e)
|
|
||||||
{
|
{
|
||||||
XConfigureEvent *ev = &e->xconfigure;
|
XConfigureEvent *ev = &e->xconfigure;
|
||||||
int dirty;
|
int dirty;
|
||||||
|
@ -136,8 +132,7 @@ on_configure_notify(XEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void on_destroy_notify(XEvent *e)
|
||||||
on_destroy_notify(XEvent *e)
|
|
||||||
{
|
{
|
||||||
XDestroyWindowEvent *const ev = &e->xdestroywindow;
|
XDestroyWindowEvent *const ev = &e->xdestroywindow;
|
||||||
|
|
||||||
|
@ -151,8 +146,7 @@ on_destroy_notify(XEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* there are some broken focus acquiring clients needing extra handling */
|
/* there are some broken focus acquiring clients needing extra handling */
|
||||||
void
|
void on_focus_in(XEvent *e)
|
||||||
on_focus_in(XEvent *e)
|
|
||||||
{
|
{
|
||||||
XFocusChangeEvent *ev = &e->xfocus;
|
XFocusChangeEvent *ev = &e->xfocus;
|
||||||
|
|
||||||
|
@ -160,8 +154,7 @@ on_focus_in(XEvent *e)
|
||||||
setfocus(selmon->sel);
|
setfocus(selmon->sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void on_key_press(XEvent *e)
|
||||||
on_key_press(XEvent *e)
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
|
@ -176,8 +169,7 @@ on_key_press(XEvent *e)
|
||||||
keys[i].func(&(keys[i].arg));
|
keys[i].func(&(keys[i].arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void on_mapping_notify(XEvent *e)
|
||||||
on_mapping_notify(XEvent *e)
|
|
||||||
{
|
{
|
||||||
XMappingEvent *ev = &e->xmapping;
|
XMappingEvent *ev = &e->xmapping;
|
||||||
|
|
||||||
|
@ -186,8 +178,7 @@ on_mapping_notify(XEvent *e)
|
||||||
grabkeys();
|
grabkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void on_map_request(XEvent *e)
|
||||||
on_map_request(XEvent *e)
|
|
||||||
{
|
{
|
||||||
static XWindowAttributes wa;
|
static XWindowAttributes wa;
|
||||||
XMapRequestEvent *ev = &e->xmaprequest;
|
XMapRequestEvent *ev = &e->xmaprequest;
|
||||||
|
@ -200,8 +191,7 @@ on_map_request(XEvent *e)
|
||||||
manage(ev->window, &wa);
|
manage(ev->window, &wa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void on_property_notify(XEvent *e)
|
||||||
on_property_notify(XEvent *e)
|
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Window trans;
|
Window trans;
|
||||||
|
@ -232,8 +222,7 @@ on_property_notify(XEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void on_unmap_notify(XEvent *e)
|
||||||
on_unmap_notify(XEvent *e)
|
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
XUnmapEvent *ev = &e->xunmap;
|
XUnmapEvent *ev = &e->xunmap;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#ifndef _DWM_SWALLOW_C
|
#ifndef _DWM_SWALLOW_C
|
||||||
#define _DWM_SWALLOW_C
|
#define _DWM_SWALLOW_C
|
||||||
|
|
||||||
pid_t
|
pid_t getparentprocess(pid_t p)
|
||||||
getparentprocess(pid_t p)
|
|
||||||
{
|
{
|
||||||
unsigned int v = 0;
|
unsigned int v = 0;
|
||||||
|
|
||||||
|
@ -34,8 +33,7 @@ getparentprocess(pid_t p)
|
||||||
return (pid_t)v;
|
return (pid_t)v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int isdescprocess(pid_t p, pid_t c)
|
||||||
isdescprocess(pid_t p, pid_t c)
|
|
||||||
{
|
{
|
||||||
while (p != c && c != 0)
|
while (p != c && c != 0)
|
||||||
c = getparentprocess(c);
|
c = getparentprocess(c);
|
||||||
|
@ -43,8 +41,7 @@ isdescprocess(pid_t p, pid_t c)
|
||||||
return (int)c;
|
return (int)c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void swallow(Client *p, Client *c)
|
||||||
swallow(Client *p, Client *c)
|
|
||||||
{
|
{
|
||||||
if (!settings_get_enable_swallowing()) return;
|
if (!settings_get_enable_swallowing()) return;
|
||||||
if (c->noswallow || c->isterminal) return;
|
if (c->noswallow || c->isterminal) return;
|
||||||
|
@ -69,8 +66,7 @@ swallow(Client *p, Client *c)
|
||||||
updateclientlist();
|
updateclientlist();
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *
|
Client *swallowingclient(Window w)
|
||||||
swallowingclient(Window w)
|
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
@ -85,8 +81,7 @@ swallowingclient(Window w)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *
|
Client *termforwin(const Client *w)
|
||||||
termforwin(const Client *w)
|
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
@ -104,8 +99,7 @@ termforwin(const Client *w)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void unswallow(Client *c)
|
||||||
unswallow(Client *c)
|
|
||||||
{
|
{
|
||||||
c->win = c->swallowing->win;
|
c->win = c->swallowing->win;
|
||||||
|
|
||||||
|
@ -123,8 +117,7 @@ unswallow(Client *c)
|
||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t
|
pid_t winpid(Window w)
|
||||||
winpid(Window w)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
pid_t result = 0;
|
pid_t result = 0;
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void *
|
void *ecalloc(size_t nmemb, size_t size)
|
||||||
ecalloc(size_t nmemb, size_t size)
|
|
||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
|
@ -16,8 +15,8 @@ ecalloc(size_t nmemb, size_t size)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void die(const char *fmt, ...)
|
||||||
die(const char *fmt, ...) {
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
Loading…
Reference in New Issue