diff options
author | Ryan Dwyer <RyanDwyer@users.noreply.github.com> | 2018-06-07 09:47:37 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-07 09:47:37 +1000 |
commit | 22c1c4beb4baa369f883fb5360c40158513c8e10 (patch) | |
tree | 2f872b9cca4dedb5f1f0072a1126d3ab88c4511f | |
parent | b1e72461cf800625061b44fb65e392f57455c8fb (diff) | |
parent | 82b3b587dd2b64117f4b138437b5ac29bda19fe8 (diff) |
Merge pull request #2116 from RedSoxFan/fix-2113
Fix focusing after splitting tabs/stacks
-rw-r--r-- | sway/tree/layout.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 79e7c87e..82502e1b 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c @@ -874,11 +874,10 @@ struct sway_container *container_split(struct sway_container *child, cont->x = child->x; cont->y = child->y; + struct sway_seat *seat = input_manager_get_default_seat(input_manager); + bool set_focus = (seat_get_focus(seat) == child); if (child->type == C_WORKSPACE) { - struct sway_seat *seat = input_manager_get_default_seat(input_manager); struct sway_container *workspace = child; - bool set_focus = (seat_get_focus(seat) == workspace); - while (workspace->children->length) { struct sway_container *ws_child = workspace->children->items[0]; container_remove_child(ws_child); @@ -890,10 +889,6 @@ struct sway_container *container_split(struct sway_container *child, enum sway_container_layout old_layout = workspace->layout; workspace->layout = layout; cont->layout = old_layout; - - if (set_focus) { - seat_set_focus(seat, cont); - } } else { struct sway_container *old_parent = child->parent; cont->layout = layout; @@ -902,6 +897,11 @@ struct sway_container *container_split(struct sway_container *child, wl_signal_emit(&child->events.reparent, old_parent); } + if (set_focus) { + seat_set_focus(seat, cont); + seat_set_focus(seat, child); + } + container_notify_subtree_changed(cont); return cont; |