aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 23c630b6..ce5b425c 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -63,9 +63,10 @@ static bool _workspace_by_name(swayc_t *view, void *data) {
63swayc_t *workspace_by_name(const char *name) { 63swayc_t *workspace_by_name(const char *name) {
64 struct sway_seat *seat = input_manager_current_seat(input_manager); 64 struct sway_seat *seat = input_manager_current_seat(input_manager);
65 swayc_t *current_workspace = NULL, *current_output = NULL; 65 swayc_t *current_workspace = NULL, *current_output = NULL;
66 if (seat->focus) { 66 if (seat->has_focus) {
67 current_workspace = swayc_parent_by_type(seat->focus, C_WORKSPACE); 67 swayc_t *focus = sway_seat_get_focus(seat, &root_container);
68 current_output = swayc_parent_by_type(seat->focus, C_OUTPUT); 68 current_workspace = swayc_parent_by_type(focus, C_WORKSPACE);
69 current_output = swayc_parent_by_type(focus, C_OUTPUT);
69 } 70 }
70 if (strcmp(name, "prev") == 0) { 71 if (strcmp(name, "prev") == 0) {
71 return workspace_prev(current_workspace); 72 return workspace_prev(current_workspace);
@@ -102,7 +103,8 @@ swayc_t *workspace_create(const char *name) {
102 } 103 }
103 // Otherwise create a new one 104 // Otherwise create a new one
104 struct sway_seat *seat = input_manager_current_seat(input_manager); 105 struct sway_seat *seat = input_manager_current_seat(input_manager);
105 parent = seat->focus; 106 swayc_t *focus = sway_seat_get_focus(seat, &root_container);
107 parent = focus;
106 parent = swayc_parent_by_type(parent, C_OUTPUT); 108 parent = swayc_parent_by_type(parent, C_OUTPUT);
107 return new_workspace(parent, name); 109 return new_workspace(parent, name);
108} 110}
@@ -193,12 +195,13 @@ bool workspace_switch(swayc_t *workspace) {
193 return false; 195 return false;
194 } 196 }
195 struct sway_seat *seat = input_manager_current_seat(input_manager); 197 struct sway_seat *seat = input_manager_current_seat(input_manager);
196 if (!seat || !seat->focus) { 198 swayc_t *focus = sway_seat_get_focus(seat, &root_container);
199 if (!seat || !focus) {
197 return false; 200 return false;
198 } 201 }
199 swayc_t *active_ws = seat->focus; 202 swayc_t *active_ws = focus;
200 if (active_ws->type != C_WORKSPACE) { 203 if (active_ws->type != C_WORKSPACE) {
201 swayc_parent_by_type(seat->focus, C_WORKSPACE); 204 swayc_parent_by_type(focus, C_WORKSPACE);
202 } 205 }
203 206
204 if (config->auto_back_and_forth 207 if (config->auto_back_and_forth