diff options
author | 2018-09-16 10:22:01 -0400 | |
---|---|---|
committer | 2018-09-16 10:22:01 -0400 | |
commit | 456b91600d73edb3187c170eb6720b1c3212351c (patch) | |
tree | 318401a7a3c0e8f778d45e4ea26f5517e05191fa /sway | |
parent | Merge pull request #2641 from marienz/inhibit-crash (diff) | |
parent | Rename seat_get_active_child to seat_get_active_tiling_child (diff) | |
download | sway-456b91600d73edb3187c170eb6720b1c3212351c.tar.gz sway-456b91600d73edb3187c170eb6720b1c3212351c.tar.zst sway-456b91600d73edb3187c170eb6720b1c3212351c.zip |
Merge pull request #2637 from RyanDwyer/fix-tabbed-workspace-shenanigans
Make seat_get_active_child ignore floating children
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands/focus.c | 2 | ||||
-rw-r--r-- | sway/commands/move.c | 2 | ||||
-rw-r--r-- | sway/desktop/output.c | 2 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 3 | ||||
-rw-r--r-- | sway/input/seat.c | 14 | ||||
-rw-r--r-- | sway/tree/container.c | 4 | ||||
-rw-r--r-- | sway/tree/view.c | 14 |
7 files changed, 25 insertions, 16 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index d63077e6..44adb95b 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c | |||
@@ -261,7 +261,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { | |||
261 | } | 261 | } |
262 | 262 | ||
263 | if (direction == MOVE_CHILD) { | 263 | if (direction == MOVE_CHILD) { |
264 | struct sway_node *focus = seat_get_active_child(seat, node); | 264 | struct sway_node *focus = seat_get_active_tiling_child(seat, node); |
265 | if (focus) { | 265 | if (focus) { |
266 | seat_set_focus(seat, focus); | 266 | seat_set_focus(seat, focus); |
267 | cursor_send_pointer_motion(seat->cursor, 0, true); | 267 | cursor_send_pointer_motion(seat->cursor, 0, true); |
diff --git a/sway/commands/move.c b/sway/commands/move.c index 8f0ef230..42b305d1 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -149,7 +149,7 @@ static void container_move_to_container_from_direction( | |||
149 | } | 149 | } |
150 | 150 | ||
151 | wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)"); | 151 | wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)"); |
152 | struct sway_node *focus_inactive = seat_get_active_child( | 152 | struct sway_node *focus_inactive = seat_get_active_tiling_child( |
153 | config->handler_context.seat, &destination->node); | 153 | config->handler_context.seat, &destination->node); |
154 | if (!focus_inactive || focus_inactive == &destination->node) { | 154 | if (!focus_inactive || focus_inactive == &destination->node) { |
155 | // The container has no children | 155 | // The container has no children |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index a5db15cd..cfb5a710 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -232,7 +232,7 @@ static void scale_box(struct wlr_box *box, float scale) { | |||
232 | 232 | ||
233 | struct sway_workspace *output_get_active_workspace(struct sway_output *output) { | 233 | struct sway_workspace *output_get_active_workspace(struct sway_output *output) { |
234 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 234 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
235 | struct sway_node *focus = seat_get_active_child(seat, &output->node); | 235 | struct sway_node *focus = seat_get_active_tiling_child(seat, &output->node); |
236 | if (!focus) { | 236 | if (!focus) { |
237 | return output->workspaces->items[0]; | 237 | return output->workspaces->items[0]; |
238 | } | 238 | } |
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index b4eec933..d747e279 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -176,7 +176,8 @@ static void copy_container_state(struct sway_container *container, | |||
176 | state->focused = seat_get_focus(seat) == &container->node; | 176 | state->focused = seat_get_focus(seat) == &container->node; |
177 | 177 | ||
178 | if (!container->view) { | 178 | if (!container->view) { |
179 | struct sway_node *focus = seat_get_active_child(seat, &container->node); | 179 | struct sway_node *focus = |
180 | seat_get_active_tiling_child(seat, &container->node); | ||
180 | state->focused_inactive_child = focus ? focus->sway_container : NULL; | 181 | state->focused_inactive_child = focus ? focus->sway_container : NULL; |
181 | } | 182 | } |
182 | } | 183 | } |
diff --git a/sway/input/seat.c b/sway/input/seat.c index ab5047b2..49fe46ba 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -880,7 +880,7 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat, | |||
880 | return NULL; | 880 | return NULL; |
881 | } | 881 | } |
882 | 882 | ||
883 | struct sway_node *seat_get_active_child(struct sway_seat *seat, | 883 | struct sway_node *seat_get_active_tiling_child(struct sway_seat *seat, |
884 | struct sway_node *parent) { | 884 | struct sway_node *parent) { |
885 | if (node_is_view(parent)) { | 885 | if (node_is_view(parent)) { |
886 | return parent; | 886 | return parent; |
@@ -888,9 +888,17 @@ struct sway_node *seat_get_active_child(struct sway_seat *seat, | |||
888 | struct sway_seat_node *current; | 888 | struct sway_seat_node *current; |
889 | wl_list_for_each(current, &seat->focus_stack, link) { | 889 | wl_list_for_each(current, &seat->focus_stack, link) { |
890 | struct sway_node *node = current->node; | 890 | struct sway_node *node = current->node; |
891 | if (node_get_parent(node) == parent) { | 891 | if (node_get_parent(node) != parent) { |
892 | return node; | 892 | continue; |
893 | } | 893 | } |
894 | if (parent->type == N_WORKSPACE) { | ||
895 | // Only consider tiling children | ||
896 | struct sway_workspace *ws = parent->sway_workspace; | ||
897 | if (list_find(ws->tiling, node->sway_container) == -1) { | ||
898 | continue; | ||
899 | } | ||
900 | } | ||
901 | return node; | ||
894 | } | 902 | } |
895 | return NULL; | 903 | return NULL; |
896 | } | 904 | } |
diff --git a/sway/tree/container.c b/sway/tree/container.c index f906449a..47687744 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -220,7 +220,7 @@ static struct sway_container *container_at_tabbed(struct sway_node *parent, | |||
220 | } | 220 | } |
221 | 221 | ||
222 | // Surfaces | 222 | // Surfaces |
223 | struct sway_node *current = seat_get_active_child(seat, parent); | 223 | struct sway_node *current = seat_get_active_tiling_child(seat, parent); |
224 | return current ? tiling_container_at(current, lx, ly, surface, sx, sy) : NULL; | 224 | return current ? tiling_container_at(current, lx, ly, surface, sx, sy) : NULL; |
225 | } | 225 | } |
226 | 226 | ||
@@ -248,7 +248,7 @@ static struct sway_container *container_at_stacked(struct sway_node *parent, | |||
248 | } | 248 | } |
249 | 249 | ||
250 | // Surfaces | 250 | // Surfaces |
251 | struct sway_node *current = seat_get_active_child(seat, parent); | 251 | struct sway_node *current = seat_get_active_tiling_child(seat, parent); |
252 | return current ? tiling_container_at(current, lx, ly, surface, sx, sy) : NULL; | 252 | return current ? tiling_container_at(current, lx, ly, surface, sx, sy) : NULL; |
253 | } | 253 | } |
254 | 254 | ||
diff --git a/sway/tree/view.c b/sway/tree/view.c index 78f85de2..e4e1c161 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -1001,17 +1001,17 @@ bool view_is_visible(struct sway_view *view) { | |||
1001 | bool is_sticky = container_is_floating(floater) && floater->is_sticky; | 1001 | bool is_sticky = container_is_floating(floater) && floater->is_sticky; |
1002 | // Check view isn't in a tabbed or stacked container on an inactive tab | 1002 | // Check view isn't in a tabbed or stacked container on an inactive tab |
1003 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 1003 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
1004 | struct sway_container *container = view->container; | 1004 | struct sway_container *con = view->container; |
1005 | while (container) { | 1005 | while (con) { |
1006 | enum sway_container_layout layout = container_parent_layout(container); | 1006 | enum sway_container_layout layout = container_parent_layout(con); |
1007 | if (layout == L_TABBED || layout == L_STACKED) { | 1007 | if (layout == L_TABBED || layout == L_STACKED) { |
1008 | struct sway_node *parent = container->parent ? | 1008 | struct sway_node *parent = con->parent ? |
1009 | &container->parent->node : &container->workspace->node; | 1009 | &con->parent->node : &con->workspace->node; |
1010 | if (seat_get_active_child(seat, parent) != &container->node) { | 1010 | if (seat_get_active_tiling_child(seat, parent) != &con->node) { |
1011 | return false; | 1011 | return false; |
1012 | } | 1012 | } |
1013 | } | 1013 | } |
1014 | container = container->parent; | 1014 | con = con->parent; |
1015 | } | 1015 | } |
1016 | // Check view isn't hidden by another fullscreen view | 1016 | // Check view isn't hidden by another fullscreen view |
1017 | if (workspace->fullscreen && | 1017 | if (workspace->fullscreen && |