summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-08-02 08:07:40 -0400
committerLibravatar GitHub <noreply@github.com>2018-08-02 08:07:40 -0400
commiteec25ce60e17590c9c5c2004b9d133692131d65d (patch)
tree58431502a51ee0fa759fffb763772be7f9d9a308
parentMerge pull request #2405 from marienz/sigmask (diff)
parentFix focus related crashes (diff)
downloadsway-eec25ce60e17590c9c5c2004b9d133692131d65d.tar.gz
sway-eec25ce60e17590c9c5c2004b9d133692131d65d.tar.zst
sway-eec25ce60e17590c9c5c2004b9d133692131d65d.zip
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 869560af..dd4d5c3b 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -775,8 +775,12 @@ void seat_set_focus_warp(struct sway_seat *seat,
775 } 775 }
776 } 776 }
777 777
778 if (container->type == C_VIEW) { 778 if (container) {
779 ipc_event_window(container, "focus"); 779 if (container->type == C_VIEW) {
780 ipc_event_window(container, "focus");
781 } else if (container->type == C_WORKSPACE) {
782 ipc_event_workspace(NULL, container, "focus");
783 }
780 } 784 }
781 785
782 seat->has_focus = (container != NULL); 786 seat->has_focus = (container != NULL);
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
506static bool should_focus(struct sway_view *view) { 506static 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);