summaryrefslogtreecommitdiffstats
path: root/sway/criteria.c
diff options
context:
space:
mode:
authorLibravatar Scott Anderson <ascent12@hotmail.com>2017-04-07 00:19:14 +1200
committerLibravatar Scott Anderson <ascent12@hotmail.com>2017-04-07 00:34:33 +1200
commit3a32be67ed89bf667ec840eca3191ed5f207df70 (patch)
treef605c27b9b6b87dfbcf613969e0ee8fa77cdd716 /sway/criteria.c
parentChanged regular expressions to use PCRE for i3 compatibility (diff)
downloadsway-3a32be67ed89bf667ec840eca3191ed5f207df70.tar.gz
sway-3a32be67ed89bf667ec840eca3191ed5f207df70.tar.zst
sway-3a32be67ed89bf667ec840eca3191ed5f207df70.zip
Added designated initaliser, to prevent any possible problem with
ordering
Diffstat (limited to 'sway/criteria.c')
-rw-r--r--sway/criteria.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/sway/criteria.c b/sway/criteria.c
index 706da04f..ee6d4d1c 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -23,17 +23,16 @@ enum criteria_type { // *must* keep in sync with criteria_strings[]
23 CRIT_LAST 23 CRIT_LAST
24}; 24};
25 25
26// this *must* match the ordering in criteria_type enum 26static const char * const criteria_strings[CRIT_LAST] = {
27static const char * const criteria_strings[] = { 27 [CRIT_CLASS] = "class",
28 "class", 28 [CRIT_CON_MARK] = "con_mark",
29 "con_mark", 29 [CRIT_ID] = "id",
30 "id", 30 [CRIT_INSTANCE] = "instance",
31 "instance", 31 [CRIT_TITLE] = "title",
32 "title", 32 [CRIT_URGENT] = "urgent", // either "latest" or "oldest" ...
33 "urgent", // either "latest" or "oldest" ... 33 [CRIT_WINDOW_ROLE] = "window_role",
34 "window_role", 34 [CRIT_WINDOW_TYPE] = "window_type",
35 "window_type", 35 [CRIT_WORKSPACE] = "workspace"
36 "workspace"
37}; 36};
38 37
39/** 38/**
@@ -240,7 +239,7 @@ ect_cleanup:
240} 239}
241 240
242static int regex_cmp(const char *item, const pcre *regex) { 241static int regex_cmp(const char *item, const pcre *regex) {
243 return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0); 242 return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0);
244} 243}
245 244
246// test a single view if it matches list of criteria tokens (all of them). 245// test a single view if it matches list of criteria tokens (all of them).