all repos — dwm @ dd218235369d12ad9d71269db11db05c464a09e0

my dwm build

made arrange() Monitor-dependent as well, fixed the movemouse/resizemouse issues
Anselm R Garbe garbeam@gmail.com
Fri, 22 Feb 2008 10:03:42 +0000
commit

dd218235369d12ad9d71269db11db05c464a09e0

parent

9cb9c32ee7d76554cfc44ad8801d70cef9fe25e9

1 files changed, 28 insertions(+), 24 deletions(-)

jump to
M dwm.cdwm.c

@@ -130,7 +130,7 @@

/* function declarations */ void applyrules(Client *c); -void arrange(void); +void arrange(Monitor *m); void attach(Client *c); void attachstack(Client *c); void ban(Client *c);

@@ -299,7 +299,8 @@ c->monitor = monitorat();

} void -arrange(void) { +arrange(Monitor *m) { + unsigned int i; Client *c; for(c = clients; c; c = c->next)

@@ -308,9 +309,13 @@ unban(c);

else ban(c); - selmonitor->layout->arrange(selmonitor); + if(m) + m->layout->arrange(m); + else + for(i = 0; i < mcount; i++) + m->layout->arrange(&monitors[i]); focus(NULL); - restack(selmonitor); + restack(m); } void

@@ -485,7 +490,7 @@ XFreePixmap(dpy, dc.drawable);

dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(root, screen), bh, DefaultDepth(dpy, screen)); XResizeWindow(dpy, m->barwin, m->sw, bh); updatebarpos(m); - arrange(); + arrange(m); } }

@@ -1078,7 +1083,7 @@ c->win = w;

applyrules(c); - m = selmonitor; + m = c->monitor; c->x = wa->x + m->sx; c->y = wa->y + m->sy;

@@ -1122,7 +1127,7 @@ XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); /* some windows require this */

ban(c); XMapWindow(dpy, c->win); setclientstate(c, NormalState); - arrange(); + arrange(m); } void

@@ -1201,7 +1206,7 @@ if(abs(m->way - ny) < SNAP)

ny = m->way; else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP) ny = m->way + m->wah - c->h - 2 * c->border; - if((m->layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) + if(!c->isfloating && (m->layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) togglefloating(NULL); if((m->layout->arrange == floating) || c->isfloating) resize(c, nx, ny, c->w, c->h, False);

@@ -1230,7 +1235,7 @@ default: break;

case XA_WM_TRANSIENT_FOR: XGetTransientForHint(dpy, c->win, &trans); if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL))) - arrange(); + arrange(c->monitor); break; case XA_WM_NORMAL_HINTS: updatesizehints(c);

@@ -1262,7 +1267,7 @@ for(c = clients; c; c = c->next) {

memcpy(c->tags, zerotags, sizeof zerotags); applyrules(c); } - arrange(); + arrange(NULL); } void

@@ -1366,7 +1371,7 @@ if((nw = ev.xmotion.x - ocx - 2 * c->border + 1) <= 0)

nw = 1; if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0) nh = 1; - if((m->layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) + if(!c->isfloating && (m->layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) togglefloating(NULL); if((m->layout->arrange == floating) || c->isfloating) resize(c, c->x, c->y, nw, nh, True);

@@ -1518,7 +1523,7 @@ return;

m->layout = &layouts[i]; } if(sel) - arrange(); + arrange(m); else drawbar(m); }

@@ -1544,7 +1549,7 @@ m->mwfact = 0.1;

else if(m->mwfact > 0.9) m->mwfact = 0.9; } - arrange(); + arrange(m); } void

@@ -1697,7 +1702,7 @@ return;

for(i = 0; i < LENGTH(tags); i++) sel->tags[i] = (NULL == arg); sel->tags[idxoftag(arg)] = True; - arrange(); + arrange(sel->monitor); } unsigned int

@@ -1769,7 +1774,7 @@ bpos = (BARPOS == BarOff) ? BarTop : BARPOS;

else bpos = BarOff; updatebarpos(monitorat()); - arrange(); + arrange(monitorat()); } void

@@ -1779,7 +1784,7 @@ return;

sel->isfloating = !sel->isfloating; if(sel->isfloating) resize(sel, sel->x, sel->y, sel->w, sel->h, True); - arrange(); + arrange(sel->monitor); } void

@@ -1793,13 +1798,12 @@ sel->tags[i] = !sel->tags[i];

for(j = 0; j < LENGTH(tags) && !sel->tags[j]; j++); if(j == LENGTH(tags)) sel->tags[i] = True; /* at least one tag must be enabled */ - arrange(); + arrange(sel->monitor); } void toggleview(const char *arg) { unsigned int i, j; - Monitor *m = monitorat(); i = idxoftag(arg);

@@ -1807,7 +1811,7 @@ m->seltags[i] = !m->seltags[i];

for(j = 0; j < LENGTH(tags) && !m->seltags[j]; j++); if(j == LENGTH(tags)) m->seltags[i] = True; /* at least one tag must be viewed */ - arrange(); + arrange(m); } void

@@ -1838,7 +1842,7 @@ free(c);

XSync(dpy, False); XSetErrorHandler(xerror); XUngrabServer(dpy); - arrange(); + arrange(NULL); } void

@@ -1988,7 +1992,7 @@ tmp[idxoftag(arg)] = True;

if(memcmp(m->seltags, tmp, sizeof initags) != 0) { memcpy(m->prevtags, m->seltags, sizeof initags); memcpy(m->seltags, tmp, sizeof initags); - arrange(); + arrange(m); } }

@@ -2001,7 +2005,7 @@

memcpy(tmp, m->seltags, sizeof initags); memcpy(m->seltags, m->prevtags, sizeof initags); memcpy(m->prevtags, tmp, sizeof initags); - arrange(); + arrange(m); } void

@@ -2016,7 +2020,7 @@ return;

detach(c); attach(c); focus(c); - arrange(); + arrange(c->monitor); } void

@@ -2035,7 +2039,7 @@ sel->monitor = &monitors[i % mcount];

memcpy(sel->tags, sel->monitor->seltags, sizeof initags); resize(sel, sel->monitor->wax, sel->monitor->way, sel->w, sel->h, True); - arrange(); + arrange(sel->monitor); } void