Bump to 5e76e7e.

code-style: simplify some checks

main change here is making the `zoom()` logic saner. the rest of the
changes are just small stuff which accumulated on my local branch.

pop() must not be called with NULL. and `zoom()` achieves this, but in a
very (unnecessarily) complicated way:

if c == NULL then nexttiled() will return NULL as well, so we enter this
branch:

	if (c == nexttiled(selmon->clients))

in here the !c check fails and the function returns before calling pop()

		if (!c || !(c = nexttiled(c->next)))
			return;

however, none of this was needed. we can simply return early if c was NULL.
Also `c` is set to `selmon->sel` so we can use `c` in the first check
instead which makes things shorter.

Ref.
https://git.suckless.org/dwm/commit/5e76e7e21da042c493c59235ca82d7275f20a7e4.html
pull/301/head
bakkeby 2 years ago
parent 10aa27171f
commit 6a0e5b884e

@ -1,4 +1,4 @@
This dwm 6.3 (5b2e5e7, 2022-07-29) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0).
This dwm 6.3 (5e76e7e, 2022-08-06) side project has a different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. Due to the complexity of some of the patches dwm-flexipatch has diverged from mainstream dwm by making some core patches non-optional for maintenance reasons. For the classic dwm-flexipatch build refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0).
For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/dwm-flexipatch/blob/master/patches.def.h):
```c

34
dwm.c

@ -2222,13 +2222,11 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size)
text[0] = '\0';
if (!XGetTextProperty(dpy, w, &name, atom) || !name.nitems)
return 0;
if (name.encoding == XA_STRING)
if (name.encoding == XA_STRING) {
strncpy(text, (char *)name.value, size - 1);
else {
if (XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) {
strncpy(text, *list, size - 1);
XFreeStringList(list);
}
} else if (XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) {
strncpy(text, *list, size - 1);
XFreeStringList(list);
}
text[size - 1] = '\0';
XFree(name.value);
@ -2625,9 +2623,7 @@ maprequest(XEvent *e)
}
#endif // BAR_SYSTRAY_PATCH
if (!XGetWindowAttributes(dpy, ev->window, &wa))
return;
if (wa.override_redirect)
if (!XGetWindowAttributes(dpy, ev->window, &wa) || wa.override_redirect)
return;
#if BAR_ANYBAR_PATCH
if (wmclasscontains(ev->window, altbarclass, ""))
@ -4961,12 +4957,7 @@ zoom(const Arg *arg)
c->mon->pertag->prevclient[c->mon->pertag->curtag] = nexttiled(c->mon->clients);
#endif // SWAPFOCUS_PATCH
if (!c->mon->lt[c->mon->sellt]->arrange
|| (c && c->isfloating)
#if ZOOMSWAP_PATCH
|| !c
#endif // ZOOMSWAP_PATCH
)
if (!c->mon->lt[c->mon->sellt]->arrange || !c || c->isfloating)
return;
#if ZOOMSWAP_PATCH
@ -5019,14 +5010,13 @@ zoom(const Arg *arg)
}
focus(c);
arrange(c->mon);
#elif SWAPFOCUS_PATCH && PERTAG_PATCH
if (c == nexttiled(c->mon->clients) && !(c = c->mon->pertag->prevclient[c->mon->pertag->curtag] = nexttiled(c->next)))
return;
pop(c);
#else
if (c == nexttiled(c->mon->clients))
#if SWAPFOCUS_PATCH && PERTAG_PATCH
if (!c || !(c = c->mon->pertag->prevclient[c->mon->pertag->curtag] = nexttiled(c->next)))
#else
if (!c || !(c = nexttiled(c->next)))
#endif // SWAPFOCUS_PATCH
return;
if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next)))
return;
pop(c);
#endif // ZOOMSWAP_PATCH
}

Loading…
Cancel
Save