aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-28 12:45:42 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-28 12:45:42 +1000
commit7c7d24600b3db2675b691ae6345ef3fefab03dbd (patch)
tree27bdca654ca7336acc9018aeedbf6a46751a85c2
parentMerge pull request #2050 from smlx/focus-fix (diff)
downloadsway-7c7d24600b3db2675b691ae6345ef3fefab03dbd.tar.gz
sway-7c7d24600b3db2675b691ae6345ef3fefab03dbd.tar.zst
sway-7c7d24600b3db2675b691ae6345ef3fefab03dbd.zip
Fix ancestor typos
-rw-r--r--include/sway/tree/container.h4
-rw-r--r--sway/commands/swap.c4
-rw-r--r--sway/input/seat.c2
-rw-r--r--sway/tree/container.c6
-rw-r--r--sway/tree/layout.c8
5 files changed, 12 insertions, 12 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index a5f591ce..bb6c04a6 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -186,8 +186,8 @@ void container_for_each_descendant_dfs(struct sway_container *container,
186/** 186/**
187 * Returns true if the given container is an ancestor of this container. 187 * Returns true if the given container is an ancestor of this container.
188 */ 188 */
189bool container_has_anscestor(struct sway_container *container, 189bool container_has_ancestor(struct sway_container *container,
190 struct sway_container *anscestor); 190 struct sway_container *ancestor);
191 191
192/** 192/**
193 * Returns true if the given container is a child descendant of this container. 193 * Returns true if the given container is a child descendant of this container.
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index e925ad33..e8dfc57f 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -60,8 +60,8 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
60 } else if (current->type < C_CONTAINER || other->type < C_CONTAINER) { 60 } else if (current->type < C_CONTAINER || other->type < C_CONTAINER) {
61 error = cmd_results_new(CMD_FAILURE, "swap", 61 error = cmd_results_new(CMD_FAILURE, "swap",
62 "Can only swap with containers and views"); 62 "Can only swap with containers and views");
63 } else if (container_has_anscestor(current, other) 63 } else if (container_has_ancestor(current, other)
64 || container_has_anscestor(other, current)) { 64 || container_has_ancestor(other, current)) {
65 error = cmd_results_new(CMD_FAILURE, "swap", 65 error = cmd_results_new(CMD_FAILURE, "swap",
66 "Cannot swap ancestor and descendant"); 66 "Cannot swap ancestor and descendant");
67 } else if (current->layout == L_FLOATING || other->layout == L_FLOATING) { 67 } else if (current->layout == L_FLOATING || other->layout == L_FLOATING) {
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 6cfbe8d4..0295212c 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -542,7 +542,7 @@ void seat_set_focus_warp(struct sway_seat *seat,
542 return; 542 return;
543 } 543 }
544 544
545 // put all the anscestors of this container on top of the focus stack 545 // put all the ancestors of this container on top of the focus stack
546 struct sway_seat_container *parent = 546 struct sway_seat_container *parent =
547 seat_container_from_container(seat, container->parent); 547 seat_container_from_container(seat, container->parent);
548 while (parent) { 548 while (parent) {
diff --git a/sway/tree/container.c b/sway/tree/container.c
index a4798c7e..59137d88 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -656,11 +656,11 @@ void container_for_each_descendant_bfs(struct sway_container *con,
656 } 656 }
657} 657}
658 658
659bool container_has_anscestor(struct sway_container *descendant, 659bool container_has_ancestor(struct sway_container *descendant,
660 struct sway_container *anscestor) { 660 struct sway_container *ancestor) {
661 while (descendant->type != C_ROOT) { 661 while (descendant->type != C_ROOT) {
662 descendant = descendant->parent; 662 descendant = descendant->parent;
663 if (descendant == anscestor) { 663 if (descendant == ancestor) {
664 return true; 664 return true;
665 } 665 }
666 } 666 }
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 624d5516..aca9e254 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -157,7 +157,7 @@ struct sway_container *container_remove_child(struct sway_container *child) {
157void container_move_to(struct sway_container *container, 157void container_move_to(struct sway_container *container,
158 struct sway_container *destination) { 158 struct sway_container *destination) {
159 if (container == destination 159 if (container == destination
160 || container_has_anscestor(container, destination)) { 160 || container_has_ancestor(container, destination)) {
161 return; 161 return;
162 } 162 }
163 struct sway_container *old_parent = container_remove_child(container); 163 struct sway_container *old_parent = container_remove_child(container);
@@ -945,9 +945,9 @@ void container_swap(struct sway_container *con1, struct sway_container *con2) {
945 "Can only swap containers and views")) { 945 "Can only swap containers and views")) {
946 return; 946 return;
947 } 947 }
948 if (!sway_assert(!container_has_anscestor(con1, con2) 948 if (!sway_assert(!container_has_ancestor(con1, con2)
949 && !container_has_anscestor(con2, con1), 949 && !container_has_ancestor(con2, con1),
950 "Cannot swap anscestor and descendant")) { 950 "Cannot swap ancestor and descendant")) {
951 return; 951 return;
952 } 952 }
953 if (!sway_assert(con1->layout != L_FLOATING && con2->layout != L_FLOATING, 953 if (!sway_assert(con1->layout != L_FLOATING && con2->layout != L_FLOATING,