diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2019-02-22 14:39:19 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2019-02-22 14:39:19 +0000 |
commit | 7100d7ae89c587300906ea12a5e5aaac01181df7 (patch) | |
tree | a79641c93281d397c438b735ba7c19688e4e1a18 /app/cwm | |
parent | d42b2bae89ef15460cfde660c35f03321903ede1 (diff) |
Limit vtile/htile actions to clients fully within the screen of master client.
from Charles A Daniels.
Diffstat (limited to 'app/cwm')
-rw-r--r-- | app/cwm/client.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/app/cwm/client.c b/app/cwm/client.c index 27658e67b..cd2ace39b 100644 --- a/app/cwm/client.c +++ b/app/cwm/client.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: client.c,v 1.247 2018/11/13 17:37:13 okan Exp $ + * $OpenBSD: client.c,v 1.248 2019/02/22 14:39:18 okan Exp $ */ #include <sys/types.h> @@ -986,19 +986,23 @@ client_htile(struct client_ctx *cc) return; i = n = 0; + area = screen_area(sc, + cc->geom.x + cc->geom.w / 2, + cc->geom.y + cc->geom.h / 2, CWM_GAP); + TAILQ_FOREACH(ci, &gc->clientq, group_entry) { if (ci->flags & CLIENT_HIDDEN || - ci->flags & CLIENT_IGNORE || (ci == cc)) + ci->flags & CLIENT_IGNORE || (ci == cc) || + ci->geom.x < area.x || + ci->geom.x > (area.x + area.w) || + ci->geom.y < area.y || + ci->geom.y > (area.y + area.h)) continue; n++; } if (n == 0) return; - area = screen_area(sc, - cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2, CWM_GAP); - if (cc->flags & CLIENT_VMAXIMIZED || cc->geom.h + (cc->bwidth * 2) >= area.h) return; @@ -1017,7 +1021,11 @@ client_htile(struct client_ctx *cc) h = area.h - mh; TAILQ_FOREACH(ci, &gc->clientq, group_entry) { if (ci->flags & CLIENT_HIDDEN || - ci->flags & CLIENT_IGNORE || (ci == cc)) + ci->flags & CLIENT_IGNORE || (ci == cc) || + ci->geom.x < area.x || + ci->geom.x > (area.x + area.w) || + ci->geom.y < area.y || + ci->geom.y > (area.y + area.h)) continue; ci->bwidth = Conf.bwidth; ci->geom.x = x; @@ -1044,21 +1052,26 @@ client_vtile(struct client_ctx *cc) if (!gc) return; + + area = screen_area(sc, + cc->geom.x + cc->geom.w / 2, + cc->geom.y + cc->geom.h / 2, CWM_GAP); + i = n = 0; TAILQ_FOREACH(ci, &gc->clientq, group_entry) { if (ci->flags & CLIENT_HIDDEN || - ci->flags & CLIENT_IGNORE || (ci == cc)) + ci->flags & CLIENT_IGNORE || (ci == cc) || + ci->geom.x < area.x || + ci->geom.x > (area.x + area.w) || + ci->geom.y < area.y || + ci->geom.y > (area.y + area.h)) continue; n++; } if (n == 0) return; - area = screen_area(sc, - cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2, CWM_GAP); - if (cc->flags & CLIENT_HMAXIMIZED || cc->geom.w + (cc->bwidth * 2) >= area.w) return; @@ -1077,7 +1090,11 @@ client_vtile(struct client_ctx *cc) w = area.w - mw; TAILQ_FOREACH(ci, &gc->clientq, group_entry) { if (ci->flags & CLIENT_HIDDEN || - ci->flags & CLIENT_IGNORE || (ci == cc)) + ci->flags & CLIENT_IGNORE || (ci == cc) || + ci->geom.x < area.x || + ci->geom.x > (area.x + area.w) || + ci->geom.y < area.y || + ci->geom.y > (area.y + area.h)) continue; ci->bwidth = Conf.bwidth; ci->geom.x = area.x + mw; |