fix client integration on the screen

This commit is contained in:
Jérémy Anger 2012-04-13 23:18:36 +02:00
parent c692505b44
commit e65c6a706a
3 changed files with 12 additions and 6 deletions

View File

@ -549,7 +549,7 @@ _client_tab(struct client *c, struct client *cm)
/* Do not tab already tabbed client */ /* Do not tab already tabbed client */
if(c->flags & (CLIENT_TABBED | CLIENT_TABMASTER) if(c->flags & (CLIENT_TABBED | CLIENT_TABMASTER)
|| c->tag != cm->tag || c == cm || c->tag != cm->tag || c == cm
|| (c->flags & CLIENT_IGNORE_TAG) != (cm->flags & CLIENT_IGNORE_TAG)) || !COMPCLIENT(c, cm))
return; return;
layout_split_arrange_closed(c); layout_split_arrange_closed(c);

View File

@ -18,6 +18,9 @@
SLIST_FOREACH(V, H, F) \ SLIST_FOREACH(V, H, F) \
if(!(V->flags & CLIENT_FREE)) 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); void client_configure(struct client *c);
struct client *client_gb_win(Window w); struct client *client_gb_win(Window w);
struct client *client_gb_frame(Window w); struct client *client_gb_frame(Window w);
@ -188,14 +191,14 @@ clients_tag_arrange_map(struct tag *t)
} }
static inline struct client* static inline struct client*
client_get_larger(struct tag *t) client_get_larger(struct tag *t, bool ignoring_tag)
{ {
struct client *c, *lc = NULL; struct client *c, *lc = NULL;
int tmp, l = 0; int tmp, l = 0;
FOREACH_NFCLIENT(c, &t->clients, tnext) 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; l = tmp;
lc = c; lc = c;

View File

@ -395,8 +395,9 @@ layout_split_integrate(struct client *c, struct client *sc)
if(!sc if(!sc
|| sc == c || sc == c
|| sc->tag != c->tag || sc->tag != c->tag
|| (sc->flags & CLIENT_FREE)) || (sc->flags & CLIENT_FREE)
sc = client_get_larger(c->tag); || !COMPCLIENT(c, sc))
sc = client_get_larger(c->tag, c->flags & CLIENT_IGNORE_TAG);
/* Largest not correct */ /* Largest not correct */
if(!sc || sc == c) if(!sc || sc == c)
@ -419,13 +420,14 @@ layout_split_integrate(struct client *c, struct client *sc)
} }
/* Tab Next Opened Client option */ /* Tab Next Opened Client option */
if(W->flags & WMFS_TABNOC) if(W->flags & WMFS_TABNOC && COMPCLIENT(c, sc))
{ {
W->flags ^= WMFS_TABNOC; W->flags ^= WMFS_TABNOC;
_client_tab(c, sc); _client_tab(c, sc);
return; return;
} }
/* If there are clients but we can tab with them, split the screen. */
c->flags |= CLIENT_TILED; c->flags |= CLIENT_TILED;
g = layout_split(sc, (sc->geo.h < sc->geo.w)); 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); client_fac_hint(sc);
layout_save_set(c->tag); layout_save_set(c->tag);
W->flags &= ~WMFS_TABNOC;
} }
/* Arrange inter-clients holes: /* Arrange inter-clients holes: