- unify multi-line expression alignment style.
- unify multi-line function call alignment style.
- simplify client moving on monitor count decrease.
- clarify comment for focusin().
- remove old confusing comment about input focus fix in focusmon(). The
  explanation is already in the old commit message, so no need to keep it in the
  code.
- remove old comment describing even older state of the code in focus().
- unify comment style.
- break up some long lines.
- fix some typos and grammar.
master
Markus Teich 2017-01-07 17:21:28 +01:00 committed by Anselm R Garbe
parent bb3bd6fec3
commit 2952b68db8
3 changed files with 32 additions and 36 deletions

View File

@ -16,7 +16,7 @@ MIT/X Consortium License
© 2011 Christoph Lohmann <20h@r-36.net>
© 2015-2016 Quentin Rameau <quinq@fifth.space>
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
© 2016 Markus Teich <markus.teich@stusta.mhn.de>
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

38
dwm.c
View File

@ -517,7 +517,8 @@ clientmessage(XEvent *e)
if (!c)
return;
if (cme->message_type == netatom[NetWMState]) {
if (cme->data.l[1] == netatom[NetWMFullscreen] || cme->data.l[2] == netatom[NetWMFullscreen])
if (cme->data.l[1] == netatom[NetWMFullscreen]
|| cme->data.l[2] == netatom[NetWMFullscreen])
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
} else if (cme->message_type == netatom[NetActiveWindow]) {
@ -783,7 +784,6 @@ focus(Client *c)
{
if (!c || !ISVISIBLE(c))
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
/* was if (selmon->sel) */
if (selmon->sel && selmon->sel != c)
unfocus(selmon->sel, 0);
if (c) {
@ -804,7 +804,7 @@ focus(Client *c)
drawbars();
}
/* there are some broken focus acquiring clients */
/* there are some broken focus acquiring clients needing extra handling */
void
focusin(XEvent *e)
{
@ -823,8 +823,7 @@ focusmon(const Arg *arg)
return;
if ((m = dirtomon(arg->i)) == selmon)
return;
unfocus(selmon->sel, 0); /* s/1/0/ fixes input focus issues
in gedit and anjuta */
unfocus(selmon->sel, 0);
selmon = m;
focus(NULL);
}
@ -1516,7 +1515,7 @@ setlayout(const Arg *arg)
drawbar(selmon);
}
/* arg > 1.0 will set mfact absolutly */
/* arg > 1.0 will set mfact absolutely */
void
setmfact(const Arg *arg)
{
@ -1590,10 +1589,11 @@ setup(void)
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
PropModeReplace, (unsigned char *) netatom, NetLast);
XDeleteProperty(dpy, root, netatom[NetClientList]);
/* select for events */
/* select events */
wa.cursor = cursor[CurNormal]->cursor;
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask|PointerMotionMask
|EnterWindowMask|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask;
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
|ButtonPressMask|PointerMotionMask|EnterWindowMask
|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask;
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
XSelectInput(dpy, root, wa.event_mask);
grabkeys();
@ -1769,12 +1769,11 @@ unmanage(Client *c, int destroyed)
Monitor *m = c->mon;
XWindowChanges wc;
/* The server grab construct avoids race conditions. */
detach(c);
detachstack(c);
if (!destroyed) {
wc.border_width = c->oldbw;
XGrabServer(dpy);
XGrabServer(dpy); /* avoid race conditions */
XSetErrorHandler(xerrordummy);
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
@ -1871,8 +1870,8 @@ updategeom(void)
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
XFree(info);
nn = j;
if (n <= nn) {
for (i = 0; i < (nn - n); i++) { /* new monitors available */
if (n <= nn) { /* new monitors available */
for (i = 0; i < (nn - n); i++) {
for (m = mons; m && m->next; m = m->next);
if (m)
m->next = createmon();
@ -1881,8 +1880,8 @@ updategeom(void)
}
for (i = 0, m = mons; i < nn && m; m = m->next, i++)
if (i >= n
|| (unique[i].x_org != m->mx || unique[i].y_org != m->my
|| unique[i].width != m->mw || unique[i].height != m->mh))
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|| unique[i].width != m->mw || unique[i].height != m->mh)
{
dirty = 1;
m->num = i;
@ -1892,13 +1891,11 @@ updategeom(void)
m->mh = m->wh = unique[i].height;
updatebarpos(m);
}
} else {
/* less monitors available nn < n */
} else { /* less monitors available nn < n */
for (i = nn; i < n; i++) {
for (m = mons; m && m->next; m = m->next);
while (m->clients) {
while ((c = m->clients)) {
dirty = 1;
c = m->clients;
m->clients = c->next;
detachstack(c);
c->mon = mons;
@ -1913,8 +1910,7 @@ updategeom(void)
free(unique);
} else
#endif /* XINERAMA */
/* default monitor setup */
{
{ /* default monitor setup */
if (!mons)
mons = createmon();
if (mons->mw != sw || mons->mh != sh) {