magentic and screen bound grow/shrink

This commit is contained in:
Michael Weber 2012-07-06 00:49:56 +02:00
parent 95484ae032
commit 9b6808dc5c

View File

@ -160,7 +160,8 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
if (ox < 0) nx = 0;
else if (ox < (sw - ow - bw) / 2) nx = (sw - ow - bw) / 2;
else nx = sw - ow - bw;
} else if (flags & CWM_GROW) {
} else if (flags & ( CWM_GROW | CWM_SHRINK)) {
if (flags & CWM_GROW ) {
if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) {
} else if (ow + bw < sw / 3) {
nw = sw / 3 - bw;
@ -175,7 +176,7 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
client_maximize(cc);
goto end;
}
} else if (flags & CWM_SHRINK) {
} else {
if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) {
client_maximize(cc);
goto end;
@ -192,6 +193,15 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
}
nx += (ow - nw)/2;
ny += (oh - nh)/2;
if (abs(ox) < Conf.snapdist) nx = 0;
else if (abs(sw - bw - ox - ow) < Conf.snapdist) nx = sw - bw - nw;
if (abs(oy) < Conf.snapdist) ny = 0;
else if (abs(sh - bw - oy - oh) < Conf.snapdist) ny = sh - nh - bw;
if (nx < 0) nx = 0;
else if (nx + nw + bw > sw) nx = sw - nw - bw;
if (ny < 0) ny = 0;
else if (ny + nh + bw > sh) ny = sh - nh - bw;
}
client_ptrsave(cc);
client_resize(cc);
cc->ptr.x += (nw - ow)/2;