diff options
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 48aabd86..67fac5ee 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -158,12 +158,13 @@ swayc_t *new_output(struct sway_output *sway_output) { | |||
158 | // struct instead of trying to do focus semantics like this | 158 | // struct instead of trying to do focus semantics like this |
159 | struct sway_seat *seat = NULL; | 159 | struct sway_seat *seat = NULL; |
160 | wl_list_for_each(seat, &input_manager->seats, link) { | 160 | wl_list_for_each(seat, &input_manager->seats, link) { |
161 | if (!seat->focus) { | 161 | if (!seat->has_focus) { |
162 | seat->focus = ws; | 162 | sway_seat_set_focus(seat, ws); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | free(ws_name); | 166 | free(ws_name); |
167 | wl_signal_emit(&root_container.sway_root->events.new_container, output); | ||
167 | return output; | 168 | return output; |
168 | } | 169 | } |
169 | 170 | ||
@@ -185,6 +186,7 @@ swayc_t *new_workspace(swayc_t *output, const char *name) { | |||
185 | 186 | ||
186 | add_child(output, workspace); | 187 | add_child(output, workspace); |
187 | sort_workspaces(output); | 188 | sort_workspaces(output); |
189 | wl_signal_emit(&root_container.sway_root->events.new_container, workspace); | ||
188 | return workspace; | 190 | return workspace; |
189 | } | 191 | } |
190 | 192 | ||
@@ -207,9 +209,9 @@ swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view) { | |||
207 | add_child(sibling, swayc); | 209 | add_child(sibling, swayc); |
208 | } else { | 210 | } else { |
209 | // Regular case, create as sibling of current container | 211 | // Regular case, create as sibling of current container |
210 | // TODO WLR | 212 | add_sibling(sibling, swayc); |
211 | //add_sibling(sibling, swayc); | ||
212 | } | 213 | } |
214 | wl_signal_emit(&root_container.sway_root->events.new_container, swayc); | ||
213 | return swayc; | 215 | return swayc; |
214 | } | 216 | } |
215 | 217 | ||
@@ -378,3 +380,26 @@ void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), voi | |||
378 | f(container, data); | 380 | f(container, data); |
379 | } | 381 | } |
380 | } | 382 | } |
383 | |||
384 | /** | ||
385 | * Get a list of containers that are descendents of the container in rendering | ||
386 | * order | ||
387 | */ | ||
388 | list_t *container_list_children(swayc_t *con) { | ||
389 | list_t *list = create_list(); | ||
390 | list_t *queue = create_list(); | ||
391 | |||
392 | list_add(queue, con); | ||
393 | |||
394 | swayc_t *current = NULL; | ||
395 | while (queue->length) { | ||
396 | current = queue->items[0]; | ||
397 | list_del(queue, 0); | ||
398 | list_add(list, current); | ||
399 | // TODO floating containers | ||
400 | list_cat(queue, current->children); | ||
401 | } | ||
402 | |||
403 | list_free(queue); | ||
404 | return list; | ||
405 | } | ||