fix rules handling in configurequest events

This commit is contained in:
Nikos Ntarmos 2007-11-27 16:47:03 +01:00 committed by Julien Danjou
parent 963bef908e
commit 355dc7d556
3 changed files with 36 additions and 29 deletions

View File

@ -287,34 +287,7 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
/* loadprops or apply rules if no props */
if(!loadprops(c, awesomeconf->ntags))
{
Rule *r;
Bool matched = False;
for(r = current_acf->rules; r; r = r->next)
if(client_match_rule(c, r))
{
c->isfloating = r->isfloating;
if(r->screen != RULE_NOSCREEN && r->screen != c->screen)
{
current_acf = &awesomeconf[r->screen - awesomeconf->screen];
move_client_to_screen(c, current_acf, True);
}
for(i = 0; i < current_acf->ntags; i++)
if(is_tag_match_rules(&current_acf->tags[i], r))
{
matched = True;
c->tags[i] = True;
}
else
c->tags[i] = False;
if(!matched)
tag_client_with_current_selected(c, current_acf);
break;
}
}
tag_client_with_rules(c, current_acf);
screen_info = get_screen_info(current_acf->display, current_acf->screen, NULL);
@ -604,6 +577,39 @@ updatesizehints(Client *c)
&& c->maxw == c->minw && c->maxh == c->minh);
}
void
tag_client_with_rules(Client *c, awesome_config *current_acf)
{
Rule *r;
Bool matched = False;
int i;
for(r = current_acf->rules; r; r = r->next)
if(client_match_rule(c, r))
{
c->isfloating = r->isfloating;
if(r->screen != RULE_NOSCREEN && r->screen != c->screen)
{
current_acf = &current_acf[r->screen - current_acf->screen];
move_client_to_screen(c, current_acf, True);
}
for(i = 0; i < current_acf->ntags; i++)
if(is_tag_match_rules(&current_acf->tags[i], r))
{
matched = True;
c->tags[i] = True;
}
else
c->tags[i] = False;
if(!matched)
tag_client_with_current_selected(c, current_acf);
break;
}
}
/** Set selected client transparency
* \param awesomeconf awesome config
* \param arg unused arg

View File

@ -38,6 +38,7 @@ void client_unmanage(Client *, long, awesome_config *);
inline void updatesizehints(Client *);
void updatetitle(Client *);
void saveprops(Client *, int);
void tag_client_with_rules(Client *, awesome_config *);
UICB_PROTO(uicb_client_kill);
UICB_PROTO(uicb_client_moveresize);

View File

@ -163,7 +163,7 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf)
drawstatusbar(&awesomeconf[old_screen]);
drawstatusbar(&awesomeconf[c->screen]);
}
tag_client_with_current_selected(c, &awesomeconf[c->screen]);
tag_client_with_rules(c, &awesomeconf[c->screen]);
XMoveResizeWindow(e->xany.display, c->win, c->rx, c->ry, c->rw, c->rh);
arrange(&awesomeconf[c->screen]);
}