diff options
| author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-13 19:15:04 +1000 | 
|---|---|---|
| committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-13 19:15:04 +1000 | 
| commit | 9190735947947f5afa21f725cfe0569abde946aa (patch) | |
| tree | 1b206c8e09ff9e084f92981e8d01b2aab8a5e42e /sway | |
| parent | b80cf982ae5151775a11a2b579eae41ffa9d3e14 (diff) | |
| download | sway-9190735947947f5afa21f725cfe0569abde946aa.tar.xz | |
Fix crash when view maps while locked
When locked, there is no active workspace so it must find the
focus_inactive workspace instead.
Additionally, this adds a check for if a view maps while there are no
outputs connected and handles it gracefully.
Diffstat (limited to 'sway')
| -rw-r--r-- | sway/tree/arrange.c | 4 | ||||
| -rw-r--r-- | sway/tree/view.c | 11 | 
2 files changed, 14 insertions, 1 deletions
| diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index 373460a2..852d53bf 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -180,6 +180,10 @@ void arrange_workspace(struct sway_workspace *workspace) {  	if (config->reloading) {  		return;  	} +	if (!workspace->output) { +		// Happens when there are no outputs connected +		return; +	}  	struct sway_output *output = workspace->output;  	struct wlr_box *area = &output->usable_area;  	wlr_log(WLR_DEBUG, "Usable area for ws: %dx%d@%d,%d", diff --git a/sway/tree/view.c b/sway/tree/view.c index e613ac0b..1104af36 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -504,7 +504,16 @@ static struct sway_workspace *select_workspace(struct sway_view *view) {  	}  	// Use the focused workspace -	return seat_get_focused_workspace(seat); +	struct sway_node *node = seat_get_focus_inactive(seat, &root->node); +	if (node && node->type == N_WORKSPACE) { +		return node->sway_workspace; +	} else if (node && node->type == N_CONTAINER) { +		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];  }  static bool should_focus(struct sway_view *view) { | 
