mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 16:01:27 +00:00
cmd/swap: error on swapping a container with itself
This commit is contained in:
parent
b4fd4bca0e
commit
feea4b4410
|
@ -126,10 +126,10 @@ void container_swap(struct sway_container *con1, struct sway_container *con2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum sway_fullscreen_mode fs1 = con1->pending.fullscreen_mode;
|
enum sway_fullscreen_mode fs1 = con1->pending.fullscreen_mode;
|
||||||
enum sway_fullscreen_mode fs2 = con2->pending.fullscreen_mode;
|
|
||||||
if (fs1) {
|
if (fs1) {
|
||||||
container_fullscreen_disable(con1);
|
container_fullscreen_disable(con1);
|
||||||
}
|
}
|
||||||
|
enum sway_fullscreen_mode fs2 = con2->pending.fullscreen_mode;
|
||||||
if (fs2) {
|
if (fs2) {
|
||||||
container_fullscreen_disable(con2);
|
container_fullscreen_disable(con2);
|
||||||
}
|
}
|
||||||
|
@ -247,6 +247,9 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
|
||||||
} else if (!current) {
|
} else if (!current) {
|
||||||
error = cmd_results_new(CMD_FAILURE,
|
error = cmd_results_new(CMD_FAILURE,
|
||||||
"Can only swap with containers and views");
|
"Can only swap with containers and views");
|
||||||
|
} else if (current == other) {
|
||||||
|
error = cmd_results_new(CMD_FAILURE,
|
||||||
|
"Cannot swap a container with itself");
|
||||||
} else if (container_has_ancestor(current, other)
|
} else if (container_has_ancestor(current, other)
|
||||||
|| container_has_ancestor(other, current)) {
|
|| container_has_ancestor(other, current)) {
|
||||||
error = cmd_results_new(CMD_FAILURE,
|
error = cmd_results_new(CMD_FAILURE,
|
||||||
|
|
Loading…
Reference in a new issue