aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorokan2009-01-22 19:01:56 +0000
committerokan2009-01-22 19:01:56 +0000
commit4b2cd3a9e6fb79dc8497bc499aea252775e9029c (patch)
treed1b2fec118d52796b1a8162630a3ad8f06b551ec /client.c
parent9f7c5b89793258b4c7126f036eb1493b0bb9d3fc (diff)
downloadcwm-4b2cd3a9e6fb79dc8497bc499aea252775e9029c.tar.gz
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 'client.c')
-rw-r--r--client.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/client.c b/client.c
index 98927f8..ffa8922 100644
--- a/client.c
+++ b/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;
}
}