Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
calculating the remainder for master and stack area correctly
[dwm.git]
/
layout.c
diff --git
a/layout.c
b/layout.c
index
8005894
..
0865050
100644
(file)
--- a/
layout.c
+++ b/
layout.c
@@
-39,17
+39,20
@@
tile(void) {
if(i < nmaster) {
ny += i * mh;
nw = mw - 2 * c->border;
if(i < nmaster) {
ny += i * mh;
nw = mw - 2 * c->border;
- nh = mh - 2 * c->border;
+ nh = mh;
+ if(i + 1 == nmaster) /* remainder */
+ nh = wah - mh * i;
+ nh -= 2 * c->border;
}
else { /* tile window */
nx += mw;
nw = tw - 2 * c->border;
if(th > 2 * c->border) {
ny += (i - nmaster) * th;
}
else { /* tile window */
nx += mw;
nw = tw - 2 * c->border;
if(th > 2 * c->border) {
ny += (i - nmaster) * th;
- if(i == n - 1)
- nh = wah - ny - 2 * c->border;
- else
-
nh = th -
2 * c->border;
+ nh = th;
+ if(i + 1 == n) /* remainder */
+ nh = wah - th * (i - nmaster);
+
nh -=
2 * c->border;
}
else /* fallback if th <= 2 * c->border */
nh = wah - 2 * c->border;
}
else /* fallback if th <= 2 * c->border */
nh = wah - 2 * c->border;
@@
-61,10
+64,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
+89,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
+201,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
+217,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
+248,10
@@
togglemax(const char *arg) {
void
zoom(const char *arg) {
void
zoom(const char *arg) {
- unsigned int n;
Client *c;
Client *c;
- if(!sel || lt->arrange
!= tile
|| sel->isfloating)
+ if(!sel || lt->arrange
== floating
|| sel->isfloating)
return;
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;