diff options
author | okan | 2015-11-11 14:22:01 +0000 |
---|---|---|
committer | okan | 2015-11-11 14:22:01 +0000 |
commit | f6f5e0fe9eb0a0ce66ee5d0720182bfadf2cf800 (patch) | |
tree | 55799ebc2fe2f87b956e1440a0b2ce413bbffe64 /client.c | |
parent | 29e76eaac34fcdbc70eaccb72c3f68b638a4c5b2 (diff) | |
download | cwm-f6f5e0fe9eb0a0ce66ee5d0720182bfadf2cf800.tar.gz |
Partial revert of replacing screen_area() with region_find(); until a
fix for a regression is found; this bug has been around for a long time
it seems, but this change exposed it. Likely need to track clients in to
and out of regions.
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 96 |
1 files changed, 47 insertions, 49 deletions
@@ -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.212 2015/11/10 20:05:33 okan Exp $ + * $OpenBSD: client.c,v 1.213 2015/11/11 14:22:01 okan Exp $ */ #include <sys/types.h> @@ -290,7 +290,7 @@ void client_toggle_fullscreen(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; - struct region_ctx *rc; + struct geom area; if ((cc->flags & CLIENT_FREEZE) && !(cc->flags & CLIENT_FULLSCREEN)) @@ -305,12 +305,12 @@ client_toggle_fullscreen(struct client_ctx *cc) cc->fullgeom = cc->geom; - rc = region_find(sc, + area = screen_area(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_NOGAP); cc->bwidth = 0; - cc->geom = rc->view; + cc->geom = area; cc->flags |= (CLIENT_FULLSCREEN | CLIENT_FREEZE); resize: @@ -322,7 +322,7 @@ void client_toggle_maximize(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; - struct region_ctx *rc; + struct geom area; if (cc->flags & CLIENT_FREEZE) return; @@ -348,14 +348,14 @@ client_toggle_maximize(struct client_ctx *cc) * that's probably more fair than if just the origin of * a window is poking over a boundary */ - rc = region_find(sc, + area = screen_area(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); - cc->geom.x = rc->work.x; - cc->geom.y = rc->work.y; - cc->geom.w = rc->work.w - (cc->bwidth * 2); - cc->geom.h = rc->work.h - (cc->bwidth * 2); + cc->geom.x = area.x; + cc->geom.y = area.y; + cc->geom.w = area.w - (cc->bwidth * 2); + cc->geom.h = area.h - (cc->bwidth * 2); cc->flags |= CLIENT_MAXIMIZED; resize: @@ -367,7 +367,7 @@ void client_toggle_vmaximize(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; - struct region_ctx *rc; + struct geom area; if (cc->flags & CLIENT_FREEZE) return; @@ -382,12 +382,12 @@ client_toggle_vmaximize(struct client_ctx *cc) cc->savegeom.y = cc->geom.y; cc->savegeom.h = cc->geom.h; - rc = region_find(sc, + area = screen_area(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); - cc->geom.y = rc->work.y; - cc->geom.h = rc->work.h - (cc->bwidth * 2); + cc->geom.y = area.y; + cc->geom.h = area.h - (cc->bwidth * 2); cc->flags |= CLIENT_VMAXIMIZED; resize: @@ -399,7 +399,7 @@ void client_toggle_hmaximize(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; - struct region_ctx *rc; + struct geom area; if (cc->flags & CLIENT_FREEZE) return; @@ -414,12 +414,12 @@ client_toggle_hmaximize(struct client_ctx *cc) cc->savegeom.x = cc->geom.x; cc->savegeom.w = cc->geom.w; - rc = region_find(sc, + area = screen_area(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); - cc->geom.x = rc->work.x; - cc->geom.w = rc->work.w - (cc->bwidth * 2); + cc->geom.x = area.x; + cc->geom.w = area.w - (cc->bwidth * 2); cc->flags |= CLIENT_HMAXIMIZED; resize: @@ -749,7 +749,6 @@ static void client_placecalc(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; - struct region_ctx *rc; int xslack, yslack; if (cc->hint.flags & (USPosition | PPosition)) { @@ -769,8 +768,7 @@ client_placecalc(struct client_ctx *cc) int xmouse, ymouse; xu_ptr_getpos(sc->rootwin, &xmouse, &ymouse); - rc = region_find(sc, xmouse, ymouse); - area = rc->work; + area = screen_area(sc, xmouse, ymouse, CWM_GAP); area.w += area.x; area.h += area.y; xmouse = MAX(xmouse, area.x) - cc->geom.w / 2; @@ -975,7 +973,7 @@ client_htile(struct client_ctx *cc) struct client_ctx *ci; struct group_ctx *gc = cc->gc; struct screen_ctx *sc = cc->sc; - struct region_ctx *rc; + struct geom area; int i, n, mh, x, h, w; if (!gc) @@ -991,36 +989,36 @@ client_htile(struct client_ctx *cc) if (n == 0) return; - rc = region_find(sc, + area = screen_area(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); if (cc->flags & CLIENT_VMAXIMIZED || - cc->geom.h + (cc->bwidth * 2) >= rc->work.h) + cc->geom.h + (cc->bwidth * 2) >= area.h) return; cc->flags &= ~CLIENT_HMAXIMIZED; - cc->geom.x = rc->work.x; - cc->geom.y = rc->work.y; - cc->geom.w = rc->work.w - (cc->bwidth * 2); + cc->geom.x = area.x; + cc->geom.y = area.y; + cc->geom.w = area.w - (cc->bwidth * 2); client_resize(cc, 1); client_ptrwarp(cc); mh = cc->geom.h + (cc->bwidth * 2); - x = rc->work.x; - w = rc->work.w / n; - h = rc->work.h - mh; + x = area.x; + w = area.w / n; + h = area.h - mh; TAILQ_FOREACH(ci, &gc->clientq, group_entry) { if (ci->flags & CLIENT_HIDDEN || ci->flags & CLIENT_IGNORE || (ci == cc)) continue; ci->bwidth = Conf.bwidth; - ci->geom.y = rc->work.y + mh; + ci->geom.y = area.y + mh; ci->geom.x = x; ci->geom.h = h - (ci->bwidth * 2); ci->geom.w = w - (ci->bwidth * 2); if (i + 1 == n) - ci->geom.w = rc->work.x + rc->work.w - + ci->geom.w = area.x + area.w - ci->geom.x - (ci->bwidth * 2); x += w; client_resize(ci, 1); @@ -1034,7 +1032,7 @@ client_vtile(struct client_ctx *cc) struct client_ctx *ci; struct group_ctx *gc = cc->gc; struct screen_ctx *sc = cc->sc; - struct region_ctx *rc; + struct geom area; int i, n, mw, y, h, w; if (!gc) @@ -1050,36 +1048,36 @@ client_vtile(struct client_ctx *cc) if (n == 0) return; - rc = region_find(sc, + area = screen_area(sc, cc->geom.x + cc->geom.w / 2, - cc->geom.y + cc->geom.h / 2); + cc->geom.y + cc->geom.h / 2, CWM_GAP); if (cc->flags & CLIENT_HMAXIMIZED || - cc->geom.w + (cc->bwidth * 2) >= rc->work.w) + cc->geom.w + (cc->bwidth * 2) >= area.w) return; cc->flags &= ~CLIENT_VMAXIMIZED; - cc->geom.x = rc->work.x; - cc->geom.y = rc->work.y; - cc->geom.h = rc->work.h - (cc->bwidth * 2); + cc->geom.x = area.x; + cc->geom.y = area.y; + cc->geom.h = area.h - (cc->bwidth * 2); client_resize(cc, 1); client_ptrwarp(cc); mw = cc->geom.w + (cc->bwidth * 2); - y = rc->work.y; - h = rc->work.h / n; - w = rc->work.w - mw; + y = area.y; + h = area.h / n; + w = area.w - mw; TAILQ_FOREACH(ci, &gc->clientq, group_entry) { if (ci->flags & CLIENT_HIDDEN || ci->flags & CLIENT_IGNORE || (ci == cc)) continue; ci->bwidth = Conf.bwidth; ci->geom.y = y; - ci->geom.x = rc->work.x + mw; + ci->geom.x = area.x + mw; ci->geom.h = h - (ci->bwidth * 2); ci->geom.w = w - (ci->bwidth * 2); if (i + 1 == n) - ci->geom.h = rc->work.y + rc->work.h - + ci->geom.h = area.y + area.h - ci->geom.y - (ci->bwidth * 2); y += h; client_resize(ci, 1); |