diff options
author | emersion <contact@emersion.fr> | 2018-08-11 08:44:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-11 08:44:11 +0100 |
commit | 9545c70928d47172cfbcbd318628497b87efefc1 (patch) | |
tree | f24bbab4a5a54936ddca9b823e4103ea630e993b /sway | |
parent | e474d87e42d625eb4e0a41a0559bbf0e4ec5ecc5 (diff) | |
parent | 31844bf42bc4b6549862ea4c4f077c1e19d9e7a1 (diff) | |
download | sway-9545c70928d47172cfbcbd318628497b87efefc1.tar.xz |
Merge pull request #2448 from RyanDwyer/remove-container-has-child
Remove container_has_child
Diffstat (limited to 'sway')
-rw-r--r-- | sway/input/seat.c | 6 | ||||
-rw-r--r-- | sway/tree/container.c | 13 |
2 files changed, 3 insertions, 16 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 6dd7cf7d..3cd079f4 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -145,14 +145,14 @@ static struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, continue; } - if (container_has_child(container, current->container)) { + if (container_has_ancestor(current->container, container)) { if (only_tiling && container_is_floating_or_child(current->container)) { continue; } return current->container; } - if (floating && container_has_child(floating, current->container)) { + if (floating && container_has_ancestor(current->container, floating)) { return current->container; } } @@ -190,7 +190,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener, bool set_focus = focus != NULL && - (focus == con || container_has_child(con, focus)) && + (focus == con || container_has_ancestor(focus, con)) && con->type != C_WORKSPACE; seat_container_destroy(seat_con); diff --git a/sway/tree/container.c b/sway/tree/container.c index aecb2ac6..cec51af4 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -817,19 +817,6 @@ bool container_has_ancestor(struct sway_container *descendant, return false; } -static bool find_child_func(struct sway_container *con, void *data) { - struct sway_container *child = data; - return con == child; -} - -bool container_has_child(struct sway_container *con, - struct sway_container *child) { - if (con == NULL || con->type == C_VIEW) { - return false; - } - return container_find(con, find_child_func, child); -} - int container_count_descendants_of_type(struct sway_container *con, enum sway_container_type type) { int children = 0; |