aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c2
-rw-r--r--sway/input/seat.c17
2 files changed, 10 insertions, 9 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 16e5427b..d6e17ae1 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -264,7 +264,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
if (new_ws != old_ws) {
seat_set_focus(cursor->seat, cont);
}
- } else {
+ } else if (cont) {
seat_set_focus(cursor->seat, cont);
}
diff --git a/sway/input/seat.c b/sway/input/seat.c
index d35cbeef..071ef020 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -658,7 +658,8 @@ void seat_set_focus_layer(struct sway_seat *seat,
struct wlr_layer_surface *layer) {
if (!layer && seat->focused_layer) {
seat->focused_layer = NULL;
- struct sway_container *previous = seat_get_focus(seat);
+ struct sway_container *previous =
+ seat_get_focus_inactive(seat, &root_container);
if (previous) {
wlr_log(L_DEBUG, "Returning focus to %p %s '%s'", previous,
container_type_to_str(previous->type), previous->name);
@@ -728,14 +729,14 @@ struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
struct sway_container *seat_get_active_child(struct sway_seat *seat,
struct sway_container *container) {
- struct sway_container *focus = seat_get_focus_inactive(seat, container);
- if (!focus) {
- return NULL;
- }
- while (focus->parent != container) {
- focus = focus->parent;
+ struct sway_seat_container *current = NULL;
+ wl_list_for_each(current, &seat->focus_stack, link) {
+ if (current->container->parent == container &&
+ current->container->layout != L_FLOATING) {
+ return current->container;
+ }
}
- return focus;
+ return NULL;
}
struct sway_container *seat_get_focus(struct sway_seat *seat) {