diff --git a/src/client.c b/src/client.c index 8575c2c..182172a 100644 --- a/src/client.c +++ b/src/client.c @@ -549,7 +549,7 @@ _client_tab(struct client *c, struct client *cm) /* Do not tab already tabbed client */ if(c->flags & (CLIENT_TABBED | CLIENT_TABMASTER) || c->tag != cm->tag || c == cm - || (c->flags & CLIENT_IGNORE_TAG) != (cm->flags & CLIENT_IGNORE_TAG)) + || !COMPCLIENT(c, cm)) return; layout_split_arrange_closed(c); diff --git a/src/client.h b/src/client.h index 394e0d6..eb10c95 100644 --- a/src/client.h +++ b/src/client.h @@ -18,6 +18,9 @@ SLIST_FOREACH(V, H, F) \ if(!(V->flags & CLIENT_FREE)) +/* Are two clients compatibles ? (to be tabbed together) */ +#define COMPCLIENT(C1, C2) ((C1->flags & CLIENT_IGNORE_TAG) == (C2->flags & CLIENT_IGNORE_TAG)) + void client_configure(struct client *c); struct client *client_gb_win(Window w); struct client *client_gb_frame(Window w); @@ -188,14 +191,14 @@ clients_tag_arrange_map(struct tag *t) } static inline struct client* -client_get_larger(struct tag *t) +client_get_larger(struct tag *t, bool ignoring_tag) { struct client *c, *lc = NULL; int tmp, l = 0; FOREACH_NFCLIENT(c, &t->clients, tnext) { - if((tmp = (c->geo.w + c->geo.h)) > l) + if((tmp = (c->geo.w + c->geo.h)) > l && (c->flags & CLIENT_IGNORE_TAG) == ignoring_tag) { l = tmp; lc = c; diff --git a/src/layout.c b/src/layout.c index ce998b1..b73cea6 100644 --- a/src/layout.c +++ b/src/layout.c @@ -395,8 +395,9 @@ layout_split_integrate(struct client *c, struct client *sc) if(!sc || sc == c || sc->tag != c->tag - || (sc->flags & CLIENT_FREE)) - sc = client_get_larger(c->tag); + || (sc->flags & CLIENT_FREE) + || !COMPCLIENT(c, sc)) + sc = client_get_larger(c->tag, c->flags & CLIENT_IGNORE_TAG); /* Largest not correct */ if(!sc || sc == c) @@ -419,13 +420,14 @@ layout_split_integrate(struct client *c, struct client *sc) } /* Tab Next Opened Client option */ - if(W->flags & WMFS_TABNOC) + if(W->flags & WMFS_TABNOC && COMPCLIENT(c, sc)) { W->flags ^= WMFS_TABNOC; _client_tab(c, sc); return; } + /* If there are clients but we can tab with them, split the screen. */ c->flags |= CLIENT_TILED; g = layout_split(sc, (sc->geo.h < sc->geo.w)); @@ -437,6 +439,7 @@ layout_split_integrate(struct client *c, struct client *sc) client_fac_hint(sc); layout_save_set(c->tag); + W->flags &= ~WMFS_TABNOC; } /* Arrange inter-clients holes: