2wm

dual window manager prototype (minimalist dwm with no tags, just one view)
git clone git://git.suckless.org/2wm
Log | Files | Refs | README | LICENSE

commit 50617966198acc1e5722b4d60e22a23e11af3afd
parent 8833d6c3ec623a8356be0347d97785c58f88a75c
Author: Anselm R. Garbe <arg@suckless.org>
Date:   Mon, 12 Feb 2007 12:23:51 +0100

removed wax/wah/...
Diffstat:
2wm.h | 1-
client.c | 16++++++++--------
event.c | 16++++++++--------
main.c | 9++-------
view.c | 28++++++++++++++--------------
5 files changed, 32 insertions(+), 38 deletions(-)

diff --git a/2wm.h b/2wm.h @@ -36,7 +36,6 @@ struct Client { extern const char *tags[]; /* all tags */ extern int screen, sx, sy, sw, sh; /* screen geometry */ -extern int wax, way, wah, waw; /* windowarea geometry */ extern unsigned int master, nmaster; /* master percent, number of master clients */ extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */ extern void (*handler[LASTEvent])(XEvent *); /* event handler */ diff --git a/client.c b/client.c @@ -163,14 +163,14 @@ manage(Window w, XWindowAttributes *wa) { } else { c->border = BORDERPX; - if(c->x + c->w + 2 * c->border > wax + waw) - c->x = wax + waw - c->w - 2 * c->border; - if(c->y + c->h + 2 * c->border > way + wah) - c->y = way + wah - c->h - 2 * c->border; - if(c->x < wax) - c->x = wax; - if(c->y < way) - c->y = way; + if(c->x + c->w + 2 * c->border > sx + sw) + c->x = sx + sw - c->w - 2 * c->border; + if(c->y + c->h + 2 * c->border > sy + sh) + c->y = sy + sh - c->h - 2 * c->border; + if(c->x < sx) + c->x = sx; + if(c->y < sy) + c->y = sy; } updatesizehints(c); XSelectInput(dpy, c->win, diff --git a/event.c b/event.c @@ -49,14 +49,14 @@ movemouse(Client *c) { XSync(dpy, False); c->x = ocx + (ev.xmotion.x - x1); c->y = ocy + (ev.xmotion.y - y1); - if(abs(wax + c->x) < SNAP) - c->x = wax; - else if(abs((wax + waw) - (c->x + c->w + 2 * c->border)) < SNAP) - c->x = wax + waw - c->w - 2 * c->border; - if(abs(way - c->y) < SNAP) - c->y = way; - else if(abs((way + wah) - (c->y + c->h + 2 * c->border)) < SNAP) - c->y = way + wah - c->h - 2 * c->border; + if(abs(sx + c->x) < SNAP) + c->x = sx; + else if(abs((sx + sw) - (c->x + c->w + 2 * c->border)) < SNAP) + c->x = sx + sw - c->w - 2 * c->border; + if(abs(sy - c->y) < SNAP) + c->y = sy; + else if(abs((sy + sh) - (c->y + c->h + 2 * c->border)) < SNAP) + c->y = sy + sh - c->h - 2 * c->border; resize(c, False); break; } diff --git a/main.c b/main.c @@ -17,7 +17,7 @@ /* extern */ -int screen, sx, sy, sw, sh, wax, way, waw, wah; +int screen, sx, sy, sw, sh; unsigned int master, nmaster, ntags, numlockmask; unsigned long normcol, selcol; Atom wmatom[WMLast], netatom[NetLast]; @@ -132,11 +132,6 @@ setup(void) { sh = DisplayHeight(dpy, screen); master = MASTER; nmaster = NMASTER; - /* windowarea */ - wax = sx; - way = sy; - wah = sh; - waw = sw; /* multihead support */ selscreen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); } @@ -172,7 +167,7 @@ quit(Arg *arg) { running = False; } -/* There's no way to check accesses to destroyed windows, thus those cases are +/* There's no sy to check accesses to destroyed windows, thus those cases are * ignored (especially on UnmapNotify's). Other types of errors call Xlibs * default error handler, which may call exit. */ diff --git a/view.c b/view.c @@ -20,10 +20,10 @@ togglemax(Client *c) { return; if((c->ismax = !c->ismax)) { - c->rx = c->x; c->x = wax; - c->ry = c->y; c->y = way; - c->rw = c->w; c->w = waw - 2 * BORDERPX; - c->rh = c->h; c->h = wah - 2 * BORDERPX; + c->rx = c->x; c->x = sx; + c->ry = c->y; c->y = sy; + c->rw = c->w; c->w = sw - 2 * BORDERPX; + c->rh = c->h; c->h = sh - 2 * BORDERPX; } else { c->x = c->rx; @@ -76,10 +76,10 @@ dotile(void) { for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) n++; /* window geoms */ - mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1); - mw = (n > nmaster) ? (waw * master) / 1000 : waw; - th = (n > nmaster) ? wah / (n - nmaster) : 0; - tw = waw - mw; + mh = (n > nmaster) ? sh / nmaster : sh / (n > 0 ? n : 1); + mw = (n > nmaster) ? (sw * master) / 1000 : sw; + th = (n > nmaster) ? sh / (n - nmaster) : 0; + tw = sw - mw; for(i = 0, c = clients; c; c = c->next) if(isvisible(c)) { @@ -88,8 +88,8 @@ dotile(void) { continue; } c->ismax = False; - c->x = wax; - c->y = way; + c->x = sx; + c->y = sy; if(i < nmaster) { c->y += i * mh; c->w = mw - 2 * BORDERPX; @@ -103,7 +103,7 @@ dotile(void) { c->h = th - 2 * BORDERPX; } else /* fallback if th <= 2 * BORDERPX */ - c->h = wah - 2 * BORDERPX; + c->h = sh - 2 * BORDERPX; } resize(c, False); i++; @@ -150,7 +150,7 @@ focusprev(Arg *arg) { void incnmaster(Arg *arg) { if((arrange == dofloat) || (nmaster + arg->i < 1) - || (wah / (nmaster + arg->i) <= 2 * BORDERPX)) + || (sh / (nmaster + arg->i) <= 2 * BORDERPX)) return; nmaster += arg->i; if(sel) @@ -172,8 +172,8 @@ resizemaster(Arg *arg) { if(arg->i == 0) master = MASTER; else { - if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX - || waw * (master + arg->i) / 1000 <= 2 * BORDERPX) + if(sw * (master + arg->i) / 1000 >= sw - 2 * BORDERPX + || sw * (master + arg->i) / 1000 <= 2 * BORDERPX) return; master += arg->i; }