aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-02-04 13:39:10 -0500
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-02-04 14:08:54 -0500
commit515150229847c9ebdfd0cabb6f0026fca9d57a23 (patch)
tree8a50ce0ac8ce4dc2ec973c63c68dc45378c50737 /sway/tree/container.c
parentImplement workspaces (diff)
downloadsway-515150229847c9ebdfd0cabb6f0026fca9d57a23.tar.gz
sway-515150229847c9ebdfd0cabb6f0026fca9d57a23.tar.zst
sway-515150229847c9ebdfd0cabb6f0026fca9d57a23.zip
basic focus overhaul
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c33
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 */
388list_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}