diff options
-rw-r--r-- | include/sway/input/seat.h | 7 | ||||
-rw-r--r-- | sway/input/seat.c | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 05fff6f7..308f5c6d 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -94,6 +94,13 @@ struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, | |||
94 | struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat, | 94 | struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat, |
95 | struct sway_container *container); | 95 | struct sway_container *container); |
96 | 96 | ||
97 | /** | ||
98 | * Iterate over the focus-inactive children of the container calling the function on each. | ||
99 | */ | ||
100 | void seat_focus_inactive_children_for_each(struct sway_seat *seat, | ||
101 | struct sway_container *container, | ||
102 | void (*f)(struct sway_container *container, void *data), void *data); | ||
103 | |||
97 | void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config); | 104 | void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config); |
98 | 105 | ||
99 | struct seat_config *seat_get_config(struct sway_seat *seat); | 106 | struct seat_config *seat_get_config(struct sway_seat *seat); |
diff --git a/sway/input/seat.c b/sway/input/seat.c index 1a646715..3656d6b6 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -106,6 +106,20 @@ static struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, | |||
106 | return NULL; | 106 | return NULL; |
107 | } | 107 | } |
108 | 108 | ||
109 | void seat_focus_inactive_children_for_each(struct sway_seat *seat, | ||
110 | struct sway_container *container, | ||
111 | void (*f)(struct sway_container *container, void *data), void *data) { | ||
112 | struct sway_seat_container *current = NULL; | ||
113 | wl_list_for_each(current, &seat->focus_stack, link) { | ||
114 | if (current->container->parent == NULL) { | ||
115 | continue; | ||
116 | } | ||
117 | if (current->container->parent == container) { | ||
118 | f(current->container, data); | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | |||
109 | struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat, | 123 | struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat, |
110 | struct sway_container *container) { | 124 | struct sway_container *container) { |
111 | return seat_get_focus_by_type(seat, container, C_VIEW); | 125 | return seat_get_focus_by_type(seat, container, C_VIEW); |