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