Compare commits

...

8 Commits
2.1 ... 2.2

7 changed files with 43 additions and 38 deletions

View File

@ -19,3 +19,4 @@ d5ad819f2a66a40fa75dd2e44429f3bfc884d07b 1.7.1
c71952fa3c7ca848ec38a6923b5c6d0e18fff431 1.8 c71952fa3c7ca848ec38a6923b5c6d0e18fff431 1.8
a5567a0d30112822db2627a04a2e7aa3b6c38148 1.9 a5567a0d30112822db2627a04a2e7aa3b6c38148 1.9
12deea36603da407e3f32640048846a3bd74a9ec 2.0 12deea36603da407e3f32640048846a3bd74a9ec 2.0
a2c465098a3b972bbed00feda9804b6aae1e9531 2.1

View File

@ -12,10 +12,10 @@ const char *tags[] = { "dev", "work", "net", "fnord", NULL };
#define FONT "-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*" #define FONT "-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*"
#define NORMBGCOLOR "#333333" #define NORMBGCOLOR "#333333"
#define NORMFGCOLOR "#dddddd" #define NORMFGCOLOR "#dddddd"
#define SELBGCOLOR "#333366" #define SELBGCOLOR "#336699"
#define SELFGCOLOR "#eeeeee" #define SELFGCOLOR "#eeeeee"
#define STATUSBGCOLOR "#222222" #define STATUSBGCOLOR "#222222"
#define STATUSFGCOLOR "#9999cc" #define STATUSFGCOLOR "#99ccff"
#define MASTER 600 /* per thousand */ #define MASTER 600 /* per thousand */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask

View File

@ -1,5 +1,5 @@
# dwm version # dwm version
VERSION = 2.1 VERSION = 2.2
# Customize below to fit your system # Customize below to fit your system

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);

50
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 = th - 2 * BORDERPX;
c->h = sh - c->y - 2 * BORDERPX;
else
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++;
@ -196,9 +190,13 @@ isvisible(Client *c) {
void void
resizemaster(Arg *arg) { resizemaster(Arg *arg) {
if(master + arg->i > 950 || master + arg->i < 50) if(arg->i == 0)
return; master = MASTER;
master += arg->i; else {
if(master + arg->i > 950 || master + arg->i < 50)
return;
master += arg->i;
}
arrange(); arrange();
} }