tag_client_with_rule() only tag is a rule match

This commit is contained in:
Julien Danjou 2008-01-13 18:22:05 +01:00
parent 47ee745425
commit 94197429e5
3 changed files with 12 additions and 10 deletions

View File

@ -275,8 +275,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
move_client_to_screen(c, rule->screen, True); move_client_to_screen(c, rule->screen, True);
else else
move_client_to_screen(c, screen, True); move_client_to_screen(c, screen, True);
if(!tag_client_with_rule(c, rule)) tag_client_with_rule(c, rule);
tag_client_with_current_selected(c);
} }
else else
move_client_to_screen(c, screen, True); move_client_to_screen(c, screen, True);

17
tag.c
View File

@ -93,25 +93,28 @@ tag_client_with_current_selected(Client *c)
untag_client(c, tag); untag_client(c, tag);
} }
Bool void
tag_client_with_rule(Client *c, Rule *r) tag_client_with_rule(Client *c, Rule *r)
{ {
Tag *tag; Tag *tag;
Bool matched = False; Bool matched = False;
if(!r) if(!r) return;
return False;
/* check if at least one tag match */
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next) for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
if(tag_match_rule(tag, r)) if(tag_match_rule(tag, r))
{ {
matched = True; matched = True;
tag_client(c, tag); break;
} }
else
untag_client(c, tag);
return matched; if(matched)
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
if(tag_match_rule(tag, r))
tag_client(c, tag);
else
untag_client(c, tag);
} }
Tag ** Tag **

2
tag.h
View File

@ -31,7 +31,7 @@ Tag ** get_current_tags(int );
void tag_client(Client *, Tag *); void tag_client(Client *, Tag *);
void untag_client(Client *, Tag *); void untag_client(Client *, Tag *);
Bool is_client_tagged(Client *, Tag *); Bool is_client_tagged(Client *, Tag *);
Bool tag_client_with_rule(Client *, Rule *r); void tag_client_with_rule(Client *, Rule *r);
void tag_client_with_current_selected(Client *); void tag_client_with_current_selected(Client *);
void tag_view_only_byindex(int, int); void tag_view_only_byindex(int, int);