diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2009-01-22 19:01:57 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2009-01-22 19:01:57 +0000 |
commit | 31abe496d1a3fe51c2aa84d722fe2dfcb4604f04 (patch) | |
tree | cb386c9eb611a827589fe59b744b585b25718cfa /app/cwm/client.c | |
parent | 9aff1b2e6e2d4947ab26df33b5aa48cc51ddf59d (diff) |
now that pwin is gone gone gone, we no longer have to do the bwidth
dance; xevents now able to deal with a border being set (which fixes
those annoying movie-watching apps).
ok todd@, oga@
Diffstat (limited to 'app/cwm/client.c')
-rw-r--r-- | app/cwm/client.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/app/cwm/client.c b/app/cwm/client.c index 98927f858..ffa892229 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. * - * $Id: client.c,v 1.45 2009/01/22 15:26:33 oga Exp $ + * $Id: client.c,v 1.46 2009/01/22 19:01:56 okan Exp $ */ #include "headers.h" @@ -103,7 +103,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped) if ((wmhints = XGetWMHints(X_Dpy, cc->win)) != NULL) { if (wmhints->flags & StateHint) xu_setstate(cc, wmhints->initial_state); - + XFree(wmhints); } client_move(cc); @@ -265,8 +265,8 @@ client_maximize(struct client_ctx *cc) ymax = xine->height; } calc: - cc->geom.x = x_org + Conf.gap_left; - cc->geom.y = y_org + Conf.gap_top; + cc->geom.x = x_org - cc->bwidth + Conf.gap_left; + cc->geom.y = y_org - cc->bwidth + Conf.gap_top; cc->geom.height = ymax - (Conf.gap_top + Conf.gap_bottom); cc->geom.width = xmax - (Conf.gap_left + Conf.gap_right); cc->flags |= CLIENT_DOMAXIMIZE; @@ -297,7 +297,7 @@ client_vertmaximize(struct client_ctx *cc) ymax = xine->height; } calc: - cc->geom.y = y_org + cc->bwidth + Conf.gap_top; + cc->geom.y = y_org + Conf.gap_top; cc->geom.height = ymax - (cc->bwidth * 2) - (Conf.gap_top + Conf.gap_bottom); cc->flags |= CLIENT_DOVMAXIMIZE; @@ -320,16 +320,15 @@ client_resize(struct client_ctx *cc) cc->flags |= CLIENT_VMAXIMIZED; } - XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x - cc->bwidth, - cc->geom.y - cc->bwidth, cc->geom.width, cc->geom.height); + XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x, + cc->geom.y, cc->geom.width, cc->geom.height); xev_reconfig(cc); } void client_move(struct client_ctx *cc) { - XMoveWindow(X_Dpy, cc->win, - cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth); + XMoveWindow(X_Dpy, cc->win, cc->geom.x, cc->geom.y); xev_reconfig(cc); } @@ -419,6 +418,7 @@ client_draw_border(struct client_ctx *cc) } else pixl = sc->graypixl; + XSetWindowBorderWidth(X_Dpy, cc->win, cc->bwidth); XSetWindowBorder(X_Dpy, cc->win, pixl); } @@ -563,7 +563,7 @@ void client_placecalc(struct client_ctx *cc) { struct screen_ctx *sc = CCTOSC(cc); - int yslack, xslack; + int xslack, yslack; if (cc->size->flags & USPosition) { /* @@ -573,16 +573,12 @@ client_placecalc(struct client_ctx *cc) * XRandR bits mean that {x,y}max shouldn't be outside what's * currently there. */ - yslack = sc->ymax - cc->geom.height - cc->bwidth; - xslack = sc->xmax - cc->geom.width - cc->bwidth; - if (cc->size->x >= 0) - cc->geom.x = MAX(MIN(cc->size->x, xslack), cc->bwidth); - else - cc->geom.x = cc->bwidth; - if (cc->size->y >= 0) - cc->geom.y = MAX(MIN(cc->size->y, yslack), cc->bwidth); - else - cc->geom.y = cc->bwidth; + xslack = sc->xmax - cc->geom.width - cc->bwidth * 2; + yslack = sc->ymax - cc->geom.height - cc->bwidth * 2; + if (cc->size->x > 0) + cc->geom.x = MIN(cc->size->x, xslack); + if (cc->size->y > 0) + cc->geom.y = MIN(cc->size->y, yslack); } else { XineramaScreenInfo *info; int xmouse, ymouse, xorig, yorig; @@ -603,30 +599,31 @@ noxine: xmax = sc->xmax; ymax = sc->ymax; } - xmouse = MAX(xmouse, xorig + cc->bwidth) - cc->geom.width / 2; - ymouse = MAX(ymouse, yorig + cc->bwidth) - cc->geom.height / 2; + xmouse = MAX(xmouse, xorig) - cc->geom.width / 2; + ymouse = MAX(ymouse, yorig) - cc->geom.height / 2; + + xmouse = MAX(xmouse, xorig); + ymouse = MAX(ymouse, yorig); - xmouse = MAX(xmouse, xorig + (int)cc->bwidth); - ymouse = MAX(ymouse, yorig + (int)cc->bwidth); + xslack = xmax - cc->geom.width - cc->bwidth * 2; + yslack = ymax - cc->geom.height - cc->bwidth * 2; - xslack = xmax - cc->geom.width - cc->bwidth; - yslack = ymax - cc->geom.height - cc->bwidth; if (xslack >= xorig) { cc->geom.x = MAX(MIN(xmouse, xslack), - xorig + Conf.gap_left + cc->bwidth); + xorig + Conf.gap_left); if (cc->geom.x > (xslack - Conf.gap_right)) cc->geom.x -= Conf.gap_right; } else { - cc->geom.x = xorig + cc->bwidth + Conf.gap_left; + cc->geom.x = xorig + Conf.gap_left; cc->geom.width = xmax - Conf.gap_left; } if (yslack >= yorig) { cc->geom.y = MAX(MIN(ymouse, yslack), - yorig + Conf.gap_top + cc->bwidth); + yorig + Conf.gap_top); if (cc->geom.y > (yslack - Conf.gap_bottom)) cc->geom.y -= Conf.gap_bottom; } else { - cc->geom.y = yorig + cc->bwidth + Conf.gap_top; + cc->geom.y = yorig + Conf.gap_top; cc->geom.height = ymax - Conf.gap_top; } } |