move compileregs() from tag.c to rules.c
This commit is contained in:
parent
a07669c52c
commit
a0ea5bf734
|
@ -40,7 +40,6 @@
|
||||||
#include "awesome.h"
|
#include "awesome.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "tag.h"
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
|
|
26
rules.c
26
rules.c
|
@ -22,6 +22,32 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
compileregs(Rule *rules)
|
||||||
|
{
|
||||||
|
Rule *r;
|
||||||
|
regex_t *reg;
|
||||||
|
for(r = rules; r; r = r->next)
|
||||||
|
{
|
||||||
|
if(r->prop)
|
||||||
|
{
|
||||||
|
reg = p_new(regex_t, 1);
|
||||||
|
if(regcomp(reg, r->prop, REG_EXTENDED))
|
||||||
|
p_delete(®);
|
||||||
|
else
|
||||||
|
r->propregex = reg;
|
||||||
|
}
|
||||||
|
if(r->tags)
|
||||||
|
{
|
||||||
|
reg = p_new(regex_t, 1);
|
||||||
|
if(regcomp(reg, r->tags, REG_EXTENDED))
|
||||||
|
p_delete(®);
|
||||||
|
else
|
||||||
|
r->tagregex = reg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
client_match_rule(Client *c, Rule *r)
|
client_match_rule(Client *c, Rule *r)
|
||||||
{
|
{
|
||||||
|
|
1
rules.h
1
rules.h
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#define RULE_NOSCREEN -1
|
#define RULE_NOSCREEN -1
|
||||||
|
|
||||||
|
void compileregs(Rule *);
|
||||||
Bool client_match_rule(Client *, Rule *);
|
Bool client_match_rule(Client *, Rule *);
|
||||||
int get_client_screen_from_rules(Client *, Rule *);
|
int get_client_screen_from_rules(Client *, Rule *);
|
||||||
Bool is_tag_match_rules(Tag *, Rule *);
|
Bool is_tag_match_rules(Tag *, Rule *);
|
||||||
|
|
28
tag.c
28
tag.c
|
@ -28,34 +28,6 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
|
|
||||||
void
|
|
||||||
compileregs(Rule *rules)
|
|
||||||
{
|
|
||||||
Rule *r;
|
|
||||||
regex_t *reg;
|
|
||||||
|
|
||||||
for(r = rules; r; r = r->next)
|
|
||||||
{
|
|
||||||
if(r->prop)
|
|
||||||
{
|
|
||||||
reg = p_new(regex_t, 1);
|
|
||||||
if(regcomp(reg, r->prop, REG_EXTENDED))
|
|
||||||
p_delete(®);
|
|
||||||
else
|
|
||||||
r->propregex = reg;
|
|
||||||
}
|
|
||||||
if(r->tags)
|
|
||||||
{
|
|
||||||
reg = p_new(regex_t, 1);
|
|
||||||
if(regcomp(reg, r->tags, REG_EXTENDED))
|
|
||||||
p_delete(®);
|
|
||||||
else
|
|
||||||
r->tagregex = reg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Returns True if a client is tagged
|
/** Returns True if a client is tagged
|
||||||
* with one of the tags
|
* with one of the tags
|
||||||
* \param c Client
|
* \param c Client
|
||||||
|
|
1
tag.h
1
tag.h
|
@ -27,7 +27,6 @@
|
||||||
/** Check if a client is tiled */
|
/** Check if a client is tiled */
|
||||||
#define IS_TILED(client, screen, tags, ntags) (client && !client->isfloating && isvisible(client, screen, tags, ntags))
|
#define IS_TILED(client, screen, tags, ntags) (client && !client->isfloating && isvisible(client, screen, tags, ntags))
|
||||||
|
|
||||||
void compileregs(Rule *);
|
|
||||||
Bool isvisible(Client *, int, Tag *, int);
|
Bool isvisible(Client *, int, Tag *, int);
|
||||||
|
|
||||||
UICB_PROTO(uicb_tag);
|
UICB_PROTO(uicb_tag);
|
||||||
|
|
Loading…
Reference in New Issue