diff options
author | Tudor Brindus <[email protected]> | 2020-11-03 00:16:15 -0500 |
---|---|---|
committer | Brian Ashworth <[email protected]> | 2020-11-11 20:43:58 -0500 |
commit | 07042486c3c4b8e7083405ba9b34b1b87f8d396d (patch) | |
tree | 5ec7b68db2acbc1c68538a08b0b039477e8f8858 /sway/commands/move.c | |
parent | a56098a24e43f459d52a638611a9084c9b1a32d8 (diff) |
tree/container: introduce `container_is_sticky[_or_child]` functions
To query whether a container is sticky, checking `con->is_sticky` is
insufficient. `container_is_floating_or_child` must also return true;
this led to a lot of repetition.
This commit introduces `container_is_sticky[_or_child]` functions, and
switches all stickiness checks to use them. (Including ones where the
container is already known to be floating, for consistency.)
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r-- | sway/commands/move.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index 876a5616..204596c0 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -482,7 +482,7 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth, // We have to create the workspace, but if the container is // sticky and the workspace is going to be created on the same // output, we'll bail out first. - if (container->is_sticky && container_is_floating_or_child(container)) { + if (container_is_sticky_or_child(container)) { struct sway_output *new_output = workspace_get_initial_output(ws_name); if (old_output == new_output) { @@ -521,8 +521,8 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth, return cmd_move_to_scratchpad(); } - if (container->is_sticky && container_is_floating_or_child(container) && - old_output && node_has_ancestor(destination, &old_output->node)) { + if (container_is_sticky_or_child(container) && old_output && + node_has_ancestor(destination, &old_output->node)) { return cmd_results_new(CMD_FAILURE, "Can't move sticky " "container to another workspace on the same output"); } |