aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-07 16:14:12 -0400
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-07 16:14:12 -0400
commitde811823b60cc33fb6a65c6f1045e9d1fb497243 (patch)
treeb8ef5b4e6da520708a199524d0d5bb40974b67ee
parentseat get focus inactive view (diff)
downloadsway-de811823b60cc33fb6a65c6f1045e9d1fb497243.tar.gz
sway-de811823b60cc33fb6a65c6f1045e9d1fb497243.tar.zst
sway-de811823b60cc33fb6a65c6f1045e9d1fb497243.zip
seat focus inactive children foreach
-rw-r--r--include/sway/input/seat.h7
-rw-r--r--sway/input/seat.c14
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,
94struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat, 94struct 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 */
100void 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
97void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config); 104void seat_apply_config(struct sway_seat *seat, struct seat_config *seat_config);
98 105
99struct seat_config *seat_get_config(struct sway_seat *seat); 106struct 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
109void 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
109struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat, 123struct 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);