aboutsummaryrefslogtreecommitdiff
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-04-04 18:52:38 -0400
committerTony Crisci <tony@dubstepdish.com>2018-04-04 18:52:38 -0400
commit3e61718053a7e2cdd94c64f5613c6bdf28e35c8e (patch)
tree4cceb8836dbc34317c8e530aec373fd6241db466 /sway/input/seat.c
parent3852a710ca62a76f4fd9c6ff9d28e7e5d5fcf78d (diff)
try to fix focus-inactive
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 4a99e9eb..078cb8b8 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -467,22 +467,18 @@ struct sway_container *sway_seat_get_focus(struct sway_seat *seat) {
struct sway_container *seat_get_focus_by_type(struct sway_seat *seat,
struct sway_container *container, enum sway_container_type type) {
+ if (container->type == C_VIEW || container->children->length == 0) {
+ return container;
+ }
+
struct sway_seat_container *current = NULL;
- struct sway_container *parent = NULL;
wl_list_for_each(current, &seat->focus_stack, link) {
- parent = current->container->parent;
-
- if (current->container == container &&
- (type == C_TYPES || container->type == type)) {
- return current->container;
+ if (type != C_TYPES && container->type != type) {
+ continue;
}
- while (parent) {
- if (parent == container && (type == C_TYPES ||
- current->container->type == type)) {
- return current->container;
- }
- parent = parent->parent;
+ if (container_has_child(container, current->container)) {
+ return current->container;
}
}