Select first tag of each screen if !tag prop at start/reload

This commit is contained in:
Martin Duquesnoy 2011-12-18 14:50:41 +01:00
parent 4a11107d67
commit 3d44ce225a
3 changed files with 25 additions and 12 deletions

View File

@ -132,4 +132,16 @@ clients_arrange_map(void)
}
}
static inline void
clients_tag_arrange_map(struct tag *t)
{
struct client *c;
void (*sfunc)(struct client*)
= (t == t->screen->seltag ? client_map : client_unmap);
SLIST_FOREACH(c, &t->clients, tnext)
sfunc(c);
}
#endif /* CLIENT_H */

View File

@ -107,7 +107,7 @@ tag_client(struct tag *t, struct client *c)
tag_client(t, cc);
}
if(t != W->screen->seltag || c->flags & CLIENT_TABBED)
if(t != c->screen->seltag || c->flags & CLIENT_TABBED)
client_unmap(c);
}

View File

@ -186,7 +186,7 @@ wmfs_scan(void)
struct geo g;
struct client *c, *cc, *fc;
struct screen *s;
int i, n, rf, nscreen;
int i, n, rf, nscreen = 0;
int tag = -1, screen = -1, flags = -1;
unsigned long ir, il;
long *ret, *tret;
@ -205,7 +205,6 @@ wmfs_scan(void)
(unsigned char**)&tret)
== Success && ret)
{
pstag = true;
nscreen = (int)ir;
}
@ -298,20 +297,19 @@ wmfs_scan(void)
}
}
/* Set back selected tag */
if(pstag)
if(!nscreen)
{
struct tag *t;
SLIST_FOREACH(s, &W->h.screen, next)
tag_screen(s, TAILQ_FIRST(&s->tags));
}
else
{
/* Set back selected tag */
for(i = 0; i < nscreen; ++i)
{
s = screen_gb_id(i);
if((t = tag_gb_id(s, tret[i])) != s->seltag)
tag_screen(s, t);
tag_screen(s, tag_gb_id(s, tret[i]));
}
XFree(tret);
}
/* Re-adjust tabbed clients */
@ -324,6 +322,9 @@ wmfs_scan(void)
W->flags &= ~WMFS_SCAN;
if(tret)
XFree(tret);
XFree(w);
XSync(W->dpy, false);
}