aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-01-21 14:11:41 -0500
committerTony Crisci <tony@dubstepdish.com>2018-01-21 14:11:41 -0500
commit5505d84ac2fda7c5fb4e4c52385ff818e66ef8e1 (patch)
tree9e7defcf69938a94878a03d083124212609b3c9d /sway
parent6b03b1205d39d23ea1dee3beb0b533ef5426031e (diff)
criteria cleanup
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c2
-rw-r--r--sway/criteria.c15
2 files changed, 11 insertions, 6 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 3ab5add6..a77ff791 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -226,7 +226,7 @@ struct cmd_results *handle_command(char *_exec) {
free(tokens);
goto cleanup;
}
- containers = container_for(tokens);
+ containers = container_for_crit_tokens(tokens);
free(tokens);
} else {
diff --git a/sway/criteria.c b/sway/criteria.c
index 09733616..2eee331c 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -103,7 +103,8 @@ static int countchr(char *str, char c) {
// of buf.
//
// Returns error string or NULL if successful.
-static char *crit_tokens(int *argc, char ***buf, const char * const criteria_str) {
+static char *crit_tokens(int *argc, char ***buf,
+ const char * const criteria_str) {
wlr_log(L_DEBUG, "Parsing criteria: '%s'", criteria_str);
char *base = criteria_from(criteria_str);
char *head = base;
@@ -423,16 +424,20 @@ struct list_tokens {
list_t *tokens;
};
-static void container_match_add(swayc_t *container, struct list_tokens *list_tokens) {
+static void container_match_add(swayc_t *container,
+ struct list_tokens *list_tokens) {
if (criteria_test(container, list_tokens->tokens)) {
list_add(list_tokens->list, container);
}
}
-list_t *container_for(list_t *tokens) {
- struct list_tokens list_tokens = (struct list_tokens){create_list(), tokens};
+list_t *container_for_crit_tokens(list_t *tokens) {
+ struct list_tokens list_tokens =
+ (struct list_tokens){create_list(), tokens};
- container_map(&root_container, (void (*)(swayc_t *, void *))container_match_add, &list_tokens);
+ container_map(&root_container,
+ (void (*)(swayc_t *, void *))container_match_add,
+ &list_tokens);
// TODO look in the scratchpad