diff --git a/src/layout.c b/src/layout.c index 46a5fb8..67634a5 100644 --- a/src/layout.c +++ b/src/layout.c @@ -321,9 +321,8 @@ split(int screen) CHECK((tags[screen][seltag[screen]].nclients = n)); - if(n == 1 && (c = tiled_client(screen, clients))) - client_maximize(c); - + if(n == 1) + client_maximize(tiled_client(screen, clients)); if(!ns) grid(screen, True); diff --git a/src/mouse.c b/src/mouse.c index b22c2af..73679ed 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -32,6 +32,8 @@ #include "wmfs.h" +Window prevwin; + /** Draw the border when a client in dragging/resizing with mouse */ static void @@ -100,14 +102,16 @@ mouse_move_tag_client(Client *c) XQueryPointer(dpy, infobar[selscreen].tags_board->win, &w, &w, &d, &d, &d, &d, (uint*)&d); + if(w == prevwin) + return; + + prevwin = w; + for(i = 1; i < conf.ntag[selscreen] + 1; ++i) if(infobar[selscreen].tags[i]->win == w && tags[selscreen][i].layout.func != freelayout) { - c->screen = selscreen; - c->tag = i; - tags[c->screen][c->tag].request_update = True; - arrange(s, True); + tag_transfert(c, i); if(s != c->screen) arrange(c->screen, True); diff --git a/src/split.c b/src/split.c index d77eb22..4ff03ff 100644 --- a/src/split.c +++ b/src/split.c @@ -219,7 +219,7 @@ split_client(Client *c, Bool p) void split_client_fill(Client *c, XRectangle geo) { - if(!c || tags[c->screen][c->tag].layout.func != split) + if(!c) return; c->flags &= ~(MaxFlag | LMaxFlag); @@ -238,18 +238,36 @@ split_client_fill(Client *c, XRectangle geo) void split_client_integrate(Client *c, Client *sc, int screen, int tag) { + Bool b = True; XRectangle g; - if(tags[screen][tag].layout.func != split - || c->flags & FreeFlag - || !tags[screen][tag].nclients || !c) + if(!c || c->flags & FreeFlag) return; if(!sc || sc->screen != screen || sc->tag != tag) - if(!(sc = tiled_client(screen, clients))) - return; + { + /* Looking for first client on wanted tag */ + for(b = False, sc = clients; sc; sc = sc->next) + if(sc->screen == screen && sc->tag == tag + && (c->flags & TileFlag)) + { + b = True; + break; + } + + /* No client on wanted tag to integrate */ + if(!b) + { + g.x = sgeo[c->screen].x; + g.y = sgeo[c->screen].y ; + g.width = sgeo[c->screen].width - BORDH * 2; + g.height = sgeo[c->screen].height - BORDH; + } + } + + if(b) + g = split_client(sc, (sc->frame_geo.height < sc->frame_geo.width)); - g = split_client(sc, (sc->frame_geo.height < sc->frame_geo.width)); split_client_fill(c, g); return; diff --git a/src/tag.c b/src/tag.c index df365be..fcc1558 100644 --- a/src/tag.c +++ b/src/tag.c @@ -144,13 +144,17 @@ tag_transfert(Client *c, int tag) return; if(c->flags & SplitFlag) + { split_arrange_closed(c); + split_client_integrate(c, NULL, selscreen, tag); + tags[c->screen][c->tag].cleanfact = True; + cfactor_clean(c); + } c->tag = tag; c->screen = selscreen; arrange(c->screen, True); - split_client_integrate(c, NULL, c->screen, c->tag); client_focus_next(c); @@ -509,10 +513,17 @@ tag_additional(int sc, int tag, int adtag) tags[sc][tag].cleanfact = True; tags[sc][adtag].cleanfact = True; - if(tags[sc][tag].tagad & TagFlag(adtag)) - for(c = clients; c; c = c->next) - if(c->screen == sc && c->tag == adtag) - split_client_integrate(c, client_get_next(), sc, tag); + for(c = clients; c; c = c->next) + if(c->screen == sc && c->tag == adtag) + { + if(tags[sc][tag].tagad & TagFlag(adtag)) + split_client_integrate(c, NULL, sc, tag); + else + { + split_client_integrate(c, NULL, sc, adtag); + split_arrange_closed(c); + } + } arrange(sc, True);