mirror of
https://github.com/swaywm/sway.git
synced 2026-03-28 07:58:38 -04:00
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.)
This commit is contained in:
parent
a56098a24e
commit
07042486c3
7 changed files with 25 additions and 14 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue