summaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c12
-rw-r--r--sway/tree/layout.c10
2 files changed, 14 insertions, 8 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index bd9f1edf..8fc9e3e8 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -53,10 +53,16 @@ const char *container_type_to_str(enum sway_container_type type) {
53void container_create_notify(struct sway_container *container) { 53void container_create_notify(struct sway_container *container) {
54 // TODO send ipc event type based on the container type 54 // TODO send ipc event type based on the container type
55 wl_signal_emit(&root_container.sway_root->events.new_container, container); 55 wl_signal_emit(&root_container.sway_root->events.new_container, container);
56 ipc_event_window(container, "new"); 56
57 if (container->type == C_VIEW || container->type == C_CONTAINER) {
58 ipc_event_window(container, "new");
59 }
57} 60}
58 61
59static void container_close_notify(struct sway_container *container) { 62static void container_close_notify(struct sway_container *container) {
63 if (container == NULL) {
64 return;
65 }
60 // TODO send ipc event type based on the container type 66 // TODO send ipc event type based on the container type
61 ipc_event_window(container, "close"); 67 ipc_event_window(container, "close");
62} 68}
@@ -506,8 +512,8 @@ static bool find_child_func(struct sway_container *con, void *data) {
506 512
507bool container_has_child(struct sway_container *con, 513bool container_has_child(struct sway_container *con,
508 struct sway_container *child) { 514 struct sway_container *child) {
509 if (child == NULL || child->type == C_VIEW || 515 if (con == NULL || con->type == C_VIEW ||
510 child->children->length == 0) { 516 con->children->length == 0) {
511 return false; 517 return false;
512 } 518 }
513 return container_find(con, find_child_func, child); 519 return container_find(con, find_child_func, child);
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 5abdbc32..1769609b 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -638,16 +638,16 @@ struct sway_container *container_get_in_direction(
638 wrap_candidate = parent->children->items[0]; 638 wrap_candidate = parent->children->items[0];
639 } 639 }
640 if (config->force_focus_wrapping) { 640 if (config->force_focus_wrapping) {
641 return seat_get_focus_by_type(seat, 641 return wrap_candidate;
642 wrap_candidate, C_VIEW);
643 } 642 }
644 } 643 }
645 } else { 644 } else {
645 struct sway_container *desired_con = parent->children->items[desired];
646 wlr_log(L_DEBUG, 646 wlr_log(L_DEBUG,
647 "cont %d-%p dir %i sibling %d: %p", idx, 647 "cont %d-%p dir %i sibling %d: %p", idx,
648 container, dir, desired, parent->children->items[desired]); 648 container, dir, desired, desired_con);
649 return seat_get_focus_by_type(seat, 649 struct sway_container *next = seat_get_focus_by_type(seat, desired_con, C_VIEW);
650 parent->children->items[desired], C_VIEW); 650 return next;
651 } 651 }
652 } 652 }
653 653