Implement scratchpad

Implements the following commands:

* move scratchpad
* scratchpad show
* [criteria] scratchpad show

Also fixes these:

* Fix memory leak when executing command with criteria
(use `list_free(views)` instead of `free(views)`)
* Fix crash when running `move to` with no further arguments
This commit is contained in:
Ryan Dwyer 2018-07-22 14:10:40 +10:00
parent 89dc047ca9
commit 81e8f31cc6
13 changed files with 290 additions and 5 deletions

View file

@ -225,6 +225,14 @@ list_t *criteria_get_views(struct criteria *criteria) {
};
container_for_each_descendant_dfs(&root_container,
criteria_get_views_iterator, &data);
// Scratchpad items which are hidden are not in the tree.
for (int i = 0; i < server.scratchpad->length; ++i) {
struct sway_container *con = server.scratchpad->items[i];
if (!con->parent) {
criteria_get_views_iterator(con, &data);
}
}
return matches;
}