aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/input/seat.c4
-rw-r--r--sway/tree/workspace.c14
2 files changed, 14 insertions, 4 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 18664d7c..df48b751 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -725,6 +725,10 @@ void seat_set_raw_focus(struct sway_seat *seat, struct sway_node *node) {
725 725
726void seat_set_focus(struct sway_seat *seat, struct sway_node *node) { 726void seat_set_focus(struct sway_seat *seat, struct sway_node *node) {
727 if (seat->focused_layer) { 727 if (seat->focused_layer) {
728 struct wlr_layer_surface_v1 *layer = seat->focused_layer;
729 seat_set_focus_layer(seat, NULL);
730 seat_set_focus(seat, node);
731 seat_set_focus_layer(seat, layer);
728 return; 732 return;
729 } 733 }
730 734
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index b9780922..cda6caf7 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -451,9 +451,15 @@ struct sway_workspace *workspace_prev(struct sway_workspace *current) {
451bool workspace_switch(struct sway_workspace *workspace, 451bool workspace_switch(struct sway_workspace *workspace,
452 bool no_auto_back_and_forth) { 452 bool no_auto_back_and_forth) {
453 struct sway_seat *seat = input_manager_current_seat(); 453 struct sway_seat *seat = input_manager_current_seat();
454 struct sway_workspace *active_ws = seat_get_focused_workspace(seat); 454 struct sway_workspace *active_ws = NULL;
455 struct sway_node *focus = seat_get_focus_inactive(seat, &root->node);
456 if (focus && focus->type == N_WORKSPACE) {
457 active_ws = focus->sway_workspace;
458 } else if (focus && focus->type == N_CONTAINER) {
459 active_ws = focus->sway_container->workspace;
460 }
455 461
456 if (!no_auto_back_and_forth && config->auto_back_and_forth 462 if (!no_auto_back_and_forth && config->auto_back_and_forth && active_ws
457 && active_ws == workspace && seat->prev_workspace_name) { 463 && active_ws == workspace && seat->prev_workspace_name) {
458 struct sway_workspace *new_ws = 464 struct sway_workspace *new_ws =
459 workspace_by_name(seat->prev_workspace_name); 465 workspace_by_name(seat->prev_workspace_name);
@@ -462,9 +468,9 @@ bool workspace_switch(struct sway_workspace *workspace,
462 workspace_create(NULL, seat->prev_workspace_name); 468 workspace_create(NULL, seat->prev_workspace_name);
463 } 469 }
464 470
465 if (!seat->prev_workspace_name || 471 if (active_ws && (!seat->prev_workspace_name ||
466 (strcmp(seat->prev_workspace_name, active_ws->name) 472 (strcmp(seat->prev_workspace_name, active_ws->name)
467 && active_ws != workspace)) { 473 && active_ws != workspace))) {
468 free(seat->prev_workspace_name); 474 free(seat->prev_workspace_name);
469 seat->prev_workspace_name = malloc(strlen(active_ws->name) + 1); 475 seat->prev_workspace_name = malloc(strlen(active_ws->name) + 1);
470 if (!seat->prev_workspace_name) { 476 if (!seat->prev_workspace_name) {