Begin to work on tabbing (update commit)
This commit is contained in:
parent
770d0dce1f
commit
f3d80028a2
28
src/client.c
28
src/client.c
@ -319,6 +319,31 @@ client_grabbuttons(struct client *c, bool focused)
|
||||
ButtonMask, GrabModeAsync, GrabModeSync, None, None);
|
||||
}
|
||||
|
||||
static void
|
||||
client_tab_etablish(struct client *c)
|
||||
{
|
||||
struct chead cs;
|
||||
struct client *cc, *prev = c;
|
||||
|
||||
if(c->tabhead != NULL)
|
||||
while(!SLIST_EMPTY(c->tabhead))
|
||||
SLIST_REMOVE_HEAD(c->tabhead, tbnext);
|
||||
|
||||
SLIST_INIT(&cs);
|
||||
SLIST_INSERT_HEAD(&cs, c, tbnext);
|
||||
|
||||
SLIST_FOREACH(cc, &c->tag->clients, tnext)
|
||||
{
|
||||
if(GEOCMP(c->geo, cc->geo))
|
||||
{
|
||||
SLIST_INSERT_AFTER(prev, cc, tbnext);
|
||||
prev = cc;
|
||||
}
|
||||
}
|
||||
|
||||
c->tabhead = &cs;
|
||||
}
|
||||
|
||||
#define CCOL(c) (c == c->tag->sel ? &c->scol : &c->ncol)
|
||||
static void
|
||||
client_frame_update(struct client *c, struct colpair *cp)
|
||||
@ -779,6 +804,9 @@ client_moveresize(struct client *c, struct geo *g)
|
||||
|
||||
c->flags &= ~CLIENT_DID_WINSIZE;
|
||||
|
||||
if(/* TABBING OPTION */ 1)
|
||||
{ /* client_tab_etablish(c); */ }
|
||||
|
||||
client_frame_update(c, CCOL(c));
|
||||
client_update_props(c, CPROP_GEO);
|
||||
client_configure(c);
|
||||
|
||||
@ -83,7 +83,7 @@ config_bars(void)
|
||||
size_t i, n;
|
||||
struct conf_sec *sec, **ks;
|
||||
int screenid;
|
||||
char *elem;
|
||||
char *name, *elem;
|
||||
enum barpos pos = BarTop;
|
||||
|
||||
/* [bars] */
|
||||
@ -94,6 +94,7 @@ config_bars(void)
|
||||
/* [bar] */
|
||||
for(i = 0; i < n; ++i)
|
||||
{
|
||||
name = fetch_opt_first(ks[i], "infobar", "name").str;
|
||||
elem = fetch_opt_first(ks[i], "", "elements").str;
|
||||
screenid = fetch_opt_first(ks[i], "-1", "screen").num;
|
||||
t = name_to_theme(fetch_opt_first(ks[i], "default", "theme").str);
|
||||
@ -101,7 +102,7 @@ config_bars(void)
|
||||
|
||||
SLIST_FOREACH(s, &W->h.screen, next)
|
||||
if(screenid == s->id || screenid == -1)
|
||||
infobar_new(s, t, pos, elem);
|
||||
infobar_new(s, name, t, pos, elem);
|
||||
}
|
||||
|
||||
free(ks);
|
||||
|
||||
@ -168,7 +168,7 @@ infobar_elem_remove(struct element *e)
|
||||
}
|
||||
|
||||
struct infobar*
|
||||
infobar_new(struct screen *s, struct theme *theme, enum barpos pos, const char *elem)
|
||||
infobar_new(struct screen *s, char *name, struct theme *theme, enum barpos pos, const char *elem)
|
||||
{
|
||||
bool map;
|
||||
struct infobar *i = (struct infobar*)xcalloc(1, sizeof(struct infobar));
|
||||
@ -176,6 +176,7 @@ infobar_new(struct screen *s, struct theme *theme, enum barpos pos, const char *
|
||||
i->screen = s;
|
||||
i->theme = theme;
|
||||
i->elemorder = xstrdup(elem);
|
||||
i->name = xstrdup(name);
|
||||
|
||||
map = infobar_placement(i, pos);
|
||||
|
||||
@ -214,6 +215,7 @@ infobar_remove(struct infobar *i)
|
||||
struct element *e;
|
||||
|
||||
free(i->elemorder);
|
||||
free(i->name);
|
||||
|
||||
TAILQ_FOREACH(e, &i->elements, next)
|
||||
infobar_elem_remove(e);
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
enum { ElemTag = 0, ElemLayout, ElemSelbar, ElemStatus, ElemCustom, ElemLast };
|
||||
|
||||
struct infobar *infobar_new(struct screen *s, struct theme *theme, enum barpos pos, const char *elem);
|
||||
struct infobar *infobar_new(struct screen *s, char *name, struct theme *theme, enum barpos pos, const char *elem);
|
||||
void infobar_elem_update(struct infobar *i);
|
||||
void infobar_refresh(struct infobar *i);
|
||||
void infobar_remove(struct infobar *i);
|
||||
@ -69,4 +69,21 @@ infobar_elem_screen_update(struct screen *s, int addf)
|
||||
s->elemupdate &= ~FLAGINT(addf);
|
||||
}
|
||||
|
||||
static inline struct infobar*
|
||||
infobar_gb_name(const char *name)
|
||||
{
|
||||
struct screen *s;
|
||||
struct infobar *i;
|
||||
|
||||
SLIST_FOREACH(s, &W->h.screen, next)
|
||||
{
|
||||
SLIST_FOREACH(i, &s->infobars, next)
|
||||
if(!strcmp(i->name, name))
|
||||
return i;
|
||||
}
|
||||
|
||||
return SLIST_FIRST(&s->infobars);
|
||||
}
|
||||
|
||||
|
||||
#endif /* INFOBAR_H */
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#define ATOI(s) strtol(s, NULL, 10)
|
||||
#define ABS(j) (j < 0 ? -j : j)
|
||||
#define INAREA(i, j, a) ((i) >= (a).x && (i) <= (a).x + (a).w && (j) >= (a).y && (j) <= (a).y + (a).h)
|
||||
#define GEOCMP(g1, g2) ((g1).x == (g2).x && (g1).y == (g2).y && (g1).w == (g2).w && (g1).h == (g2).h)
|
||||
|
||||
/*
|
||||
* "#RRGGBB" -> 0xRRGGBB
|
||||
|
||||
14
src/wmfs.h
14
src/wmfs.h
@ -111,6 +111,7 @@ struct infobar
|
||||
struct theme *theme;
|
||||
enum barpos pos;
|
||||
char *elemorder;
|
||||
char *name;
|
||||
TAILQ_HEAD(esub, element) elements;
|
||||
SLIST_ENTRY(infobar) next;
|
||||
};
|
||||
@ -139,6 +140,7 @@ struct tag
|
||||
TAILQ_ENTRY(tag) next;
|
||||
};
|
||||
|
||||
SLIST_HEAD(chead, client);
|
||||
struct client
|
||||
{
|
||||
struct tag *tag;
|
||||
@ -147,6 +149,7 @@ struct client
|
||||
struct geo geo, wgeo, tgeo, ttgeo, rgeo;
|
||||
struct colpair ncol, scol;
|
||||
struct theme *theme;
|
||||
struct chead *tabhead;
|
||||
int sizeh[SHLAST];
|
||||
char *title;
|
||||
int border, tbarw;
|
||||
@ -158,8 +161,9 @@ struct client
|
||||
#define CLIENT_RULED 0x20
|
||||
Flags flags;
|
||||
Window win, frame;
|
||||
SLIST_ENTRY(client) next; /* Global list */
|
||||
SLIST_ENTRY(client) tnext; /* struct tag list */
|
||||
SLIST_ENTRY(client) next; /* Global list */
|
||||
SLIST_ENTRY(client) tnext; /* struct tag list */
|
||||
SLIST_ENTRY(client) tbnext; /* Tabbed client list */
|
||||
};
|
||||
|
||||
struct layout_set
|
||||
@ -217,9 +221,6 @@ struct theme
|
||||
SLIST_ENTRY(theme) next;
|
||||
};
|
||||
|
||||
#define RULE_FREE 0x01
|
||||
#define RULE_MAX 0x02
|
||||
#define RULE_IGNORE_TAG 0x04
|
||||
struct rule
|
||||
{
|
||||
struct theme *theme;
|
||||
@ -228,6 +229,9 @@ struct rule
|
||||
char *role;
|
||||
char *name;
|
||||
int tag, screen;
|
||||
#define RULE_FREE 0x01
|
||||
#define RULE_MAX 0x02
|
||||
#define RULE_IGNORE_TAG 0x04
|
||||
Flags flags;
|
||||
SLIST_ENTRY(rule) next;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user