[dwm] 3.8: incnmaster bugfix

From: Johannes Klauser <J.Klauser_AT_gmx.net>
Date: Mon, 26 Mar 2007 20:34:08 +0200

Hi Anselm,

> 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.
I did the patch because if nmaster is different from aktual view, you see
no effect by pressing "MODKEY|ShiftMask,XK_j/k". If you didn't pay
attention to this (or if you press it for some seconds for some reason)
you don't know the actual value of nmaster. Therefore it may be useful to
limit nmaster (by number of clients of actual tag, or (beeing more
konservative) by number of all clients), or having a view of the actual
nmaster value (e.g. at the topbar).

> 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.
The second approach (nmaster at topbar) may be the best solution to make
dwm more comfortable without changing the current nmaster implementation.
If nmaster should be bound by number of all clients, the patch can be
changed as follows:

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 = clients; c; c = c->next, ++n);
+ if((n < nmaster + i || lt->arrange != tile) || (nmaster + i < 1)
          || (wah / (nmaster + i) <= 2 * BORDERPX))
              return;
          nmaster += i;

Nevertheless dwm is a great windowmanager! :) I hope in future I'll have a
little bit more free time to tinker with some improvements of dwm ...

Greetings
Johannes

-- 
- Manche Menschen haben einen Gesichtkreis vom Radius Null und nennen ihn  
ihren Standpunkt -
David Hilbert (1862-1943)
Received on Mon Mar 26 2007 - 20:34:41 UTC

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