diff --git a/src/client.h b/src/client.h index 8502ec9..4645849 100644 --- a/src/client.h +++ b/src/client.h @@ -186,5 +186,25 @@ clients_tag_arrange_map(struct tag *t) sfunc(c); } +static inline struct client* +client_get_larger(struct tag *t) +{ + struct client *c, *lc = NULL; + int tmp, l = 0; + + FOREACH_NFCLIENT(c, &t->clients, tnext) + { + if((tmp = (c->geo.w + c->geo.h)) > l) + { + l = tmp; + lc = c; + } + } + + if(lc && (lc->flags & CLIENT_TABBED)) + lc = lc->tabmaster; + + return lc; +} #endif /* CLIENT_H */ diff --git a/src/ewmh.c b/src/ewmh.c index d1664de..e0deda8 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -220,7 +220,10 @@ ewmh_manage_state(long data[], struct client *c) (unsigned char*)0, 0); XReparentWindow(W->dpy, c->win, c->frame, c->wgeo.x, c->wgeo.y); - layout_fix_hole(c); + if(c->flags & CLIENT_FREE) + client_moveresize(c, &c->geo); + else + layout_fix_hole(c); } } } diff --git a/src/layout.c b/src/layout.c index 4edd890..a540738 100644 --- a/src/layout.c +++ b/src/layout.c @@ -370,10 +370,15 @@ layout_split_integrate(struct client *c, struct client *sc) struct geo g; bool f = false; - /* No sc or not compatible sc */ - if(!sc || sc == c || sc->tag != c->tag - || sc->flags & CLIENT_FREE) + /* No sc or not compatible sc to integrate in */ + if(!sc + || sc == c + || sc->tag != c->tag + || (sc->flags & CLIENT_FREE)) { + /* Larger tiled one? + if(!(sc = client_get_larger(c->tag)) || sc == c)*/ + /* * check for the first tiled client or * maximize the lonely client