diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-02 21:55:37 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-02 21:55:37 +1000 |
commit | 9339026a31103b453545cf65cd45f345e44d0437 (patch) | |
tree | afeaa5fc41b11ac8ef4e1cc0fc31efe6b6f723f5 /sway/tree/view.c | |
parent | Link xcb dependency to meson options "enable_xwayland" (#2393) (diff) | |
download | sway-9339026a31103b453545cf65cd45f345e44d0437.tar.gz sway-9339026a31103b453545cf65cd45f345e44d0437.tar.zst sway-9339026a31103b453545cf65cd45f345e44d0437.zip |
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.
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 051b93ce..97318daa 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -496,7 +496,7 @@ static struct sway_container *select_workspace(struct sway_view *view) { | |||
496 | } | 496 | } |
497 | 497 | ||
498 | // Use the focused workspace | 498 | // Use the focused workspace |
499 | ws = seat_get_focus(seat); | 499 | ws = seat_get_focus_inactive(seat, &root_container); |
500 | if (ws->type != C_WORKSPACE) { | 500 | if (ws->type != C_WORKSPACE) { |
501 | ws = container_parent(ws, C_WORKSPACE); | 501 | ws = container_parent(ws, C_WORKSPACE); |
502 | } | 502 | } |
@@ -505,7 +505,8 @@ static struct sway_container *select_workspace(struct sway_view *view) { | |||
505 | 505 | ||
506 | static bool should_focus(struct sway_view *view) { | 506 | static bool should_focus(struct sway_view *view) { |
507 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 507 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
508 | struct sway_container *prev_focus = seat_get_focus(seat); | 508 | struct sway_container *prev_focus = |
509 | seat_get_focus_inactive(seat, &root_container); | ||
509 | struct sway_container *prev_ws = prev_focus->type == C_WORKSPACE ? | 510 | struct sway_container *prev_ws = prev_focus->type == C_WORKSPACE ? |
510 | prev_focus : container_parent(prev_focus, C_WORKSPACE); | 511 | prev_focus : container_parent(prev_focus, C_WORKSPACE); |
511 | struct sway_container *map_ws = container_parent(view->swayc, C_WORKSPACE); | 512 | struct sway_container *map_ws = container_parent(view->swayc, C_WORKSPACE); |