[dwm] small dwm tile() patch

From: Chris Webb <chris_AT_arachsys.com>
Date: Sun, 13 Jan 2008 19:28:13 +0000

I grabbed the latest dwm earlier to port various bits of my own into
clean patches against the latest dwm. I hadn't looked at the standard
tile function for a little while, but I notice that the current
incarnation recalculates the window geometries (mw and th) for each
client rather than once in front of the client loop. hg bisect says this
started happening at changeset 1072:5a06b4b69479 when the Xinerama work
began.

Obviously mw and th are different from monitor to monitor, but within a
monitor they're constant, so I think the following (trivial) patch is
correct:

diff --git a/dwm.c b/dwm.c
--- a/dwm.c
+++ b/dwm.c
@@ -1689,12 +1689,13 @@ tile(void) {
                 for(n = 0, c = nexttiled(clients, m); c; c = nexttiled(c->next, m))
                         n++;
 
+ /* window geoms */
+ mw = (n == 1) ? m->waw : m->mwfact * m->waw;
+ th = (n > 1) ? m->wah / (n - 1) : 0;
+ if(n > 1 && th < bh)
+ th = m->wah;
+
                 for(j = 0, c = mc = nexttiled(clients, m); c; c = nexttiled(c->next, m)) {
- /* window geoms */
- mw = (n == 1) ? m->waw : m->mwfact * m->waw;
- th = (n > 1) ? m->wah / (n - 1) : 0;
- if(n > 1 && th < bh)
- th = m->wah;
                         if(j == 0) { /* master */
                                 nx = m->wax;
                                 ny = m->way;

Best wishes,

Chris.
Received on Sun Jan 13 2008 - 20:29:39 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:15:50 UTC