aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-04-04 23:06:42 -0400
committerGitHub <noreply@github.com>2018-04-04 23:06:42 -0400
commit891e1148bee2575522312078f96eb4c41af49c6c (patch)
tree3044fb62120ca23499d31275076af50db09a9850 /sway/input
parent21aedf15052df4e7f8ee72922fa0e214d690facc (diff)
parent65f254f3fbc83d006d4ec29170ec8a8695345d6c (diff)
downloadsway-891e1148bee2575522312078f96eb4c41af49c6c.tar.xz
Merge pull request #1733 from acrisci/fix-focus-inactive
try to fix focus-inactive
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/seat.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 87dbd870..e3df6955 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -126,7 +126,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener,
static struct sway_seat_container *seat_container_from_container(
struct sway_seat *seat, struct sway_container *con) {
- if (con->type < C_WORKSPACE) {
+ if (con->type == C_ROOT || con->type == C_OUTPUT) {
// these don't get seat containers ever
return NULL;
}
@@ -534,22 +534,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 (current->container->type != type && type != C_TYPES) {
+ 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;
}
}