Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
applied Szabolcs proposal to simplify setlayout()
[dwm.git]
/
layout.c
diff --git
a/layout.c
b/layout.c
index
259f489
..
47e9e49
100644
(file)
--- a/
layout.c
+++ b/
layout.c
@@
-61,10
+61,8
@@
tile(void) {
c->isbanned = True;
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
c->isbanned = True;
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
- if(!sel || !isvisible(sel)) {
- for(c = stack; c && !isvisible(c); c = c->snext);
- focus(c);
- }
+ if(!sel || !isvisible(sel))
+ focustopvisible();
restack();
}
restack();
}
@@
-88,10
+86,8
@@
floating(void) {
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
}
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
}
- if(!sel || !isvisible(sel)) {
- for(c = stack; c && !isvisible(c); c = c->snext);
- focus(c);
- }
+ if(!sel || !isvisible(sel))
+ focustopvisible();
restack();
}
restack();
}
@@
-202,11
+198,9
@@
setlayout(const char *arg) {
int i;
if(!arg) {
int i;
if(!arg) {
- for(i = 0; i < nlayouts && lt != &layout[i]; i++);
- if(i == nlayouts - 1)
- lt = &layout[0];
- else
- lt = &layout[++i];
+ lt++;
+ if(lt == layout + nlayouts)
+ lt = layout;
}
else {
i = atoi(arg);
}
else {
i = atoi(arg);
@@
-220,6
+214,16
@@
setlayout(const char *arg) {
drawstatus();
}
drawstatus();
}
+void
+togglebar(const char *arg) {
+ if(bpos == BarOff)
+ bpos = (BARPOS == BarOff) ? BarTop : BARPOS;
+ else
+ bpos = BarOff;
+ updatebarpos();
+ lt->arrange();
+}
+
void
togglemax(const char *arg) {
XEvent ev;
void
togglemax(const char *arg) {
XEvent ev;
@@
-241,13
+245,10
@@
togglemax(const char *arg) {
void
zoom(const char *arg) {
void
zoom(const char *arg) {
- unsigned int n;
Client *c;
if(!sel || lt->arrange != tile || sel->isfloating)
return;
Client *c;
if(!sel || lt->arrange != tile || sel->isfloating)
return;
- for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
- n++;
if((c = sel) == nexttiled(clients))
if(!(c = nexttiled(c->next)))
return;
if((c = sel) == nexttiled(clients))
if(!(c = nexttiled(c->next)))
return;