1
0

applied Gottox' windowarea patch

This commit is contained in:
arg@mig29 2006-11-16 14:40:57 +01:00
parent df1a0f9445
commit b003a35fde
4 changed files with 32 additions and 32 deletions

1
dwm.h
View File

@ -96,6 +96,7 @@ extern const char *tags[]; /* all tags */
extern char stext[1024]; /* status text */ extern char stext[1024]; /* status text */
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */ extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
extern int screen, sx, sy, sw, sh; /* screen geometry */ extern int screen, sx, sy, sw, sh; /* screen geometry */
extern int wax, way, wah, waw; /* windowarea geometry */
extern unsigned int master, ntags, numlockmask; /* master percent, number of tags, dynamic lock mask */ extern unsigned int master, ntags, numlockmask; /* master percent, number of tags, dynamic lock mask */
extern void (*handler[LASTEvent])(XEvent *); /* event handler */ extern void (*handler[LASTEvent])(XEvent *); /* event handler */
extern void (*arrange)(void); /* arrange function, indicates mode */ extern void (*arrange)(void); /* arrange function, indicates mode */

16
event.c
View File

@ -48,14 +48,14 @@ movemouse(Client *c) {
XSync(dpy, False); XSync(dpy, False);
c->x = ocx + (ev.xmotion.x - x1); c->x = ocx + (ev.xmotion.x - x1);
c->y = ocy + (ev.xmotion.y - y1); c->y = ocy + (ev.xmotion.y - y1);
if(abs(sx + c->x) < SNAP) if(abs(wax + c->x) < SNAP)
c->x = sx; c->x = wax;
else if(abs((sx + sw) - (c->x + c->w)) < SNAP) else if(abs((wax + waw) - (c->x + c->w)) < SNAP)
c->x = sw - c->w - 2 * BORDERPX; c->x = wax + waw - c->w - 2 * BORDERPX;
if(abs((sy + bh) - c->y) < SNAP) if(abs(way - c->y) < SNAP)
c->y = sy + bh; c->y = way;
else if(abs((sy + sh) - (c->y + c->h)) < SNAP) else if(abs((way + wah) - (c->y + c->h)) < SNAP)
c->y = sh - c->h - 2 * BORDERPX; c->y = way + wah - c->h - 2 * BORDERPX;
resize(c, False, TopLeft); resize(c, False, TopLeft);
break; break;
} }

7
main.c
View File

@ -18,7 +18,7 @@
char stext[1024]; char stext[1024];
Bool *seltag; Bool *seltag;
int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh; int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah;
unsigned int master, ntags, numlockmask; unsigned int master, ntags, numlockmask;
Atom wmatom[WMLast], netatom[NetLast]; Atom wmatom[WMLast], netatom[NetLast];
Bool running = True; Bool running = True;
@ -142,6 +142,11 @@ setup(void) {
XDefineCursor(dpy, barwin, cursor[CurNormal]); XDefineCursor(dpy, barwin, cursor[CurNormal]);
XMapRaised(dpy, barwin); XMapRaised(dpy, barwin);
strcpy(stext, "dwm-"VERSION); strcpy(stext, "dwm-"VERSION);
/* windowarea */
wax = sx;
way = bh;
wah = sh - bh;
waw = sw;
/* pixmap for everything */ /* pixmap for everything */
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
dc.gc = XCreateGC(dpy, root, 0, 0); dc.gc = XCreateGC(dpy, root, 0, 0);

38
view.c
View File

@ -49,10 +49,10 @@ togglemax(Client *c) {
return; return;
if((c->ismax = !c->ismax)) { if((c->ismax = !c->ismax)) {
c->rx = c->x; c->x = sx; c->rx = c->x; c->x = wax;
c->ry = c->y; c->y = bh; c->ry = c->y; c->y = way;
c->rw = c->w; c->w = sw - 2 * BORDERPX; c->rw = c->w; c->w = waw - 2 * BORDERPX;
c->rh = c->h; c->h = sh - bh - 2 * BORDERPX; c->rh = c->h; c->h = wah - 2 * BORDERPX;
} }
else { else {
c->x = c->rx; c->x = c->rx;
@ -99,17 +99,13 @@ dofloat(void) {
void void
dotile(void) { dotile(void) {
unsigned int i, n, mpx, stackw, stackh, th; unsigned int i, n, mpx, stackw, th;
Client *c; Client *c;
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
n++; n++;
mpx = (sw * master) / 1000; mpx = (waw * master) / 1000;
stackw = sw - mpx; stackw = waw - mpx;
stackh = sh - bh;
th = stackh;
if(n > 1)
th /= (n - 1);
for(i = 0, c = clients; c; c = c->next) for(i = 0, c = clients; c; c = c->next)
if(isvisible(c)) { if(isvisible(c)) {
@ -118,28 +114,26 @@ dotile(void) {
continue; continue;
} }
c->ismax = False; c->ismax = False;
c->x = sx; c->x = wax;
c->y = sy + bh; c->y = way;
if(n == 1) { /* only 1 window */ if(n == 1) { /* only 1 window */
c->w = sw - 2 * BORDERPX; c->w = waw - 2 * BORDERPX;
c->h = sh - 2 * BORDERPX - bh; c->h = wah - 2 * BORDERPX;
} }
else if(i == 0) { /* master window */ else if(i == 0) { /* master window */
c->w = mpx - 2 * BORDERPX; c->w = waw - stackw - 2 * BORDERPX;
c->h = sh - bh - 2 * BORDERPX; c->h = wah - 2 * BORDERPX;
th = wah / (n - 1);
} }
else { /* tile window */ else { /* tile window */
c->x += mpx; c->x += mpx;
c->w = stackw - 2 * BORDERPX; c->w = stackw - 2 * BORDERPX;
if(th > bh) { if(th > bh) {
c->y = sy + (i - 1) * th + bh; c->y = way + (i - 1) * th;
if(i + 1 == n)
c->h = sh - c->y - 2 * BORDERPX;
else
c->h = th - 2 * BORDERPX; c->h = th - 2 * BORDERPX;
} }
else /* fallback if th < bh */ else /* fallback if th < bh */
c->h = stackh - 2 * BORDERPX; c->h = wah - 2 * BORDERPX;
} }
resize(c, False, TopLeft); resize(c, False, TopLeft);
i++; i++;