diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-23 17:47:28 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-23 17:47:28 +1000 |
commit | 32b865e610dd937af17ce36b8c986e41f55a4627 (patch) | |
tree | bb89819988dcebe0d621c645fac35c9bfe4198d4 /sway/input | |
parent | Merge remote-tracking branch 'upstream/master' into atomic (diff) | |
download | sway-32b865e610dd937af17ce36b8c986e41f55a4627.tar.gz sway-32b865e610dd937af17ce36b8c986e41f55a4627.tar.zst sway-32b865e610dd937af17ce36b8c986e41f55a4627.zip |
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.
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/seat.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 1ea36466..436d18e2 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -829,6 +829,18 @@ struct sway_container *seat_get_active_child(struct sway_seat *seat, | |||
829 | return NULL; | 829 | return NULL; |
830 | } | 830 | } |
831 | 831 | ||
832 | struct sway_container *seat_get_active_current_child(struct sway_seat *seat, | ||
833 | struct sway_container *container) { | ||
834 | struct sway_container *child = seat_get_active_child(seat, container); | ||
835 | if (child) { | ||
836 | return child; | ||
837 | } | ||
838 | if (container->current.children->length == 1) { | ||
839 | return container->current.children->items[0]; | ||
840 | } | ||
841 | return NULL; | ||
842 | } | ||
843 | |||
832 | struct sway_container *seat_get_focus(struct sway_seat *seat) { | 844 | struct sway_container *seat_get_focus(struct sway_seat *seat) { |
833 | if (!seat->has_focus) { | 845 | if (!seat->has_focus) { |
834 | return NULL; | 846 | return NULL; |