move tag_client_with_rules() from client.c to tag.c

This commit is contained in:
Julien Danjou 2007-12-14 16:40:08 +01:00
parent 3a4fbce6f9
commit 781ebc8882
4 changed files with 30 additions and 30 deletions

View file

@ -561,35 +561,6 @@ client_updatesizehints(Client *c)
&& c->maxw == c->minw && c->maxh == c->minh);
}
void
tag_client_with_rules(Client *c, awesome_config *awesomeconf)
{
Rule *r;
Bool matched = False;
int i;
for(r = awesomeconf->rules; r; r = r->next)
if(client_match_rule(c, r))
{
c->isfloating = r->isfloating;
if(r->screen != RULE_NOSCREEN && r->screen != c->screen)
move_client_to_screen(c, awesomeconf, r->screen, True);
for(i = 0; i < awesomeconf->screens[c->screen].ntags; i++)
if(is_tag_match_rules(&awesomeconf->screens[c->screen].tags[i], r))
{
matched = True;
tag_client(&awesomeconf->screens[c->screen].tclink, c,
&awesomeconf->screens[c->screen].tags[i]);
}
if(!matched)
tag_client_with_current_selected(c, &awesomeconf->screens[c->screen]);
break;
}
}
/** Returns True if a client is tagged
* with one of the tags
* \return True or False

View file

@ -37,7 +37,6 @@ void client_unmanage(Client *, long, awesome_config *);
void client_updatesizehints(Client *);
void client_updatetitle(Client *);
void client_saveprops(Client *, VirtScreen *);
void tag_client_with_rules(Client *, awesome_config *);
UICB_PROTO(uicb_client_kill);
UICB_PROTO(uicb_client_moveresize);

29
tag.c
View file

@ -105,6 +105,35 @@ tag_client_with_current_selected(Client *c, VirtScreen *screen)
untag_client(&screen->tclink, c, &screen->tags[i]);
}
void
tag_client_with_rules(Client *c, awesome_config *awesomeconf)
{
Rule *r;
Bool matched = False;
int i;
for(r = awesomeconf->rules; r; r = r->next)
if(client_match_rule(c, r))
{
c->isfloating = r->isfloating;
if(r->screen != RULE_NOSCREEN && r->screen != c->screen)
move_client_to_screen(c, awesomeconf, r->screen, True);
for(i = 0; i < awesomeconf->screens[c->screen].ntags; i++)
if(is_tag_match_rules(&awesomeconf->screens[c->screen].tags[i], r))
{
matched = True;
tag_client(&awesomeconf->screens[c->screen].tclink, c,
&awesomeconf->screens[c->screen].tags[i]);
}
if(!matched)
tag_client_with_current_selected(c, &awesomeconf->screens[c->screen]);
break;
}
}
/** Tag selected window with tag
* \param arg Tag name
* \ingroup ui_callback

1
tag.h
View file

@ -31,6 +31,7 @@ void tag_client(TagClientLink **, Client *, Tag *);
void untag_client(TagClientLink **, Client *, Tag *);
Bool is_client_tagged(TagClientLink *, Client *, Tag *);
void tag_client_with_current_selected(Client *, VirtScreen *);
void tag_client_with_rules(Client *, awesome_config *);
UICB_PROTO(uicb_client_tag);
UICB_PROTO(uicb_client_togglefloating);