reorganized

This commit is contained in:
Anselm R. Garbe 2007-01-08 17:36:56 +01:00
parent 1d4a24dae0
commit 5a5851bac2
3 changed files with 10 additions and 6 deletions

1
dwm.h
View File

@ -168,5 +168,6 @@ extern void restack(void); /* restores z layers of all clients */
extern void togglefloat(Arg *arg); /* toggles focusesd client between floating/non-floating state */ extern void togglefloat(Arg *arg); /* toggles focusesd client between floating/non-floating state */
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 updatemodetext(void); /* updates mtext */
extern void view(Arg *arg); /* views the tag with arg's index */ extern void view(Arg *arg); /* views the tag with arg's index */
extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */ extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */

3
main.c
View File

@ -133,8 +133,7 @@ setup(void) {
sh = DisplayHeight(dpy, screen); sh = DisplayHeight(dpy, screen);
master = MASTER; master = MASTER;
nmaster = NMASTER; nmaster = NMASTER;
snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); updatemodetext();
bmw = textw(mtext);
/* bar */ /* bar */
bx = sx; bx = sx;
by = sy; by = sy;

12
view.c
View File

@ -153,8 +153,7 @@ incnmaster(Arg *arg) {
if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh)) if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
return; return;
nmaster += arg->i; nmaster += arg->i;
snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); updatemodetext();
bmw = textw(mtext);
if(sel) if(sel)
arrange(); arrange();
else else
@ -224,8 +223,7 @@ togglefloat(Arg *arg) {
void void
togglemode(Arg *arg) { togglemode(Arg *arg) {
arrange = (arrange == dofloat) ? dotile : dofloat; arrange = (arrange == dofloat) ? dotile : dofloat;
snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster); updatemodetext();
bmw = textw(mtext);
if(sel) if(sel)
arrange(); arrange();
else else
@ -243,6 +241,12 @@ toggleview(Arg *arg) {
arrange(); arrange();
} }
void
updatemodetext() {
snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster);
bmw = textw(mtext);
}
void void
view(Arg *arg) { view(Arg *arg) {
unsigned int i; unsigned int i;