Fix possible fail in rules parsing, first tag mapping at reload

This commit is contained in:
Martin Duquesnoy 2011-12-17 18:51:42 +01:00
parent a23dd7987b
commit 4a11107d67
4 changed files with 28 additions and 35 deletions

View File

@ -513,11 +513,8 @@ client_focus(struct client *c)
if(W->client && W->client != c)
{
client_grabbuttons(W->client, false);
if(!(W->client->flags & CLIENT_TABMASTER
&& c->tabmaster == W->client))
client_frame_update(W->client, &W->client->ncol);
}
client_frame_update(W->client, &W->client->ncol);
}
/* Focus c */
if((W->client = c))

View File

@ -113,7 +113,6 @@ static void
config_tag(void)
{
struct screen *s;
struct tag *t;
size_t i, n;
struct conf_sec *sec, **ks;
char *name;
@ -132,13 +131,7 @@ config_tag(void)
SLIST_FOREACH(s, &W->h.screen, next)
if(screenid == s->id || screenid == -1)
{
t = tag_new(s, name);
/* Set first tag as seltag */
if(t == TAILQ_FIRST(&s->tags))
s->seltag = t;
}
tag_new(s, name);
}
free(ks);
@ -182,14 +175,15 @@ config_rule(void)
FLAGAPPLY(r->flags, fetch_opt_first(ks[i], "false", "max").boolean, RULE_MAX);
FLAGAPPLY(r->flags, fetch_opt_first(ks[i], "false", "ignore_tag").boolean, RULE_IGNORE_TAG);
tn = fetch_opt_first(ks[i], "", "theme").str;
SLIST_FOREACH(t, &W->h.theme, next)
if(!strcmp(tn, t->name))
{
r->theme = t;
break;
}
if((tn = fetch_opt_first(ks[i], "", "theme").str))
{
SLIST_FOREACH(t, &W->h.theme, next)
if(!strcmp(tn, t->name))
{
r->theme = t;
break;
}
}
SLIST_INSERT_HEAD(&W->h.rule, r, next);
}

View File

@ -41,8 +41,6 @@ tag_new(struct screen *s, char *name)
void
tag_screen(struct screen *s, struct tag *t)
{
struct client *c;
t->prev = s->seltag;
s->seltag = t;

View File

@ -298,6 +298,22 @@ wmfs_scan(void)
}
}
/* Set back selected tag */
if(pstag)
{
struct tag *t;
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);
}
XFree(tret);
}
/* Re-adjust tabbed clients */
SLIST_FOREACH(c, &W->h.client, next)
if((cc = client_gb_win(c->tmp)) && cc != c)
@ -306,18 +322,6 @@ wmfs_scan(void)
if((fc = client_gb_win(focus)) && fc != W->client)
client_focus(fc);
/* Set back selected tag */
if(pstag)
{
for(i = 0; i < nscreen; ++i)
{
s = screen_gb_id(i);
tag_screen(s, tag_gb_id(s, tret[i]));
}
XFree(tret);
}
W->flags &= ~WMFS_SCAN;
XFree(w);