diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-03-14 11:43:39 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-14 10:03:45 -0600 |
commit | d8f74e4706104ac751706d5071838f97e3956a5e (patch) | |
tree | e502fbd08807d6a32b782fe48345d2cd39be56a6 /sway/input/seat.c | |
parent | swaybar: fix loading of malformed icon theme (diff) | |
download | sway-d8f74e4706104ac751706d5071838f97e3956a5e.tar.gz sway-d8f74e4706104ac751706d5071838f97e3956a5e.tar.zst sway-d8f74e4706104ac751706d5071838f97e3956a5e.zip |
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
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r-- | sway/input/seat.c | 12 |
1 files changed, 12 insertions, 0 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 | } |