mirror of git://git.suckless.org/dwm
removed tileh, renamed tilev into tile again, removed counttiles, tilemaster
This commit is contained in:
parent
a785a0d712
commit
42c4b31003
|
@ -25,7 +25,7 @@ Rule rules[] = {
|
||||||
|
|
||||||
Layout layouts[] = {
|
Layout layouts[] = {
|
||||||
/* symbol function */
|
/* symbol function */
|
||||||
{ "[]=", tilev }, /* first entry is default */
|
{ "[]=", tile }, /* first entry is default */
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
{ "<M>", monocle }, /* TODO: remove this */
|
{ "<M>", monocle }, /* TODO: remove this */
|
||||||
};
|
};
|
||||||
|
|
70
dwm.c
70
dwm.c
|
@ -119,7 +119,6 @@ void cleanup(void);
|
||||||
void configure(Client *c);
|
void configure(Client *c);
|
||||||
void configurenotify(XEvent *e);
|
void configurenotify(XEvent *e);
|
||||||
void configurerequest(XEvent *e);
|
void configurerequest(XEvent *e);
|
||||||
unsigned int counttiled(void);
|
|
||||||
void destroynotify(XEvent *e);
|
void destroynotify(XEvent *e);
|
||||||
void detach(Client *c);
|
void detach(Client *c);
|
||||||
void detachstack(Client *c);
|
void detachstack(Client *c);
|
||||||
|
@ -168,12 +167,8 @@ void spawn(const char *arg);
|
||||||
void tag(const char *arg);
|
void tag(const char *arg);
|
||||||
unsigned int textnw(const char *text, unsigned int len);
|
unsigned int textnw(const char *text, unsigned int len);
|
||||||
unsigned int textw(const char *text);
|
unsigned int textw(const char *text);
|
||||||
void tileh(void);
|
|
||||||
void tilehstack(unsigned int n);
|
|
||||||
Client *tilemaster(unsigned int n);
|
|
||||||
void tileresize(Client *c, int x, int y, int w, int h);
|
void tileresize(Client *c, int x, int y, int w, int h);
|
||||||
void tilev(void);
|
void tile(void);
|
||||||
void tilevstack(unsigned int n);
|
|
||||||
void togglefloating(const char *arg);
|
void togglefloating(const char *arg);
|
||||||
void togglelayout(const char *arg);
|
void togglelayout(const char *arg);
|
||||||
void toggletag(const char *arg);
|
void toggletag(const char *arg);
|
||||||
|
@ -468,15 +463,6 @@ configurerequest(XEvent *e) {
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
|
||||||
counttiled(void) {
|
|
||||||
unsigned int n;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++);
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
destroynotify(XEvent *e) {
|
destroynotify(XEvent *e) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
@ -1507,44 +1493,6 @@ textw(const char *text) {
|
||||||
return textnw(text, strlen(text)) + dc.font.height;
|
return textnw(text, strlen(text)) + dc.font.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
tileh(void) {
|
|
||||||
int x, w;
|
|
||||||
unsigned int i, n = counttiled();
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
if(n == 0)
|
|
||||||
return;
|
|
||||||
c = tilemaster(n);
|
|
||||||
if(--n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
x = tx;
|
|
||||||
w = tw / n;
|
|
||||||
if(w < bh)
|
|
||||||
w = tw;
|
|
||||||
|
|
||||||
for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
|
|
||||||
if(i + 1 == n) /* remainder */
|
|
||||||
tileresize(c, x, ty, (tx + tw) - x - 2 * c->bw, th - 2 * c->bw);
|
|
||||||
else
|
|
||||||
tileresize(c, x, ty, w - 2 * c->bw, th - 2 * c->bw);
|
|
||||||
if(w != tw)
|
|
||||||
x = c->x + c->w + 2 * c->bw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Client *
|
|
||||||
tilemaster(unsigned int n) {
|
|
||||||
Client *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);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
tileresize(Client *c, int x, int y, int w, int h) {
|
tileresize(Client *c, int x, int y, int w, int h) {
|
||||||
resize(c, x, y, w, h, RESIZEHINTS);
|
resize(c, x, y, w, h, RESIZEHINTS);
|
||||||
|
@ -1554,17 +1502,27 @@ tileresize(Client *c, int x, int y, int w, int h) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tilev(void) {
|
tile(void) {
|
||||||
int y, h;
|
int y, h;
|
||||||
unsigned int i, n = counttiled();
|
unsigned int i, n;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
|
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++);
|
||||||
if(n == 0)
|
if(n == 0)
|
||||||
return;
|
return;
|
||||||
c = tilemaster(n);
|
|
||||||
|
/* 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);
|
||||||
|
|
||||||
if(--n == 0)
|
if(--n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* tile stack */
|
||||||
y = ty;
|
y = ty;
|
||||||
h = th / n;
|
h = th / n;
|
||||||
if(h < bh)
|
if(h < bh)
|
||||||
|
|
Loading…
Reference in New Issue