Use noop output when there's no outputs connected

Instead of having NULL workspace->output pointers, use a noop output.
This should be safer.
This commit is contained in:
Ryan Dwyer 2019-01-17 20:16:23 +10:00 committed by emersion
parent ab0248a545
commit 2301349ad5
8 changed files with 29 additions and 28 deletions

View file

@ -518,9 +518,10 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {
return node->sway_container->workspace;
}
// If there's no focus_inactive workspace then we must be running without
// any outputs connected
return root->saved_workspaces->items[0];
// When there's no outputs connected, the above should match a workspace on
// the noop output.
sway_assert(false, "Expected to find a workspace");
return NULL;
}
static bool should_focus(struct sway_view *view) {