Layout: Use grid layout for split if first arrange is needed with many client

This commit is contained in:
Martin Duquesnoy 2011-05-21 17:33:31 +02:00
parent a44505c1a9
commit 24de771713
2 changed files with 33 additions and 27 deletions

View File

@ -153,7 +153,7 @@ client_get_next_with_direction(Client *bc, Position pos)
/* Start place of pointer for faster scanning */
x = bc->frame_geo.x + ((pos == Right) ? bc->frame_geo.width : 0);
y = bc->frame_geo.y + ((pos == Bottom) ? bc->frame_geo.height : 0);
y += ((pos < Top) ? bc->frame_geo.height / 2 : 0);
y += ((LDIR(pos)) ? bc->frame_geo.height / 2 : 0);
x += ((pos > Left) ? bc->frame_geo.width / 2 : 0);
/* Scan in right direction to next(p) physical client */

View File

@ -238,32 +238,6 @@ uicb_set_nmaster(uicb_t cmd)
return;
}
/** Split layout function
* This function is a trick compared to dynamic layout function, see split.c
*/
void
split(int screen)
{
Client *c;
unsigned int n;
for(n = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n);
CHECK((tags[screen][seltag[screen]].nclients = n));
if(n == 1 && (c = tiled_client(screen, clients)))
client_maximize(c);
for(c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next))
{
c->flags &= ~(MaxFlag | LMaxFlag);
c->flags |= (TileFlag | SplitFlag);
}
ewmh_update_current_tag_prop();
return;
}
/** Grid layout function
*/
static void
@ -332,6 +306,38 @@ grid(int screen, Bool horizontal)
return;
}
/** Split layout function
* This function is a trick compared to dynamic layout function, see split.c
*/
void
split(int screen)
{
Client *c;
unsigned int n, ns;
for(n = ns = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n)
if(c->flags & SplitFlag)
++ns;
CHECK((tags[screen][seltag[screen]].nclients = n));
if(n == 1 && (c = tiled_client(screen, clients)))
client_maximize(c);
if(!ns)
grid(screen, True);
for(c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next))
{
c->flags &= ~(MaxFlag | LMaxFlag);
c->flags |= (TileFlag | SplitFlag);
}
ewmh_update_current_tag_prop();
return;
}
/** Multi tile function
* \param type Postion type { Top, Bottom, Left, Right }
*/