applied Jukkas patch

This commit is contained in:
Anselm R. Garbe 2006-09-28 14:03:39 +02:00
parent c34df2c1b6
commit 1c2d673ded
3 changed files with 19 additions and 17 deletions

View file

@ -214,11 +214,11 @@ manage(Window w, XWindowAttributes *wa) {
c->border = 0; c->border = 0;
updatesize(c); updatesize(c);
if(c->x + c->w + 2 > sw) if(c->x + c->w + 2 * BORDERPX > sw)
c->x = sw - c->w - 2; c->x = sw - c->w - 2 * BORDERPX;
if(c->x < 0) if(c->x < 0)
c->x = 0; c->x = 0;
if(c->y + c->h + 2 > sh) if(c->y + c->h + 2 * BORDERPX > sh)
c->y = sh - c->h - 2; c->y = sh - c->h - 2;
if(c->h != sh && c->y < bh) if(c->h != sh && c->y < bh)
c->y = bh; c->y = bh;
@ -302,7 +302,7 @@ resize(Client *c, Bool sizehints, Corner sticky) {
if(c->w == sw && c->h == sh) if(c->w == sw && c->h == sh)
wc.border_width = 0; wc.border_width = 0;
else else
wc.border_width = 1; wc.border_width = BORDERPX;
XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc); XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
configure(c); configure(c);
XSync(dpy, False); XSync(dpy, False);
@ -312,8 +312,8 @@ void
resizetitle(Client *c) { resizetitle(Client *c) {
c->tw = textw(c->name); c->tw = textw(c->name);
if(c->tw > c->w) if(c->tw > c->w)
c->tw = c->w + 2; c->tw = c->w + 2 * BORDERPX;
c->tx = c->x + c->w - c->tw + 2; c->tx = c->x + c->w - c->tw + 2 * BORDERPX;
c->ty = c->y; c->ty = c->y;
if(isvisible(c)) if(isvisible(c))
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);

2
dwm.h
View file

@ -38,6 +38,8 @@
/* mask shorthands, used in event.c and client.c */ /* mask shorthands, used in event.c and client.c */
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask) #define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
#define MOUSEMASK (BUTTONMASK | PointerMotionMask) #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
/* other stuff used in different places */
#define BORDERPX 1
#define PROTODELWIN 1 #define PROTODELWIN 1
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */

22
view.c
View file

@ -49,8 +49,8 @@ togglemax(Client *c)
if((c->ismax = !c->ismax)) { if((c->ismax = !c->ismax)) {
c->rx = c->x; c->x = sx; c->rx = c->x; c->x = sx;
c->ry = c->y; c->y = bh; c->ry = c->y; c->y = bh;
c->rw = c->w; c->w = sw; c->rw = c->w; c->w = sw - 2 * BORDERPX;
c->rh = c->h; c->h = sh - bh - 2; c->rh = c->h; c->h = sh - bh - 2 * BORDERPX;
} }
else { else {
c->x = c->rx; c->x = c->rx;
@ -119,29 +119,29 @@ dotile(Arg *arg) {
if(n == 1) { if(n == 1) {
c->x = sx; c->x = sx;
c->y = sy + bh; c->y = sy + bh;
c->w = sw - 2; c->w = sw - 2 * BORDERPX;
c->h = sh - 2 - bh; c->h = sh - 2 * BORDERPX - bh;
} }
else if(i == 0) { else if(i == 0) {
c->x = sx; c->x = sx;
c->y = sy + bh; c->y = sy + bh;
c->w = mw - 2; c->w = mw - 2 * BORDERPX;
c->h = sh - 2 - bh; c->h = sh - 2 * BORDERPX - bh;
} }
else if(h > bh) { else if(h > bh) {
c->x = sx + mw; c->x = sx + mw;
c->y = sy + (i - 1) * h + bh; c->y = sy + (i - 1) * h + bh;
c->w = w - 2; c->w = w - 2 * BORDERPX;
if(i + 1 == n) if(i + 1 == n)
c->h = sh - c->y - 2; c->h = sh - c->y - 2 * BORDERPX;
else else
c->h = h - 2; c->h = h - 2 * BORDERPX;
} }
else { /* fallback if h < bh */ else { /* fallback if h < bh */
c->x = sx + mw; c->x = sx + mw;
c->y = sy + bh; c->y = sy + bh;
c->w = w - 2; c->w = w - 2 * BORDERPX;
c->h = sh - 2 - bh; c->h = sh - 2 * BORDERPX - bh;
} }
resize(c, False, TopLeft); resize(c, False, TopLeft);
i++; i++;