Fix focus related crashes

* seat_set_focus_warp lacked a container NULL check
* view mapping code needs to use seat_get_focus_inactive

Also, seat_set_focus_warp triggered the wrong IPC event if focus was a
workspace, which resulted in swaybar not showing the workspace as
active.
This commit is contained in:
Ryan Dwyer 2018-08-02 21:55:37 +10:00
parent d6095588a1
commit 9339026a31
2 changed files with 9 additions and 4 deletions

View file

@ -775,8 +775,12 @@ void seat_set_focus_warp(struct sway_seat *seat,
}
}
if (container->type == C_VIEW) {
ipc_event_window(container, "focus");
if (container) {
if (container->type == C_VIEW) {
ipc_event_window(container, "focus");
} else if (container->type == C_WORKSPACE) {
ipc_event_workspace(NULL, container, "focus");
}
}
seat->has_focus = (container != NULL);