aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-13 19:15:04 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-13 19:15:04 +1000
commit9190735947947f5afa21f725cfe0569abde946aa (patch)
tree1b206c8e09ff9e084f92981e8d01b2aab8a5e42e /sway/tree/view.c
parentMerge pull request #2825 from RyanDwyer/fractional-scale-pixel-leaks (diff)
downloadsway-9190735947947f5afa21f725cfe0569abde946aa.tar.gz
sway-9190735947947f5afa21f725cfe0569abde946aa.tar.zst
sway-9190735947947f5afa21f725cfe0569abde946aa.zip
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/tree/view.c')
-rw-r--r--sway/tree/view.c11
1 files changed, 10 insertions, 1 deletions
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) {
504 } 504 }
505 505
506 // Use the focused workspace 506 // Use the focused workspace
507 return seat_get_focused_workspace(seat); 507 struct sway_node *node = seat_get_focus_inactive(seat, &root->node);
508 if (node && node->type == N_WORKSPACE) {
509 return node->sway_workspace;
510 } else if (node && node->type == N_CONTAINER) {
511 return node->sway_container->workspace;
512 }
513
514 // If there's no focus_inactive workspace then we must be running without
515 // any outputs connected
516 return root->saved_workspaces->items[0];
508} 517}
509 518
510static bool should_focus(struct sway_view *view) { 519static bool should_focus(struct sway_view *view) {