diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2019-02-10 20:12:51 -0500 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2019-02-10 20:12:51 -0500 |
| commit | 2695b6a3394bcf37863d39f2ef93ac62a8d7b0cb (patch) | |
| tree | 3500b7c5b1fe18b8dd9d5064362444bcc3f9ce6e | |
| parent | c8373736006c243e1e634ba42452f4fa092ca964 (diff) | |
workspace_get_initial_output: handle focused layer1.0-rc2
When a layer surface is focused, `seat_get_focused_workspace` will be
NULL. This changes `workspace_get_initial_output` to use output of the
focus inactive. If the focus inactive is also NULL, then either the
first output or the noop output will be used as fallbacks.
| -rw-r--r-- | sway/tree/workspace.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 8b3eb2ad..b9780922 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -42,10 +42,16 @@ struct sway_output *workspace_get_initial_output(const char *name) { } } } - // Otherwise put it on the focused output + // Otherwise try to put it on the focused output struct sway_seat *seat = input_manager_current_seat(); - struct sway_workspace *focus = seat_get_focused_workspace(seat); - return focus->output; + struct sway_node *focus = seat_get_focus_inactive(seat, &root->node); + if (focus && focus->type == N_WORKSPACE) { + return focus->sway_workspace->output; + } else if (focus && focus->type == N_CONTAINER) { + return focus->sway_container->workspace->output; + } + // Fallback to the first output or noop output for headless + return root->outputs->length ? root->outputs->items[0] : root->noop_output; } static void prevent_invalid_outer_gaps(struct sway_workspace *ws) { |
