diff options
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 23 | ||||
-rw-r--r-- | sway/tree/output.c | 9 |
2 files changed, 27 insertions, 5 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 58fd4898..04454ab6 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -476,10 +476,11 @@ struct sway_container *container_at(struct sway_container *workspace, return NULL; } struct sway_container *c; - // Focused view's popups struct sway_seat *seat = input_manager_current_seat(input_manager); struct sway_container *focus = seat_get_focus_inactive(seat, &root_container); + bool is_floating = focus && container_is_floating_or_child(focus); + // Focused view's popups if (focus && focus->type == C_VIEW) { surface_at_view(focus, lx, ly, surface, sx, sy); if (*surface && surface_is_popup(*surface)) { @@ -487,11 +488,27 @@ struct sway_container *container_at(struct sway_container *workspace, } *surface = NULL; } - // Floating + // If focused is floating, focused view's non-popups + if (focus && focus->type == C_VIEW && is_floating) { + surface_at_view(focus, lx, ly, surface, sx, sy); + if (*surface) { + return focus; + } + *surface = NULL; + } + // Floating (non-focused) if ((c = floating_container_at(lx, ly, surface, sx, sy))) { return c; } - // Tiling + // If focused is tiling, focused view's non-popups + if (focus && focus->type == C_VIEW && !is_floating) { + surface_at_view(focus, lx, ly, surface, sx, sy); + if (*surface) { + return focus; + } + *surface = NULL; + } + // Tiling (non-focused) if ((c = tiling_container_at(workspace, lx, ly, surface, sx, sy))) { return c; } diff --git a/sway/tree/output.c b/sway/tree/output.c index bfc9c723..6601220b 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -128,14 +128,19 @@ static void output_evacuate(struct sway_container *output) { while (output->children->length) { struct sway_container *workspace = output->children->items[0]; + container_remove_child(workspace); + + if (workspace_is_empty(workspace)) { + workspace_begin_destroy(workspace); + continue; + } + struct sway_container *new_output = workspace_output_get_highest_available(workspace, output); if (!new_output) { new_output = fallback_output; } - container_remove_child(workspace); - if (new_output) { workspace_output_add_priority(workspace, new_output); container_add_child(new_output, workspace); |