diff options
author | Anders <a@anrd.net> | 2020-01-26 10:27:52 +0100 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-02-04 19:52:21 -0500 |
commit | 4e46bdf73dc2e9f98ca14263f42dde664f7d2aba (patch) | |
tree | 57ccf6bb1989b050fb86b260e3bef0dbcec7d838 /sway/commands.c | |
parent | Change wording (diff) | |
download | sway-4e46bdf73dc2e9f98ca14263f42dde664f7d2aba.tar.gz sway-4e46bdf73dc2e9f98ca14263f42dde664f7d2aba.tar.zst sway-4e46bdf73dc2e9f98ca14263f42dde664f7d2aba.zip |
criteria: match containers without view
Closes #4929
Replaces criteria_get_views with criteria_get_containers which can
return containers without views when the criteria only contains
container properties.
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sway/commands.c b/sway/commands.c index 751dbe9c..6a56ff5a 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -201,7 +201,7 @@ list_t *execute_command(char *_exec, struct sway_seat *seat, | |||
201 | struct sway_container *con) { | 201 | struct sway_container *con) { |
202 | char *cmd; | 202 | char *cmd; |
203 | char matched_delim = ';'; | 203 | char matched_delim = ';'; |
204 | list_t *views = NULL; | 204 | list_t *containers = NULL; |
205 | 205 | ||
206 | if (seat == NULL) { | 206 | if (seat == NULL) { |
207 | // passing a NULL seat means we just pick the default seat | 207 | // passing a NULL seat means we just pick the default seat |
@@ -235,8 +235,8 @@ list_t *execute_command(char *_exec, struct sway_seat *seat, | |||
235 | free(error); | 235 | free(error); |
236 | goto cleanup; | 236 | goto cleanup; |
237 | } | 237 | } |
238 | list_free(views); | 238 | list_free(containers); |
239 | views = criteria_get_views(criteria); | 239 | containers = criteria_get_containers(criteria); |
240 | head += strlen(criteria->raw); | 240 | head += strlen(criteria->raw); |
241 | criteria_destroy(criteria); | 241 | criteria_destroy(criteria); |
242 | config->handler_context.using_criteria = true; | 242 | config->handler_context.using_criteria = true; |
@@ -289,14 +289,14 @@ list_t *execute_command(char *_exec, struct sway_seat *seat, | |||
289 | free_argv(argc, argv); | 289 | free_argv(argc, argv); |
290 | goto cleanup; | 290 | goto cleanup; |
291 | } | 291 | } |
292 | } else if (views->length == 0) { | 292 | } else if (containers->length == 0) { |
293 | list_add(res_list, | 293 | list_add(res_list, |
294 | cmd_results_new(CMD_FAILURE, "No matching node.")); | 294 | cmd_results_new(CMD_FAILURE, "No matching node.")); |
295 | } else { | 295 | } else { |
296 | struct cmd_results *fail_res = NULL; | 296 | struct cmd_results *fail_res = NULL; |
297 | for (int i = 0; i < views->length; ++i) { | 297 | for (int i = 0; i < containers->length; ++i) { |
298 | struct sway_view *view = views->items[i]; | 298 | struct sway_container *container = containers->items[i]; |
299 | set_config_node(&view->container->node); | 299 | set_config_node(&container->node); |
300 | struct cmd_results *res = handler->handle(argc-1, argv+1); | 300 | struct cmd_results *res = handler->handle(argc-1, argv+1); |
301 | if (res->status == CMD_SUCCESS) { | 301 | if (res->status == CMD_SUCCESS) { |
302 | free_cmd_results(res); | 302 | free_cmd_results(res); |
@@ -320,7 +320,7 @@ list_t *execute_command(char *_exec, struct sway_seat *seat, | |||
320 | } while(head); | 320 | } while(head); |
321 | cleanup: | 321 | cleanup: |
322 | free(exec); | 322 | free(exec); |
323 | list_free(views); | 323 | list_free(containers); |
324 | return res_list; | 324 | return res_list; |
325 | } | 325 | } |
326 | 326 | ||