Begin preset
This commit is contained in:
parent
e165f0fe2b
commit
3b4dc47ae0
@ -35,6 +35,7 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
|
||||
{ "layout_hmirror", uicb_layout_hmirror },
|
||||
{ "layout_rotate_left", uicb_layout_rotate_left },
|
||||
{ "layout_rotate_right", uicb_layout_rotate_right },
|
||||
{ "layout_prev_set", uicb_layout_prev_set },
|
||||
|
||||
/* Client */
|
||||
{ "client_close", uicb_client_close },
|
||||
|
||||
31
src/layout.c
31
src/layout.c
@ -29,7 +29,7 @@ layout_save_set(struct tag *t)
|
||||
|
||||
l->n = n;
|
||||
|
||||
SLIST_INSERT_HEAD(&t->sets, l, next);
|
||||
TAILQ_INSERT_TAIL(&t->sets, l, next);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -39,14 +39,14 @@ layout_apply_set(struct tag *t, struct layout_set *l)
|
||||
struct client *c, cc;
|
||||
|
||||
for(g = SLIST_FIRST(&l->geos), c = SLIST_FIRST(&t->clients);
|
||||
c;
|
||||
c = SLIST_NEXT(c, tnext), g = SLIST_NEXT(g, next))
|
||||
c; c = SLIST_NEXT(c, tnext))
|
||||
{
|
||||
if(g)
|
||||
{
|
||||
if(!client_winsize(c, &g->geo, &c->wgeo))
|
||||
client_moveresize(c, &g->geo);
|
||||
|
||||
g = SLIST_NEXT(g, next);
|
||||
}
|
||||
/*
|
||||
* Not enough geos in the set;
|
||||
@ -61,18 +61,14 @@ layout_apply_set(struct tag *t, struct layout_set *l)
|
||||
* arrange clients with not set geo.
|
||||
*/
|
||||
if(g)
|
||||
{
|
||||
cc.tag = t;
|
||||
while(g)
|
||||
for(cc.tag = t; g; g = SLIST_NEXT(g, next))
|
||||
{
|
||||
cc.geo = g->geo;
|
||||
layout_split_arrange_closed(&cc);
|
||||
g = SLIST_NEXT(g, next);
|
||||
}
|
||||
}
|
||||
|
||||
/* Re-insert set in historic */
|
||||
SLIST_INSERT_HEAD(&t->sets, l, next);
|
||||
TAILQ_INSERT_TAIL(&t->sets, l, next);
|
||||
}
|
||||
|
||||
|
||||
@ -81,10 +77,9 @@ layout_free_set(struct tag *t)
|
||||
{
|
||||
struct layout_set *l;
|
||||
|
||||
while(!SLIST_EMPTY(&t->sets))
|
||||
TAILQ_FOREACH(l, &t->sets, next)
|
||||
{
|
||||
l = SLIST_FIRST(&t->sets);
|
||||
SLIST_REMOVE_HEAD(&t->sets, next);
|
||||
TAILQ_REMOVE(&t->sets, l, next);
|
||||
|
||||
/* Set can be several times in list */
|
||||
if(l)
|
||||
@ -95,6 +90,18 @@ layout_free_set(struct tag *t)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_layout_prev_set(Uicb cmd)
|
||||
{
|
||||
struct layout_set *l;
|
||||
struct tag *t = W->screen->seltag;
|
||||
(void)cmd;
|
||||
|
||||
if(!TAILQ_EMPTY(&t->sets)
|
||||
&& (l = TAILQ_PREV(TAILQ_LAST(&t->sets, ssub), ssub, next)))
|
||||
layout_apply_set(t, l);
|
||||
}
|
||||
|
||||
static struct geo
|
||||
layout_split(struct client *c, bool vertical)
|
||||
{
|
||||
|
||||
@ -37,6 +37,8 @@ void uicb_layout_vmirror(Uicb cmd);
|
||||
void uicb_layout_hmirror(Uicb cmd);
|
||||
void uicb_layout_rotate_left(Uicb cmd);
|
||||
void uicb_layout_rotate_right(Uicb cmd);
|
||||
void uicb_layout_prev_set(Uicb cmd);
|
||||
|
||||
|
||||
#endif /* LAYOUT_H */
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ tag_new(struct screen *s, char *name)
|
||||
&at);
|
||||
|
||||
SLIST_INIT(&t->clients);
|
||||
SLIST_INIT(&t->sets);
|
||||
TAILQ_INIT(&t->sets);
|
||||
|
||||
TAILQ_INSERT_TAIL(&s->tags, t, next);
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ struct tag
|
||||
Flags flags;
|
||||
Window frame;
|
||||
SLIST_HEAD(, client) clients;
|
||||
SLIST_HEAD(, layout_set) sets;
|
||||
TAILQ_HEAD(ssub, layout_set) sets;
|
||||
TAILQ_ENTRY(tag) next;
|
||||
};
|
||||
|
||||
@ -155,7 +155,7 @@ struct layout_set
|
||||
{
|
||||
int n;
|
||||
SLIST_HEAD(, geo_list) geos;
|
||||
SLIST_ENTRY(layout_set) next;
|
||||
TAILQ_ENTRY(layout_set) next;
|
||||
};
|
||||
|
||||
struct keybind
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user