removed the stack position stuff

new_dwm
Anselm R. Garbe 18 years ago
parent 1c1d09f3e9
commit 10885d349a

@ -8,9 +8,7 @@ const char *tags[] = { "dev", "work", "net", "fnord", NULL };
#define DEFMODE dotile /* dofloat */ #define DEFMODE dotile /* dofloat */
#define FLOATSYMBOL "><>" #define FLOATSYMBOL "><>"
#define STACKPOS StackRight /* StackLeft */ #define TILESYMBOL "[]="
#define BSTACKSYMBOL "==="
#define VSTACKSYMBOL "[]="
#define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" #define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*"
#define NORMBGCOLOR "#333333" #define NORMBGCOLOR "#333333"
@ -20,7 +18,7 @@ const char *tags[] = { "dev", "work", "net", "fnord", NULL };
#define STATUSBGCOLOR "#222222" #define STATUSBGCOLOR "#222222"
#define STATUSFGCOLOR "#9999cc" #define STATUSFGCOLOR "#9999cc"
#define MASTER 600 /* per mill */ #define MASTER 600 /* per thousand */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define KEYS \ #define KEYS \
@ -36,9 +34,8 @@ static Key key[] = { \
{ MODKEY, XK_j, focusnext, { 0 } }, \ { MODKEY, XK_j, focusnext, { 0 } }, \
{ MODKEY, XK_k, focusprev, { 0 } }, \ { MODKEY, XK_k, focusprev, { 0 } }, \
{ MODKEY, XK_Return, zoom, { 0 } }, \ { MODKEY, XK_Return, zoom, { 0 } }, \
{ MODKEY, XK_b, togglestackpos, { 0 } }, \ { MODKEY, XK_g, resizecol, { .i = 15 } }, \
{ MODKEY, XK_g, resizecol, { .i = 10 } }, \ { MODKEY, XK_s, resizecol, { .i = -15 } }, \
{ MODKEY, XK_s, resizecol, { .i = -10 } }, \
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \ { MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \ { MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \

@ -8,9 +8,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", NULL };
#define DEFMODE dotile /* dofloat */ #define DEFMODE dotile /* dofloat */
#define FLOATSYMBOL "><>" #define FLOATSYMBOL "><>"
#define STACKPOS StackRight /* StackLeft */ #define TILESYMBOL "[]="
#define BSTACKSYMBOL "==="
#define VSTACKSYMBOL "[]="
#define FONT "fixed" #define FONT "fixed"
#define NORMBGCOLOR "#333366" #define NORMBGCOLOR "#333366"
@ -20,7 +18,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", NULL };
#define STATUSBGCOLOR "#dddddd" #define STATUSBGCOLOR "#dddddd"
#define STATUSFGCOLOR "#222222" #define STATUSFGCOLOR "#222222"
#define MASTER 600 /* per mill */ #define MASTER 600 /* per thousand */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define KEYS \ #define KEYS \
@ -30,9 +28,8 @@ static Key key[] = { \
{ MODKEY, XK_Tab, focusnext, { 0 } }, \ { MODKEY, XK_Tab, focusnext, { 0 } }, \
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \ { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
{ MODKEY, XK_Return, zoom, { 0 } }, \ { MODKEY, XK_Return, zoom, { 0 } }, \
{ MODKEY, XK_b, togglestackpos, { 0 } }, \ { MODKEY, XK_g, resizecol, { .i = 15 } }, \
{ MODKEY, XK_g, resizecol, { .i = 10 } }, \ { MODKEY, XK_s, resizecol, { .i = -15 } }, \
{ MODKEY, XK_s, resizecol, { .i = -10 } }, \
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \ { MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \ { MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \

@ -104,9 +104,7 @@ drawstatus(void) {
} }
dc.w = bmw; dc.w = bmw;
drawtext(arrange == dofloat ? drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False);
FLOATSYMBOL : stackpos == StackBottom ?
BSTACKSYMBOL : VSTACKSYMBOL, dc.status, False);
x = dc.x + dc.w; x = dc.x + dc.w;
dc.w = textw(stext); dc.w = textw(stext);

@ -40,8 +40,7 @@ click on a tag label to display all windows with that tag, click on the mode
label toggles between tiling and floating mode. label toggles between tiling and floating mode.
.TP .TP
.B Button3 .B Button3
click on a tag label adds/removes all windows with that tag to/from the view, click on a tag label adds/removes all windows with that tag to/from the view.
click on the mode label toggles the stack position (tiling mode).
.TP .TP
.B Mod1-Button1 .B Mod1-Button1
click on a tag label applies that tag to the focused window. click on a tag label applies that tag to the focused window.
@ -63,9 +62,6 @@ Focus previous window.
.B Mod1-Return .B Mod1-Return
Zooms/cycles current window to/from master area (tiling mode), toggles maximization current window (floating mode). Zooms/cycles current window to/from master area (tiling mode), toggles maximization current window (floating mode).
.TP .TP
.B Mod1-b
Toggle stack position (tiling mode only).
.TP
.B Mod1-g .B Mod1-g
Grow current area (tiling mode only). Grow current area (tiling mode only).
.TP .TP

@ -47,10 +47,6 @@ enum { WMProtocols, WMDelete, WMLast }; /* default atoms */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColFG, ColBG, ColLast }; /* color */ enum { ColFG, ColBG, ColLast }; /* color */
typedef enum {
StackLeft, StackBottom, StackRight
} StackPos; /* stack position*/
typedef enum { typedef enum {
TopLeft, TopRight, BotLeft, BotRight TopLeft, TopRight, BotLeft, BotRight
} Corner; /* window corners */ } Corner; /* window corners */
@ -111,7 +107,6 @@ extern Client *clients, *sel, *stack; /* global client list and stack */
extern Cursor cursor[CurLast]; extern Cursor cursor[CurLast];
extern DC dc; /* global draw context */ extern DC dc; /* global draw context */
extern Display *dpy; extern Display *dpy;
extern StackPos stackpos;
extern Window root, barwin; extern Window root, barwin;
/* client.c */ /* client.c */
@ -170,7 +165,6 @@ extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ign
extern Bool isvisible(Client *c); /* returns True if client is visible */ extern Bool isvisible(Client *c); /* returns True if client is visible */
extern void resizecol(Arg *arg); /* resizes the master percent with arg's index value */ extern void resizecol(Arg *arg); /* resizes the master percent with arg's index value */
extern void restack(void); /* restores z layers of all clients */ extern void restack(void); /* restores z layers of all clients */
extern void togglestackpos(Arg *arg); /* toggles stack position */
extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */ extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */
extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */
extern void view(Arg *arg); /* views the tag with arg's index */ extern void view(Arg *arg); /* views the tag with arg's index */

@ -123,12 +123,8 @@ buttonpress(XEvent *e) {
return; return;
} }
} }
if(ev->x < x + bmw) { if((ev->x < x + bmw) && (ev->button == Button1))
if(ev->button == Button1)
togglemode(NULL); togglemode(NULL);
else if(ev->button == Button3)
togglestackpos(NULL);
}
} }
else if((c = getclient(ev->window))) { else if((c = getclient(ev->window))) {
focus(c); focus(c);

@ -129,10 +129,7 @@ setup(void) {
dc.status[ColFG] = getcolor(STATUSFGCOLOR); dc.status[ColFG] = getcolor(STATUSFGCOLOR);
setfont(FONT); setfont(FONT);
bmw = textw(VSTACKSYMBOL) > textw(BSTACKSYMBOL) ? bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL);
textw(VSTACKSYMBOL) : textw(BSTACKSYMBOL);
bmw = bmw > textw(FLOATSYMBOL) ?
bmw : textw(FLOATSYMBOL);
sx = sy = 0; sx = sy = 0;
sw = DisplayWidth(dpy, screen); sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen); sh = DisplayHeight(dpy, screen);

@ -65,7 +65,6 @@ togglemax(Client *c)
/* extern */ /* extern */
void (*arrange)(Arg *) = DEFMODE; void (*arrange)(Arg *) = DEFMODE;
StackPos stackpos = STACKPOS;
void void
detach(Client *c) { detach(Client *c) {
@ -103,28 +102,19 @@ dofloat(Arg *arg) {
*/ */
void void
dotile(Arg *arg) { dotile(Arg *arg) {
unsigned int i, n, md, stackw, stackh, tw, th; unsigned int i, n, md, stackw, stackh, 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++;
if(stackpos == StackBottom) {
md = ((sh - bh) * master) / 1000;
stackw = sw;
stackh = sh - bh - md;
}
else {
md = (sw * master) / 1000; md = (sw * master) / 1000;
stackw = sw - md; stackw = sw - md;
stackh = sh - bh; stackh = sh - bh;
}
tw = stackw;
if(n > 1)
th = stackh / (n - 1);
else
th = stackh; 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)) {
@ -140,43 +130,19 @@ dotile(Arg *arg) {
c->h = sh - 2 * BORDERPX - bh; c->h = sh - 2 * BORDERPX - bh;
} }
else if(i == 0) { /* master window */ else if(i == 0) { /* master window */
if(stackpos == StackLeft)
c->x += stackw;
switch(stackpos) {
case StackLeft:
case StackRight:
c->w = md - 2 * BORDERPX; c->w = md - 2 * BORDERPX;
c->h = sh - bh - 2 * BORDERPX; c->h = sh - bh - 2 * BORDERPX;
break;
case StackBottom:
c->w = sw - 2 * BORDERPX;
c->h = md - 2 * BORDERPX;
break;
}
} }
else { /* tile window */ else { /* tile window */
if(stackpos == StackRight)
c->x += md; c->x += md;
if(th > bh) { if(th > bh) {
switch(stackpos) {
case StackLeft:
case StackRight:
c->y = sy + (i - 1) * th + bh; c->y = sy + (i - 1) * th + bh;
if(i + 1 == n) if(i + 1 == n)
c->h = sh - c->y - 2 * BORDERPX; c->h = sh - c->y - 2 * BORDERPX;
break; c->w = stackw - 2 * BORDERPX;
case StackBottom:
c->y = sy + md + (i - 1) * th + bh;
if(i + 1 == n)
c->h = sh - c->y - 2 * BORDERPX;
break;
}
c->w = tw - 2 * BORDERPX;
c->h = th - 2 * BORDERPX; c->h = th - 2 * BORDERPX;
} }
else { /* fallback if th < bh */ else { /* fallback if th < bh */
if(stackpos == StackBottom)
c->y += md;
c->w = stackw - 2 * BORDERPX; c->w = stackw - 2 * BORDERPX;
c->h = stackh - 2 * BORDERPX; c->h = stackh - 2 * BORDERPX;
} }
@ -311,17 +277,6 @@ toggleview(Arg *arg) {
arrange(NULL); arrange(NULL);
} }
void
togglestackpos(Arg *arg) {
if(arrange == dofloat)
return;
if(stackpos == StackBottom)
stackpos = STACKPOS;
else
stackpos = StackBottom;
arrange(NULL);
}
void void
view(Arg *arg) { view(Arg *arg) {
unsigned int i; unsigned int i;

Loading…
Cancel
Save