diff options
-rw-r--r-- | sway/input/seat.c | 12 | ||||
-rw-r--r-- | sway/tree/workspace.c | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index be523539..e56a6510 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -763,6 +763,18 @@ static void set_workspace(struct sway_seat *seat, | |||
763 | if (seat->workspace == new_ws) { | 763 | if (seat->workspace == new_ws) { |
764 | return; | 764 | return; |
765 | } | 765 | } |
766 | |||
767 | if (seat->workspace) { | ||
768 | free(seat->prev_workspace_name); | ||
769 | seat->prev_workspace_name = malloc(strlen(seat->workspace->name) + 1); | ||
770 | if (!seat->prev_workspace_name) { | ||
771 | sway_log(SWAY_ERROR, "Unable to allocate previous workspace name"); | ||
772 | seat->prev_workspace_name = NULL; | ||
773 | } else { | ||
774 | strcpy(seat->prev_workspace_name, seat->workspace->name); | ||
775 | } | ||
776 | } | ||
777 | |||
766 | ipc_event_workspace(seat->workspace, new_ws, "focus"); | 778 | ipc_event_workspace(seat->workspace, new_ws, "focus"); |
767 | seat->workspace = new_ws; | 779 | seat->workspace = new_ws; |
768 | } | 780 | } |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 5e28197b..68a55e03 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -481,18 +481,6 @@ bool workspace_switch(struct sway_workspace *workspace, | |||
481 | workspace_create(NULL, seat->prev_workspace_name); | 481 | workspace_create(NULL, seat->prev_workspace_name); |
482 | } | 482 | } |
483 | 483 | ||
484 | if (active_ws && (!seat->prev_workspace_name || | ||
485 | (strcmp(seat->prev_workspace_name, active_ws->name) | ||
486 | && active_ws != workspace))) { | ||
487 | free(seat->prev_workspace_name); | ||
488 | seat->prev_workspace_name = malloc(strlen(active_ws->name) + 1); | ||
489 | if (!seat->prev_workspace_name) { | ||
490 | sway_log(SWAY_ERROR, "Unable to allocate previous workspace name"); | ||
491 | return false; | ||
492 | } | ||
493 | strcpy(seat->prev_workspace_name, active_ws->name); | ||
494 | } | ||
495 | |||
496 | sway_log(SWAY_DEBUG, "Switching to workspace %p:%s", | 484 | sway_log(SWAY_DEBUG, "Switching to workspace %p:%s", |
497 | workspace, workspace->name); | 485 | workspace, workspace->name); |
498 | struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node); | 486 | struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node); |