From 32b865e610dd937af17ce36b8c986e41f55a4627 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 23 Jun 2018 17:47:28 +1000 Subject: Fix crash when deleting last child in a tabbed or stacked container There was no `current` child because the container was destroyed. This makes it fall back to looking in the parent's current children list. --- include/sway/input/seat.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/sway/input/seat.h') diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 1f7792ba..0e440701 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h @@ -118,6 +118,17 @@ struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat, struct sway_container *seat_get_active_child(struct sway_seat *seat, struct sway_container *container); +/** + * Return the immediate child of container which was most recently focused, with + * fallback to selecting the child in the parent's `current` (rendered) children + * list. + * + * This is useful for when a tabbed container and its children are destroyed but + * still being rendered, and we have to render an appropriate child. + */ +struct sway_container *seat_get_active_current_child(struct sway_seat *seat, + struct sway_container *container); + /** * Iterate over the focus-inactive children of the container calling the * function on each. -- cgit v1.2.3-54-g00ecf