Re: [dwm] 3.8: incnmaster bugfix

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Fri, 23 Mar 2007 10:52:44 +0100

On Thu, Mar 22, 2007 at 08:23:19PM +0100, Johannes Klauser wrote:
> I fixed a small bug in incnmaster: there was no check if nmaster matches
> the maximal number of clients of the current tag.
> No it behaves better, but it fails partially if tags have different number
> of clients. The only way to fix it completely is the combination with
> dfenze's 'Layout per tag - patch' (but I didn't test it).
>
> Here is it:
>
> diff -r 2dec35ad6703 layout.c
> --- a/layout.c Mon Mar 05 11:54:59 2007 +0100
> +++ b/layout.c Thu Mar 22 20:05:15 2007 +0100
> @@ -135,13 +135,15 @@ incmasterw(const char *arg) {
>
> void
> incnmaster(const char *arg) {
> - int i;
> + int i, n;
> + Client *c;
>
> if(!arg)
> nmaster = NMASTER;
> else {
> i = atoi(arg);
> - if((lt->arrange != tile) || (nmaster + i < 1)
> + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next),
> ++n);
> + if((n < nmaster + i || lt->arrange != tile) || (nmaster + i < 1)
> || (wah / (nmaster + i) <= 2 * BORDERPX))
> return;
> nmaster += i;

The behavior of vanille dwm-3.8:incnmaster() is intended as is.
Actually manipulating nmaster has no side-effects and doesn't
depends on the layout in use or the amount of windows managed by
dwm in view. This is because, nmaster is intended as fixed value
and only touched on demand (if a situation occures when one
needs 2 or 3 master windows, e.g. when diffing between different
source trees or debugging web applications).

Your patch would make the nmaster value in use less predictable,
because it will depend on the tag(s) currently viewed when
incnmaster() is invoked. This is not optimal.

nmaster is a variable of the view, since there is only 1 view in
dwm (but several tags), one should not make its manipulation
dependent from the tags being viewed.

Regards,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Fri Mar 23 2007 - 10:52:44 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:40:05 UTC