diff options
-rw-r--r-- | sway/tree/output.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c index 4dc22755..f15a84b3 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c | |||
@@ -152,18 +152,21 @@ void output_enable(struct sway_output *output) { | |||
152 | arrange_root(); | 152 | arrange_root(); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void evacuate_sticky(struct sway_container *con, void *data) { | 155 | static void evacuate_sticky(struct sway_workspace *old_ws, |
156 | if (container_is_floating(con) && con->is_sticky) { | 156 | struct sway_output *new_output) { |
157 | struct sway_workspace *new_ws = data; | 157 | struct sway_workspace *new_ws = output_get_active_workspace(new_output); |
158 | if (!sway_assert(new_ws, "Expected workspace to not be null")) { | 158 | if (!sway_assert(new_ws, "New output does not have a workspace")) { |
159 | return; | 159 | return; |
160 | } | 160 | } |
161 | container_detach(con); | 161 | while(old_ws->floating->length) { |
162 | workspace_add_floating(new_ws, con); | 162 | struct sway_container *sticky = old_ws->floating->items[0]; |
163 | container_handle_fullscreen_reparent(con); | 163 | container_detach(sticky); |
164 | container_floating_move_to_center(con); | 164 | workspace_add_floating(new_ws, sticky); |
165 | ipc_event_window(con, "move"); | 165 | container_handle_fullscreen_reparent(sticky); |
166 | container_floating_move_to_center(sticky); | ||
167 | ipc_event_window(sticky, "move"); | ||
166 | } | 168 | } |
169 | workspace_detect_urgent(new_ws); | ||
167 | } | 170 | } |
168 | 171 | ||
169 | static void output_evacuate(struct sway_output *output) { | 172 | static void output_evacuate(struct sway_output *output) { |
@@ -198,10 +201,9 @@ static void output_evacuate(struct sway_output *output) { | |||
198 | if (workspace_is_empty(workspace)) { | 201 | if (workspace_is_empty(workspace)) { |
199 | // If the new output has an active workspace (the noop output may | 202 | // If the new output has an active workspace (the noop output may |
200 | // not have one), move all sticky containers to it | 203 | // not have one), move all sticky containers to it |
201 | if (new_output_ws) { | 204 | if (new_output_ws && |
202 | workspace_for_each_container(workspace, evacuate_sticky, | 205 | workspace_num_sticky_containers(workspace) > 0) { |
203 | new_output_ws); | 206 | evacuate_sticky(workspace, new_output); |
204 | workspace_detect_urgent(new_output_ws); | ||
205 | } | 207 | } |
206 | 208 | ||
207 | if (workspace_num_sticky_containers(workspace) == 0) { | 209 | if (workspace_num_sticky_containers(workspace) == 0) { |