mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
magentic and screen bound grow/shrink
This commit is contained in:
parent
95484ae032
commit
9b6808dc5c
14
kbfunc.c
14
kbfunc.c
@ -160,7 +160,8 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
|
|||||||
if (ox < 0) nx = 0;
|
if (ox < 0) nx = 0;
|
||||||
else if (ox < (sw - ow - bw) / 2) nx = (sw - ow - bw) / 2;
|
else if (ox < (sw - ow - bw) / 2) nx = (sw - ow - bw) / 2;
|
||||||
else nx = sw - ow - bw;
|
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) {
|
if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) {
|
||||||
} else if (ow + bw < sw / 3) {
|
} else if (ow + bw < sw / 3) {
|
||||||
nw = sw / 3 - bw;
|
nw = sw / 3 - bw;
|
||||||
@ -175,7 +176,7 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
|
|||||||
client_maximize(cc);
|
client_maximize(cc);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
} else if (flags & CWM_SHRINK) {
|
} else {
|
||||||
if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) {
|
if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) {
|
||||||
client_maximize(cc);
|
client_maximize(cc);
|
||||||
goto end;
|
goto end;
|
||||||
@ -192,6 +193,15 @@ kbfunc_moveresize(struct client_ctx *cc, union arg *arg)
|
|||||||
}
|
}
|
||||||
nx += (ow - nw)/2;
|
nx += (ow - nw)/2;
|
||||||
ny += (oh - nh)/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_ptrsave(cc);
|
||||||
client_resize(cc);
|
client_resize(cc);
|
||||||
cc->ptr.x += (nw - ow)/2;
|
cc->ptr.x += (nw - ow)/2;
|
||||||
|
Loading…
Reference in New Issue
Block a user