summaryrefslogtreecommitdiff
path: root/app/cwm
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2009-01-22 19:01:57 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2009-01-22 19:01:57 +0000
commit31abe496d1a3fe51c2aa84d722fe2dfcb4604f04 (patch)
treecb386c9eb611a827589fe59b744b585b25718cfa /app/cwm
parent9aff1b2e6e2d4947ab26df33b5aa48cc51ddf59d (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')
-rw-r--r--app/cwm/client.c57
-rw-r--r--app/cwm/mousefunc.c18
-rw-r--r--app/cwm/xevents.c19
3 files changed, 42 insertions, 52 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;
}
}
diff --git a/app/cwm/mousefunc.c b/app/cwm/mousefunc.c
index 25ec8374d..86cef8a20 100644
--- a/app/cwm/mousefunc.c
+++ b/app/cwm/mousefunc.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: mousefunc.c,v 1.6 2009/01/16 15:24:14 okan Exp $
+ * $Id: mousefunc.c,v 1.7 2009/01/22 19:01:56 okan Exp $
*/
#include "headers.h"
@@ -33,8 +33,8 @@ _mousefunc_sweep_calc(struct client_ctx *cc, int x, int y, int mx, int my)
{
int width = cc->geom.width, height = cc->geom.height;
- cc->geom.width = abs(x - mx);
- cc->geom.height = abs(y - my);
+ cc->geom.width = abs(x - mx) - cc->bwidth;
+ cc->geom.height = abs(y - my) - cc->bwidth;
if (cc->size->flags & PResizeInc) {
cc->geom.width -=
@@ -116,12 +116,7 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg)
ev.xmotion.x, ev.xmotion.y))
/* Recompute window output */
_mousefunc_sweep_draw(cc, dx, dy);
-
- XMoveResizeWindow(X_Dpy, cc->win,
- cc->geom.x - cc->bwidth,
- cc->geom.y - cc->bwidth,
- cc->geom.width + cc->bwidth * 2,
- cc->geom.height + cc->bwidth * 2);
+ client_resize(cc);
break;
case ButtonRelease:
XUnmapWindow(X_Dpy, sc->menuwin);
@@ -166,10 +161,7 @@ mousefunc_window_move(struct client_ctx *cc, void *arg)
case MotionNotify:
cc->geom.x = x + (ev.xmotion.x - mx);
cc->geom.y = y + (ev.xmotion.y - my);
-
- XMoveWindow(X_Dpy, cc->win,
- cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth);
-
+ client_move(cc);
break;
case ButtonRelease:
xu_ptr_ungrab();
diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c
index 626262d78..d1a34d412 100644
--- a/app/cwm/xevents.c
+++ b/app/cwm/xevents.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: xevents.c,v 1.36 2009/01/17 20:39:24 okan Exp $
+ * $Id: xevents.c,v 1.37 2009/01/22 19:01:56 okan Exp $
*/
/*
@@ -111,19 +111,19 @@ xev_handle_configurerequest(struct xevent *xev, XEvent *ee)
cc->geom.x = e->x;
if (e->value_mask & CWY)
cc->geom.y = e->y;
+ if (e->value_mask & CWBorderWidth)
+ wc.border_width = e->border_width;
- if (cc->geom.x == 0 &&
- cc->geom.width >= DisplayWidth(X_Dpy, sc->which))
+ if (cc->geom.x == 0 && cc->geom.width >= sc->xmax)
cc->geom.x -= cc->bwidth;
- if (cc->geom.y == 0 &&
- cc->geom.height >= DisplayHeight(X_Dpy, sc->which))
+ if (cc->geom.y == 0 && cc->geom.height >= sc->ymax)
cc->geom.y -= cc->bwidth;
- wc.x = cc->geom.x - cc->bwidth;
- wc.y = cc->geom.y - cc->bwidth;
- wc.width = cc->geom.width + cc->bwidth*2;
- wc.height = cc->geom.height + cc->bwidth*2;
+ wc.x = cc->geom.x;
+ wc.y = cc->geom.y;
+ wc.width = cc->geom.width;
+ wc.height = cc->geom.height;
wc.border_width = cc->bwidth;
XConfigureWindow(X_Dpy, cc->win, e->value_mask, &wc);
@@ -134,6 +134,7 @@ xev_handle_configurerequest(struct xevent *xev, XEvent *ee)
wc.y = e->y;
wc.width = e->width;
wc.height = e->height;
+ wc.border_width = e->border_width;
wc.stack_mode = Above;
e->value_mask &= ~CWStackMode;