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); _cfactor_arrange_row(gc, RPOS(p), -fac);
} }
split_store_geo(c->screen, c->tag);
return; return;
} }

View File

@@ -841,7 +841,7 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
c->ogeo.y = c->geo.y = my; c->ogeo.y = c->geo.y = my;
c->ogeo.width = c->geo.width = wa->width; c->ogeo.width = c->geo.width = wa->width;
c->ogeo.height = c->geo.height = wa->height; 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->tag = seltag[c->screen];
c->focusontag = -1; c->focusontag = -1;
cfactor_clean(c); cfactor_clean(c);

View File

@@ -312,17 +312,17 @@ grid(int screen, Bool horizontal)
void void
split(int screen) split(int screen)
{ {
Client *c; Client *c, *tc;
unsigned int n, ns; 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) if(c->flags & SplitFlag)
++ns; ++ns;
CHECK((tags[screen][seltag[screen]].nclients = n)); CHECK((tags[screen][seltag[screen]].nclients = n));
if(n == 1) if(n == 1 && !(tc->flags & SplitFlag))
client_maximize(tiled_client(screen, clients)); client_maximize(tc);
if(!ns) if(!ns)
grid(screen, True); grid(screen, True);
@@ -330,8 +330,15 @@ split(int screen)
{ {
c->flags &= ~(MaxFlag | LMaxFlag); c->flags &= ~(MaxFlag | LMaxFlag);
c->flags |= (TileFlag | SplitFlag); 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(); ewmh_update_current_tag_prop();
return; 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)); 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 /** Check if row direction is available to resize from it
*\param c Client pointer *\param c Client pointer
*\param g Client pointer *\param g Client pointer
@@ -75,7 +94,7 @@ _split_check_row_dir(Client *c, Client *g, Position p)
XRectangle cgeo; XRectangle cgeo;
Client *cc; 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); for(s = 0, cgeo = c->frame_geo, cc = tiled_client(c->screen, clients);
cc; cc = tiled_client(c->screen, cc->next)) cc; cc = tiled_client(c->screen, cc->next))
@@ -162,6 +181,8 @@ split_arrange_closed(Client *ghost)
} }
} }
split_store_geo(screen, tag);
return; 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)); g = split_client(sc, (sc->frame_geo.height < sc->frame_geo.width));
split_client_fill(c, g); split_client_fill(c, g);
split_store_geo(screen, tag);
return; return;
} }

View File

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

View File

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

View File

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