Xinqi Bao's Git
projects
/
dwm.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
2d4faae
)
simplified tile()
author
Anselm R Garbe <
[email protected]
>
Mon, 26 May 2008 09:10:33 +0000
(10:10 +0100)
committer
Anselm R Garbe <
[email protected]
>
Mon, 26 May 2008 09:10:33 +0000
(10:10 +0100)
dwm.c
diff
|
blob
|
history
diff --git
a/dwm.c
b/dwm.c
index
0e4703e
..
2fe70e4
100644
(file)
--- a/
dwm.c
+++ b/
dwm.c
@@
-170,7
+170,6
@@
void spawn(const void *arg);
void tag(const void *arg);
uint textnw(const char *text, uint len);
void tile(void);
void tag(const void *arg);
uint textnw(const char *text, uint len);
void tile(void);
-void tileresize(Client *c, int x, int y, int w, int h);
void togglebar(const void *arg);
void togglefloating(const void *arg);
void togglelayout(const void *arg);
void togglebar(const void *arg);
void togglefloating(const void *arg);
void togglelayout(const void *arg);
@@
-1123,6
+1122,10
@@
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
x = sx;
if(y + h + 2 * c->bw < sy)
y = sy;
x = sx;
if(y + h + 2 * c->bw < sy)
y = sy;
+ if(h < bh)
+ h = bh;
+ if(w < bh)
+ w = bh;
if(c->x != x || c->y != y || c->w != w || c->h != h || c->isbanned || c->ismax) {
c->isbanned = c->ismax = False;
c->x = wc.x = x;
if(c->x != x || c->y != y || c->w != w || c->h != h || c->isbanned || c->ismax) {
c->isbanned = c->ismax = False;
c->x = wc.x = x;
@@
-1435,7
+1438,7
@@
textnw(const char *text, uint len) {
void
tile(void) {
void
tile(void) {
- int x, y, h, w, m
x, my, mw, mh, tx, ty, tw, th
;
+ int x, y, h, w, m
w
;
uint i, n;
Client *c;
uint i, n;
Client *c;
@@
-1443,55
+1446,30
@@
tile(void) {
if(n == 0)
return;
if(n == 0)
return;
- /* master area geometry */
- mx = wx;
- my = wy;
- mw = mfact * ww;
- mh = wh;
-
- /* tile area geometry */
- tx = mx + mw;
- ty = wy;
- tw = ww - mw;
- th = wh;
-
/* master */
c = nexttiled(clients);
/* master */
c = nexttiled(clients);
-
- if(n == 1)
- tileresize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw);
- else
- tileresize(c, mx, my, mw - 2 * c->bw, mh - 2 * c->bw);
+ mw = mfact * ww;
+ resize(c, wx, wy, ((n == 1) ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints);
if(--n == 0)
return;
/* tile stack */
if(--n == 0)
return;
/* tile stack */
- x = (
tx > c->x + c->w) ? c->x + c->w + 2 * c->bw : t
w;
- y =
t
y;
- w = (
tx > c->x + c->w) ? wx + ww - x : t
w;
- h =
t
h / n;
+ x = (
wx + mw > c->x + c->w) ? c->x + c->w + 2 * c->bw : ww - m
w;
+ y =
w
y;
+ w = (
wx + mw > c->x + c->w) ? wx + ww - x : ww - m
w;
+ h =
w
h / n;
if(h < bh)
if(h < bh)
- h =
t
h;
+ h =
w
h;
for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
- if(i + 1 == n) /* remainder */
- tileresize(c, x, y, w - 2 * c->bw, (ty + th) - y - 2 * c->bw);
- else
- tileresize(c, x, y, w - 2 * c->bw, h - 2 * c->bw);
- if(h != th)
+ resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n)
+ ? (wy + wh) - y : h) - 2 * c->bw, resizehints);
+ if(h != wh)
y = c->y + c->h + 2 * c->bw;
}
}
y = c->y + c->h + 2 * c->bw;
}
}
-void
-tileresize(Client *c, int x, int y, int w, int h) {
- resize(c, x, y, w, h, resizehints);
- if(resizehints && ((c->h < bh) || (c->h > h) || (c->w < bh) || (c->w > w)))
- /* client doesn't accept size constraints */
- resize(c, x, y, w, h, False);
-}
-
void
togglebar(const void *arg) {
showbar = !showbar;
void
togglebar(const void *arg) {
showbar = !showbar;