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 | Merge pull request #2110 from smlx/initialise-cursor-previous (diff) | |
parent | Remove tab/stack check for focusing after a split (diff) | |
download | sway-22c1c4beb4baa369f883fb5360c40158513c8e10.tar.gz sway-22c1c4beb4baa369f883fb5360c40158513c8e10.tar.zst sway-22c1c4beb4baa369f883fb5360c40158513c8e10.zip |
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, | |||
874 | cont->x = child->x; | 874 | cont->x = child->x; |
875 | cont->y = child->y; | 875 | cont->y = child->y; |
876 | 876 | ||
877 | struct sway_seat *seat = input_manager_get_default_seat(input_manager); | ||
878 | bool set_focus = (seat_get_focus(seat) == child); | ||
877 | if (child->type == C_WORKSPACE) { | 879 | if (child->type == C_WORKSPACE) { |
878 | struct sway_seat *seat = input_manager_get_default_seat(input_manager); | ||
879 | struct sway_container *workspace = child; | 880 | struct sway_container *workspace = child; |
880 | bool set_focus = (seat_get_focus(seat) == workspace); | ||
881 | |||
882 | while (workspace->children->length) { | 881 | while (workspace->children->length) { |
883 | struct sway_container *ws_child = workspace->children->items[0]; | 882 | struct sway_container *ws_child = workspace->children->items[0]; |
884 | container_remove_child(ws_child); | 883 | container_remove_child(ws_child); |
@@ -890,10 +889,6 @@ struct sway_container *container_split(struct sway_container *child, | |||
890 | enum sway_container_layout old_layout = workspace->layout; | 889 | enum sway_container_layout old_layout = workspace->layout; |
891 | workspace->layout = layout; | 890 | workspace->layout = layout; |
892 | cont->layout = old_layout; | 891 | cont->layout = old_layout; |
893 | |||
894 | if (set_focus) { | ||
895 | seat_set_focus(seat, cont); | ||
896 | } | ||
897 | } else { | 892 | } else { |
898 | struct sway_container *old_parent = child->parent; | 893 | struct sway_container *old_parent = child->parent; |
899 | cont->layout = layout; | 894 | cont->layout = layout; |
@@ -902,6 +897,11 @@ struct sway_container *container_split(struct sway_container *child, | |||
902 | wl_signal_emit(&child->events.reparent, old_parent); | 897 | wl_signal_emit(&child->events.reparent, old_parent); |
903 | } | 898 | } |
904 | 899 | ||
900 | if (set_focus) { | ||
901 | seat_set_focus(seat, cont); | ||
902 | seat_set_focus(seat, child); | ||
903 | } | ||
904 | |||
905 | container_notify_subtree_changed(cont); | 905 | container_notify_subtree_changed(cont); |
906 | 906 | ||
907 | return cont; | 907 | return cont; |