insert and use rule_matching_client()
This commit is contained in:
parent
29740269ec
commit
654fba9b5e
11
client.c
11
client.c
|
@ -327,19 +327,12 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
|||
client_saveprops(c);
|
||||
|
||||
/* attach to the stack */
|
||||
for(rule = globalconf.rules; rule; rule = rule->next)
|
||||
if(rule->not_master && client_match_rule(c, rule))
|
||||
{
|
||||
if((rule = rule_matching_client(c)) && rule->not_master)
|
||||
client_list_append(&globalconf.clients, c);
|
||||
break;
|
||||
}
|
||||
if(!rule)
|
||||
{
|
||||
if(globalconf.screens[c->screen].new_become_master)
|
||||
else if(globalconf.screens[c->screen].new_become_master)
|
||||
client_list_push(&globalconf.clients, c);
|
||||
else
|
||||
client_list_append(&globalconf.clients, c);
|
||||
}
|
||||
|
||||
ewmh_update_net_client_list(phys_screen);
|
||||
|
||||
|
|
13
rules.c
13
rules.c
|
@ -42,7 +42,7 @@ rules_compile_regex(char *val)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
client_match_rule(Client *c, Rule *r)
|
||||
{
|
||||
char *prop, buf[512];
|
||||
|
@ -97,6 +97,17 @@ tag_match_rule(Tag *t, Rule *r)
|
|||
return False;
|
||||
}
|
||||
|
||||
Rule *
|
||||
rule_matching_client(Client *c)
|
||||
{
|
||||
Rule *r;
|
||||
for(r = globalconf.rules; r; r = r->next)
|
||||
if(client_match_rule(c, r))
|
||||
return r;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RuleFloat
|
||||
rules_get_float_from_str(const char *str)
|
||||
{
|
||||
|
|
2
rules.h
2
rules.h
|
@ -27,9 +27,9 @@
|
|||
#define RULE_NOSCREEN -1
|
||||
|
||||
regex_t * rules_compile_regex(char *);
|
||||
Bool client_match_rule(Client *, Rule *);
|
||||
Bool tag_match_rule(Tag *, Rule *);
|
||||
RuleFloat rules_get_float_from_str(const char *);
|
||||
Rule * rule_matching_client(Client *);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
4
tag.c
4
tag.c
|
@ -100,8 +100,7 @@ tag_client_with_rules(Client *c)
|
|||
Tag *tag;
|
||||
Bool matched = False;
|
||||
|
||||
for(r = globalconf.rules; r; r = r->next)
|
||||
if(client_match_rule(c, r))
|
||||
if((r = rule_matching_client(c)))
|
||||
{
|
||||
switch(r->isfloating)
|
||||
{
|
||||
|
@ -130,7 +129,6 @@ tag_client_with_rules(Client *c)
|
|||
|
||||
if(!matched)
|
||||
tag_client_with_current_selected(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset,
|
|||
|
||||
widget->area.height = widget->statusbar->height;
|
||||
|
||||
for(r = globalconf.rules; r; r = r->next)
|
||||
if(r->icon && client_match_rule(sel, r))
|
||||
if((r = rule_matching_client(sel)) && r->icon)
|
||||
{
|
||||
area = draw_get_image_size(r->icon);
|
||||
widget->area.width = ((double) widget->statusbar->height / (double) area.height)
|
||||
|
@ -67,7 +66,6 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset,
|
|||
return widget->area.width;
|
||||
}
|
||||
|
||||
|
||||
if(!(icon = ewmh_get_window_icon(sel->win)))
|
||||
{
|
||||
widget->area.width = 0;
|
||||
|
|
|
@ -86,8 +86,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
|||
|
||||
if(d->show_icons)
|
||||
{
|
||||
for(r = globalconf.rules; r; r = r->next)
|
||||
if(r->icon && client_match_rule(c, r))
|
||||
if((r = rule_matching_client(c)) && r->icon)
|
||||
{
|
||||
area = draw_get_image_size(r->icon);
|
||||
icon_width = ((double) widget->statusbar->height / (double) area.height) * area.width;
|
||||
|
|
Loading…
Reference in New Issue