summaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seat.c')
-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,
126 126
127static struct sway_seat_container *seat_container_from_container( 127static struct sway_seat_container *seat_container_from_container(
128 struct sway_seat *seat, struct sway_container *con) { 128 struct sway_seat *seat, struct sway_container *con) {
129 if (con->type < C_WORKSPACE) { 129 if (con->type == C_ROOT || con->type == C_OUTPUT) {
130 // these don't get seat containers ever 130 // these don't get seat containers ever
131 return NULL; 131 return NULL;
132 } 132 }
@@ -534,22 +534,18 @@ struct sway_container *sway_seat_get_focus(struct sway_seat *seat) {
534 534
535struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, 535struct sway_container *seat_get_focus_by_type(struct sway_seat *seat,
536 struct sway_container *container, enum sway_container_type type) { 536 struct sway_container *container, enum sway_container_type type) {
537 if (container->type == C_VIEW || container->children->length == 0) {
538 return container;
539 }
540
537 struct sway_seat_container *current = NULL; 541 struct sway_seat_container *current = NULL;
538 struct sway_container *parent = NULL;
539 wl_list_for_each(current, &seat->focus_stack, link) { 542 wl_list_for_each(current, &seat->focus_stack, link) {
540 parent = current->container->parent; 543 if (current->container->type != type && type != C_TYPES) {
541 544 continue;
542 if (current->container == container &&
543 (type == C_TYPES || container->type == type)) {
544 return current->container;
545 } 545 }
546 546
547 while (parent) { 547 if (container_has_child(container, current->container)) {
548 if (parent == container && (type == C_TYPES || 548 return current->container;
549 current->container->type == type)) {
550 return current->container;
551 }
552 parent = parent->parent;
553 } 549 }
554 } 550 }
555 551