Layout/Client: Fix arrange with split & transfert

This commit is contained in:
Martin Duquesnoy
2011-05-23 12:19:16 +02:00
parent 6a93c6fa35
commit f75c75645d
3 changed files with 23 additions and 16 deletions

View File

@@ -147,7 +147,7 @@ client_get_next_with_direction(Client *bc, Position pos)
{ 0, -1 }, { 0, 1 } /* Top, Bottom */ { 0, -1 }, { 0, 1 } /* Top, Bottom */
}; };
if(!bc || ishide(bc, selscreen)) if(!bc)
return NULL; return NULL;
/* Start place of pointer for faster scanning */ /* Start place of pointer for faster scanning */
@@ -519,12 +519,13 @@ client_urgent(Client *c, Bool u)
{ {
Client *cc; Client *cc;
if(x < 0 || x > spgeo[selscreen].x + spgeo[selscreen].width if(x < 0 || x > spgeo[c->screen].x + spgeo[c->screen].width
|| y < 0 || y > spgeo[selscreen].y + spgeo[selscreen].height) || y < 0 || y > spgeo[c->screen].y + spgeo[c->screen].height)
return NULL; return NULL;
for(cc = clients; cc; cc = cc->next) for(cc = clients; cc; cc = cc->next)
if(!ishide(cc, selscreen) && (cc->flags & TileFlag) && cc != c) if(cc != c && cc->screen == c->screen && cc->tag == c->tag
&& (cc->flags & TileFlag))
if(cc->frame_geo.x < x && cc->frame_geo.x + cc->frame_geo.width > x if(cc->frame_geo.x < x && cc->frame_geo.x + cc->frame_geo.width > x
&& cc->frame_geo.y < y && cc->frame_geo.y + cc->frame_geo.height > y) && cc->frame_geo.y < y && cc->frame_geo.y + cc->frame_geo.height > y)
return cc; return cc;
@@ -1038,6 +1039,7 @@ client_maximize(Client *c)
if(!c || c->flags & FSSFlag) if(!c || c->flags & FSSFlag)
return; return;
cfactor_clean(c);
c->screen = screen_get_with_geo(c->geo.x, c->geo.y); c->screen = screen_get_with_geo(c->geo.x, c->geo.y);
c->geo.x = sgeo[c->screen].x; c->geo.x = sgeo[c->screen].x;
@@ -1045,7 +1047,7 @@ client_maximize(Client *c)
c->geo.width = sgeo[c->screen].width - BORDH * 2; c->geo.width = sgeo[c->screen].width - BORDH * 2;
c->geo.height = sgeo[c->screen].height - BORDH; c->geo.height = sgeo[c->screen].height - BORDH;
client_moveresize(c, c->geo, tags[c->screen][c->tag].resizehint); client_moveresize(c, (c->pgeo = c->geo), tags[c->screen][c->tag].resizehint);
return; return;
} }

View File

@@ -104,8 +104,9 @@ split_arrange_closed(Client *ghost)
XRectangle cgeo; XRectangle cgeo;
Client *c, *cc; Client *c, *cc;
int screen = ghost->screen; int screen = ghost->screen;
int tag = (ghost->tag ? ghost->tag : seltag[screen]);
if(tags[screen][seltag[screen]].layout.func != split) if(tags[screen][tag].layout.func != split)
return; return;
/* Use ghost client properties to fix holes in tile /* Use ghost client properties to fix holes in tile
@@ -133,7 +134,7 @@ split_arrange_closed(Client *ghost)
{ {
_split_arrange_size(ghost->wrgeo, &c->wrgeo, p); _split_arrange_size(ghost->wrgeo, &c->wrgeo, p);
cfactor_clean(c); cfactor_clean(c);
client_moveresize(c, (c->pgeo = c->wrgeo), tags[screen][c->tag].resizehint); client_moveresize(c, (c->pgeo = c->wrgeo), tags[screen][tag].resizehint);
return; return;
} }
@@ -249,7 +250,7 @@ split_client_integrate(Client *c, Client *sc, int screen, int tag)
/* Looking for first client on wanted tag */ /* Looking for first client on wanted tag */
for(b = False, sc = clients; sc; sc = sc->next) for(b = False, sc = clients; sc; sc = sc->next)
if(sc->screen == screen && sc->tag == tag if(sc->screen == screen && sc->tag == tag
&& (c->flags & TileFlag)) && (c->flags & (TileFlag | SplitFlag)))
{ {
b = True; b = True;
break; break;
@@ -258,16 +259,12 @@ split_client_integrate(Client *c, Client *sc, int screen, int tag)
/* No client on wanted tag to integrate */ /* No client on wanted tag to integrate */
if(!b) if(!b)
{ {
g.x = sgeo[c->screen].x; client_maximize(c);
g.y = sgeo[c->screen].y ; return;
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); split_client_fill(c, g);
return; return;

View File

@@ -133,6 +133,8 @@ tag_set(int tag)
void void
tag_transfert(Client *c, int tag) tag_transfert(Client *c, int tag)
{ {
int s;
screen_get_sel(); screen_get_sel();
CHECK(c); CHECK(c);
@@ -140,9 +142,12 @@ tag_transfert(Client *c, int tag)
if(tag <= 0) if(tag <= 0)
tag = 1; tag = 1;
if(tag > conf.ntag[selscreen]) if(tag > conf.ntag[selscreen]
|| (c->screen == selscreen && c->tag == tag))
return; return;
s = c->screen;
if(c->flags & SplitFlag) if(c->flags & SplitFlag)
{ {
split_arrange_closed(c); split_arrange_closed(c);
@@ -156,6 +161,9 @@ tag_transfert(Client *c, int tag)
arrange(c->screen, True); arrange(c->screen, True);
if(s != c->screen)
arrange(s, True);
client_focus_next(c); client_focus_next(c);
client_update_attributes(c); client_update_attributes(c);