From 355dc7d5560951c2dcea8859f1432c76c3e0ef24 Mon Sep 17 00:00:00 2001 From: Nikos Ntarmos Date: Tue, 27 Nov 2007 16:47:03 +0100 Subject: [PATCH] fix rules handling in configurequest events --- client.c | 62 +++++++++++++++++++++++++++++++------------------------- client.h | 1 + event.c | 2 +- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/client.c b/client.c index fd27df40..c9fe7b9c 100644 --- a/client.c +++ b/client.c @@ -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(¤t_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 = ¤t_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(¤t_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 diff --git a/client.h b/client.h index 84b54d04..65c0bf44 100644 --- a/client.h +++ b/client.h @@ -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); diff --git a/event.c b/event.c index fc83cb34..c0da5711 100644 --- a/event.c +++ b/event.c @@ -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]); }