applied dwm-4.8-snaptileds.diff

master
Anselm R Garbe 2008-02-11 20:43:41 +00:00
parent 012710a3ce
commit c619363d15
1 changed files with 11 additions and 12 deletions

13
dwm.c
View File

@ -368,23 +368,16 @@ buttonpress(XEvent *e) {
if(CLEANMASK(ev->state) != MODKEY) if(CLEANMASK(ev->state) != MODKEY)
return; return;
if(ev->button == Button1) { if(ev->button == Button1) {
if((m->layout->arrange == floating) || c->isfloating)
restack(); restack();
else
togglefloating(NULL);
movemouse(c); movemouse(c);
} }
else if(ev->button == Button2) { else if(ev->button == Button2) {
if((floating != m->layout->arrange) && c->isfloating) if((floating != m->layout->arrange) && c->isfloating)
togglefloating(NULL); togglefloating(NULL);
else
zoom(NULL); zoom(NULL);
} }
else if(ev->button == Button3 && !c->isfixed) { else if(ev->button == Button3 && !c->isfixed) {
if((floating == m->layout->arrange) || c->isfloating)
restack(); restack();
else
togglefloating(NULL);
resizemouse(c); resizemouse(c);
} }
} }
@ -1195,6 +1188,9 @@ movemouse(Client *c) {
ny = m->way; ny = m->way;
else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP) else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP)
ny = m->way + m->wah - c->h - 2 * c->border; ny = m->way + m->wah - c->h - 2 * c->border;
if((monitors[selmonitor].layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP))
togglefloating(NULL);
if((monitors[selmonitor].layout->arrange == floating) || c->isfloating)
resize(c, nx, ny, c->w, c->h, False); resize(c, nx, ny, c->w, c->h, False);
memcpy(c->tags, monitors[monitorat()].seltags, sizeof initags); memcpy(c->tags, monitors[monitorat()].seltags, sizeof initags);
break; break;
@ -1358,6 +1354,9 @@ resizemouse(Client *c) {
nw = 1; nw = 1;
if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0) if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
nh = 1; nh = 1;
if((monitors[selmonitor].layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP))
togglefloating(NULL);
if((monitors[selmonitor].layout->arrange == floating) || c->isfloating)
resize(c, c->x, c->y, nw, nh, True); resize(c, c->x, c->y, nw, nh, True);
break; break;
} }