mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 09:51:29 +00:00
Fix ancestor typos
This commit is contained in:
parent
b2c0ba5b18
commit
7c7d24600b
|
@ -186,8 +186,8 @@ void container_for_each_descendant_dfs(struct sway_container *container,
|
||||||
/**
|
/**
|
||||||
* Returns true if the given container is an ancestor of this container.
|
* Returns true if the given container is an ancestor of this container.
|
||||||
*/
|
*/
|
||||||
bool container_has_anscestor(struct sway_container *container,
|
bool container_has_ancestor(struct sway_container *container,
|
||||||
struct sway_container *anscestor);
|
struct sway_container *ancestor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the given container is a child descendant of this container.
|
* Returns true if the given container is a child descendant of this container.
|
||||||
|
|
|
@ -60,8 +60,8 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
|
||||||
} else if (current->type < C_CONTAINER || other->type < C_CONTAINER) {
|
} else if (current->type < C_CONTAINER || other->type < C_CONTAINER) {
|
||||||
error = cmd_results_new(CMD_FAILURE, "swap",
|
error = cmd_results_new(CMD_FAILURE, "swap",
|
||||||
"Can only swap with containers and views");
|
"Can only swap with containers and views");
|
||||||
} else if (container_has_anscestor(current, other)
|
} else if (container_has_ancestor(current, other)
|
||||||
|| container_has_anscestor(other, current)) {
|
|| container_has_ancestor(other, current)) {
|
||||||
error = cmd_results_new(CMD_FAILURE, "swap",
|
error = cmd_results_new(CMD_FAILURE, "swap",
|
||||||
"Cannot swap ancestor and descendant");
|
"Cannot swap ancestor and descendant");
|
||||||
} else if (current->layout == L_FLOATING || other->layout == L_FLOATING) {
|
} else if (current->layout == L_FLOATING || other->layout == L_FLOATING) {
|
||||||
|
|
|
@ -542,7 +542,7 @@ void seat_set_focus_warp(struct sway_seat *seat,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// put all the anscestors of this container on top of the focus stack
|
// put all the ancestors of this container on top of the focus stack
|
||||||
struct sway_seat_container *parent =
|
struct sway_seat_container *parent =
|
||||||
seat_container_from_container(seat, container->parent);
|
seat_container_from_container(seat, container->parent);
|
||||||
while (parent) {
|
while (parent) {
|
||||||
|
|
|
@ -656,11 +656,11 @@ void container_for_each_descendant_bfs(struct sway_container *con,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool container_has_anscestor(struct sway_container *descendant,
|
bool container_has_ancestor(struct sway_container *descendant,
|
||||||
struct sway_container *anscestor) {
|
struct sway_container *ancestor) {
|
||||||
while (descendant->type != C_ROOT) {
|
while (descendant->type != C_ROOT) {
|
||||||
descendant = descendant->parent;
|
descendant = descendant->parent;
|
||||||
if (descendant == anscestor) {
|
if (descendant == ancestor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ struct sway_container *container_remove_child(struct sway_container *child) {
|
||||||
void container_move_to(struct sway_container *container,
|
void container_move_to(struct sway_container *container,
|
||||||
struct sway_container *destination) {
|
struct sway_container *destination) {
|
||||||
if (container == destination
|
if (container == destination
|
||||||
|| container_has_anscestor(container, destination)) {
|
|| container_has_ancestor(container, destination)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct sway_container *old_parent = container_remove_child(container);
|
struct sway_container *old_parent = container_remove_child(container);
|
||||||
|
@ -945,9 +945,9 @@ void container_swap(struct sway_container *con1, struct sway_container *con2) {
|
||||||
"Can only swap containers and views")) {
|
"Can only swap containers and views")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!sway_assert(!container_has_anscestor(con1, con2)
|
if (!sway_assert(!container_has_ancestor(con1, con2)
|
||||||
&& !container_has_anscestor(con2, con1),
|
&& !container_has_ancestor(con2, con1),
|
||||||
"Cannot swap anscestor and descendant")) {
|
"Cannot swap ancestor and descendant")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!sway_assert(con1->layout != L_FLOATING && con2->layout != L_FLOATING,
|
if (!sway_assert(con1->layout != L_FLOATING && con2->layout != L_FLOATING,
|
||||||
|
|
Loading…
Reference in a new issue