Split/Tag: Adjust tag additional with split layout

This commit is contained in:
Martin Duquesnoy 2011-05-25 22:13:04 +02:00
parent c556b45a8d
commit 99018268ef
7 changed files with 55 additions and 33 deletions

View File

@ -223,6 +223,8 @@ cfactor_arrange_row(Client *c, Client *gc, Position p, int fac)
_cfactor_arrange_row(gc, RPOS(p), -fac);
}
split_store_geo(c->screen, c->tag);
return;
}

View File

@ -841,7 +841,7 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
c->ogeo.y = c->geo.y = my;
c->ogeo.width = c->geo.width = wa->width;
c->ogeo.height = c->geo.height = wa->height;
c->free_geo = c->pgeo = c->wrgeo = c->geo;
c->free_geo = c->pgeo = c->wrgeo = c->split_geo = c->geo;
c->tag = seltag[c->screen];
c->focusontag = -1;
cfactor_clean(c);

View File

@ -312,17 +312,17 @@ grid(int screen, Bool horizontal)
void
split(int screen)
{
Client *c;
Client *c, *tc;
unsigned int n, ns;
for(n = ns = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n)
for(n = ns = 0, (c = tc = 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)
client_maximize(tiled_client(screen, clients));
if(n == 1 && !(tc->flags & SplitFlag))
client_maximize(tc);
if(!ns)
grid(screen, True);
@ -330,8 +330,15 @@ split(int screen)
{
c->flags &= ~(MaxFlag | LMaxFlag);
c->flags |= (TileFlag | SplitFlag);
if(tags[screen][seltag[screen]].layout.splitusegeo)
client_moveresize(c, (c->pgeo = c->split_geo), tags[screen][seltag[screen]].resizehint);
}
if(tags[screen][seltag[screen]].layout.splitusegeo)
tags[screen][seltag[screen]].layout.splitusegeo = False;
ewmh_update_current_tag_prop();
return;

View File

@ -62,6 +62,25 @@ _split_check_row(XRectangle g1, XRectangle g2, Position p)
return (g1.x >= g2.x && (g1.x + g1.width) <= (g2.x + g2.width));
}
/** Store split geos of clients
*/
void
split_store_geo(int screen, int tag)
{
int e;
Client *c;
if(tags[screen][tag].layout.func != split)
return;
for(c = clients; c; c = c->next)
if(c->screen == screen && c->tag == tag
&& (c->flags & (SplitFlag | TileFlag)))
c->split_geo = c->wrgeo;
return;
}
/** Check if row direction is available to resize from it
*\param c Client pointer
*\param g Client pointer
@ -75,7 +94,7 @@ _split_check_row_dir(Client *c, Client *g, Position p)
XRectangle cgeo;
Client *cc;
cs = (LDIR(p) ? g->frame_geo.height : g->frame_geo.width);
cs = (LDIR(p) ? g->frame_geo.height : g->frame_geo.width);
for(s = 0, cgeo = c->frame_geo, cc = tiled_client(c->screen, clients);
cc; cc = tiled_client(c->screen, cc->next))
@ -162,6 +181,8 @@ split_arrange_closed(Client *ghost)
}
}
split_store_geo(screen, tag);
return;
}
@ -275,6 +296,8 @@ split_client_integrate(Client *c, Client *sc, int screen, int tag)
g = split_client(sc, (sc->frame_geo.height < sc->frame_geo.width));
split_client_fill(c, g);
split_store_geo(screen, tag);
return;
}

View File

@ -190,11 +190,11 @@ struct Client
/* Screen */
int screen;
/* Window attribute */
XRectangle geo, pgeo; /* Window geo, tiling pure geo */
XRectangle tmp_geo, wrgeo; /* Temporary geo, without resizehint geo */
XRectangle frame_geo; /* Frame geo */
XRectangle ogeo; /* Old window attribute */
XRectangle free_geo; /* Free window attribute */
XRectangle geo, pgeo; /* Window geo, tiling pure geo */
XRectangle tmp_geo, wrgeo; /* Temporary geo, without resizehint geo */
XRectangle frame_geo; /* Frame geo */
XRectangle ogeo; /* Old window attribute */
XRectangle split_geo, free_geo; /* Split & Free window attribute */
/* Tile size factors */
int tilefact[4];
/* For resizehint usage */
@ -258,6 +258,7 @@ typedef struct
/* Layout Structure */
typedef struct
{
Bool splitusegeo;
char *symbol;
char *type;
void (*func)(int screen);

View File

@ -479,7 +479,6 @@ void
uicb_tag_urgent(uicb_t cmd)
{
Client *c;
Bool b = False;
(void)cmd;
@ -487,17 +486,13 @@ uicb_tag_urgent(uicb_t cmd)
for(c = clients; c; c = c->next)
if(c->flags & UrgentFlag)
{
b = True;
screen_set_sel(c->screen);
tag_set(c->tag);
client_focus(c);
break;
}
if(!b)
return;
screen_set_sel(c->screen);
tag_set(c->tag);
client_focus(c);
return;
}
@ -509,28 +504,21 @@ uicb_tag_urgent(uicb_t cmd)
void
tag_additional(int sc, int tag, int adtag)
{
Client *c;
if(tag < 0 || tag > conf.ntag[sc]
|| adtag < 1 || adtag > conf.ntag[sc] || adtag == seltag[sc])
return;
/* TODO: Find a way to use split + additional properly */
if(tags[sc][tag].layout.func == split)
return;
tags[sc][tag].tagad ^= TagFlag(adtag);
tags[sc][adtag].request_update = True;
tags[sc][tag].cleanfact = True;
tags[sc][adtag].cleanfact = True;
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);
}
}
if(tags[sc][adtag].layout.func == split)
tags[sc][adtag].layout.splitusegeo = True;
arrange(sc, True);

View File

@ -388,6 +388,7 @@ void init(void);
void getinfo(char *info);
/* split.c */
void split_store_geo(int screen, int tag);
void split_arrange_closed(Client *ghost);
XRectangle split_client(Client *c, Bool p);
void split_client_fill(Client *c, XRectangle geo);