From d8f74e4706104ac751706d5071838f97e3956a5e Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Thu, 14 Mar 2019 11:43:39 -0400 Subject: Set prev_workspace_name based off of focus This moves setting `seat->prev_workspace_name` from `workspace_switch` to `set_workspace`. `workspace_switch` is only called when using a `workspace` command to change the workspace so any workspace change based on criteria was not altering `seat->prev_workspace_name`. By moving it to `set_workspace`, which is called by `seat_set_focus`, it will change any time focus changes to a node on a different workspace --- sway/tree/workspace.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'sway/tree/workspace.c') 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, workspace_create(NULL, seat->prev_workspace_name); } - if (active_ws && (!seat->prev_workspace_name || - (strcmp(seat->prev_workspace_name, active_ws->name) - && active_ws != workspace))) { - free(seat->prev_workspace_name); - seat->prev_workspace_name = malloc(strlen(active_ws->name) + 1); - if (!seat->prev_workspace_name) { - sway_log(SWAY_ERROR, "Unable to allocate previous workspace name"); - return false; - } - strcpy(seat->prev_workspace_name, active_ws->name); - } - sway_log(SWAY_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name); struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node); -- cgit v1.2.3-54-g00ecf