aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-08-02 08:07:40 -0400
committerGitHub <noreply@github.com>2018-08-02 08:07:40 -0400
commiteec25ce60e17590c9c5c2004b9d133692131d65d (patch)
tree58431502a51ee0fa759fffb763772be7f9d9a308
parente2eaf7b9b521e67d38d24b5f8a38fee84c9295a2 (diff)
parent9339026a31103b453545cf65cd45f345e44d0437 (diff)
downloadsway-eec25ce60e17590c9c5c2004b9d133692131d65d.zip
sway-eec25ce60e17590c9c5c2004b9d133692131d65d.tar.gz
sway-eec25ce60e17590c9c5c2004b9d133692131d65d.tar.bz2
Merge pull request #2406 from RyanDwyer/fix-focus-crashes
Fix focus related crashes
-rw-r--r--sway/input/seat.c8
-rw-r--r--sway/tree/view.c5
2 files changed, 9 insertions, 4 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 869560a..dd4d5c3 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -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);
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 051b93c..97318da 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) {
}
// Use the focused workspace
- ws = seat_get_focus(seat);
+ ws = seat_get_focus_inactive(seat, &root_container);
if (ws->type != C_WORKSPACE) {
ws = container_parent(ws, C_WORKSPACE);
}
@@ -505,7 +505,8 @@ static struct sway_container *select_workspace(struct sway_view *view) {
static bool should_focus(struct sway_view *view) {
struct sway_seat *seat = input_manager_current_seat(input_manager);
- struct sway_container *prev_focus = seat_get_focus(seat);
+ struct sway_container *prev_focus =
+ seat_get_focus_inactive(seat, &root_container);
struct sway_container *prev_ws = prev_focus->type == C_WORKSPACE ?
prev_focus : container_parent(prev_focus, C_WORKSPACE);
struct sway_container *map_ws = container_parent(view->swayc, C_WORKSPACE);