aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-08-25 09:38:33 -0400
committerLibravatar GitHub <noreply@github.com>2018-08-25 09:38:33 -0400
commitb945957b9bf4508816438186d4ee59dd468160c8 (patch)
treef789e2f6156abbc7662625dffc8cb77b0a4c82d9 /sway/commands
parentMerge pull request #2495 from ianyfan/commands (diff)
parentRelocate container_move, container_move_to and container_get_in_direction (diff)
downloadsway-b945957b9bf4508816438186d4ee59dd468160c8.tar.gz
sway-b945957b9bf4508816438186d4ee59dd468160c8.tar.zst
sway-b945957b9bf4508816438186d4ee59dd468160c8.zip
Merge pull request #2510 from RyanDwyer/relocate-layout-functions
Relocate container_move, container_move_to and container_get_in_direction
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/focus.c193
-rw-r--r--sway/commands/move.c406
-rw-r--r--sway/commands/sticky.c5
3 files changed, 603 insertions, 1 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 6659a683..a9fa9a0f 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -31,6 +31,199 @@ static bool parse_movement_direction(const char *name,
31 return true; 31 return true;
32} 32}
33 33
34/**
35 * Get swayc in the direction of newly entered output.
36 */
37static struct sway_container *get_swayc_in_output_direction(
38 struct sway_container *output, enum movement_direction dir,
39 struct sway_seat *seat) {
40 if (!output) {
41 return NULL;
42 }
43
44 struct sway_container *ws = seat_get_focus_inactive(seat, output);
45 if (ws->type != C_WORKSPACE) {
46 ws = container_parent(ws, C_WORKSPACE);
47 }
48
49 if (ws == NULL) {
50 wlr_log(WLR_ERROR, "got an output without a workspace");
51 return NULL;
52 }
53
54 if (ws->children->length > 0) {
55 switch (dir) {
56 case MOVE_LEFT:
57 if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
58 // get most right child of new output
59 return ws->children->items[ws->children->length-1];
60 } else {
61 return seat_get_focus_inactive(seat, ws);
62 }
63 case MOVE_RIGHT:
64 if (ws->layout == L_HORIZ || ws->layout == L_TABBED) {
65 // get most left child of new output
66 return ws->children->items[0];
67 } else {
68 return seat_get_focus_inactive(seat, ws);
69 }
70 case MOVE_UP:
71 case MOVE_DOWN: {
72 struct sway_container *focused =
73 seat_get_focus_inactive(seat, ws);
74 if (focused && focused->parent) {
75 struct sway_container *parent = focused->parent;
76 if (parent->layout == L_VERT) {
77 if (dir == MOVE_UP) {
78 // get child furthest down on new output
79 int idx = parent->children->length - 1;
80 return parent->children->items[idx];
81 } else if (dir == MOVE_DOWN) {
82 // get child furthest up on new output
83 return parent->children->items[0];
84 }
85 }
86 return focused;
87 }
88 break;
89 }
90 default:
91 break;
92 }
93 }
94
95 return ws;
96}
97
98static struct sway_container *container_get_in_direction(
99 struct sway_container *container, struct sway_seat *seat,
100 enum movement_direction dir) {
101 struct sway_container *parent = container->parent;
102
103 if (dir == MOVE_CHILD) {
104 return seat_get_focus_inactive(seat, container);
105 }
106 if (container->is_fullscreen) {
107 if (dir == MOVE_PARENT) {
108 return NULL;
109 }
110 container = container_parent(container, C_OUTPUT);
111 parent = container->parent;
112 } else {
113 if (dir == MOVE_PARENT) {
114 if (parent->type == C_OUTPUT || container_is_floating(container)) {
115 return NULL;
116 } else {
117 return parent;
118 }
119 }
120 }
121
122 struct sway_container *wrap_candidate = NULL;
123 while (true) {
124 bool can_move = false;
125 int desired;
126 int idx = list_find(container->parent->children, container);
127 if (idx == -1) {
128 return NULL;
129 }
130 if (parent->type == C_ROOT) {
131 enum wlr_direction wlr_dir = 0;
132 if (!sway_assert(sway_dir_to_wlr(dir, &wlr_dir),
133 "got invalid direction: %d", dir)) {
134 return NULL;
135 }
136 int lx = container->x + container->width / 2;
137 int ly = container->y + container->height / 2;
138 struct wlr_output_layout *layout =
139 root_container.sway_root->output_layout;
140 struct wlr_output *wlr_adjacent =
141 wlr_output_layout_adjacent_output(layout, wlr_dir,
142 container->sway_output->wlr_output, lx, ly);
143 struct sway_container *adjacent =
144 output_from_wlr_output(wlr_adjacent);
145
146 if (!adjacent || adjacent == container) {
147 if (!wrap_candidate) {
148 return NULL;
149 }
150 return seat_get_focus_inactive_view(seat, wrap_candidate);
151 }
152 struct sway_container *next =
153 get_swayc_in_output_direction(adjacent, dir, seat);
154 if (next == NULL) {
155 return NULL;
156 }
157 struct sway_container *next_workspace = next;
158 if (next_workspace->type != C_WORKSPACE) {
159 next_workspace = container_parent(next_workspace, C_WORKSPACE);
160 }
161 sway_assert(next_workspace, "Next container has no workspace");
162 if (next_workspace->sway_workspace->fullscreen) {
163 return seat_get_focus_inactive(seat,
164 next_workspace->sway_workspace->fullscreen);
165 }
166 if (next->children && next->children->length) {
167 // TODO consider floating children as well
168 return seat_get_focus_inactive_view(seat, next);
169 } else {
170 return next;
171 }
172 } else {
173 if (dir == MOVE_LEFT || dir == MOVE_RIGHT) {
174 if (parent->layout == L_HORIZ || parent->layout == L_TABBED) {
175 can_move = true;
176 desired = idx + (dir == MOVE_LEFT ? -1 : 1);
177 }
178 } else {
179 if (parent->layout == L_VERT || parent->layout == L_STACKED) {
180 can_move = true;
181 desired = idx + (dir == MOVE_UP ? -1 : 1);
182 }
183 }
184 }
185
186 if (can_move) {
187 // TODO handle floating
188 if (desired < 0 || desired >= parent->children->length) {
189 can_move = false;
190 int len = parent->children->length;
191 if (config->focus_wrapping != WRAP_NO && !wrap_candidate
192 && len > 1) {
193 if (desired < 0) {
194 wrap_candidate = parent->children->items[len-1];
195 } else {
196 wrap_candidate = parent->children->items[0];
197 }
198 if (config->focus_wrapping == WRAP_FORCE) {
199 return seat_get_focus_inactive_view(seat,
200 wrap_candidate);
201 }
202 }
203 } else {
204 struct sway_container *desired_con =
205 parent->children->items[desired];
206 wlr_log(WLR_DEBUG,
207 "cont %d-%p dir %i sibling %d: %p", idx,
208 container, dir, desired, desired_con);
209 return seat_get_focus_inactive_view(seat, desired_con);
210 }
211 }
212
213 if (!can_move) {
214 container = parent;
215 parent = parent->parent;
216 if (!parent) {
217 // wrapping is the last chance
218 if (!wrap_candidate) {
219 return NULL;
220 }
221 return seat_get_focus_inactive_view(seat, wrap_candidate);
222 }
223 }
224 }
225}
226
34static struct cmd_results *focus_mode(struct sway_container *con, 227static struct cmd_results *focus_mode(struct sway_container *con,
35 struct sway_seat *seat, bool floating) { 228 struct sway_seat *seat, bool floating) {
36 struct sway_container *ws = con->type == C_WORKSPACE ? 229 struct sway_container *ws = con->type == C_WORKSPACE ?
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 087423de..a4eedf7f 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -52,6 +52,412 @@ static struct sway_container *output_in_direction(const char *direction,
52 return output_by_name(direction); 52 return output_by_name(direction);
53} 53}
54 54
55static void container_move_to(struct sway_container *container,
56 struct sway_container *destination) {
57 if (!sway_assert(container->type == C_CONTAINER ||
58 container->type == C_VIEW, "Expected a container or view")) {
59 return;
60 }
61 if (container == destination
62 || container_has_ancestor(container, destination)) {
63 return;
64 }
65 struct sway_container *old_parent = NULL;
66 struct sway_container *new_parent = NULL;
67 if (container_is_floating(container)) {
68 // Resolve destination into a workspace
69 struct sway_container *new_ws = NULL;
70 if (destination->type == C_OUTPUT) {
71 new_ws = output_get_active_workspace(destination->sway_output);
72 } else if (destination->type == C_WORKSPACE) {
73 new_ws = destination;
74 } else {
75 new_ws = container_parent(destination, C_WORKSPACE);
76 }
77 if (!new_ws) {
78 // This can happen if the user has run "move container to mark foo",
79 // where mark foo is on a hidden scratchpad container.
80 return;
81 }
82 struct sway_container *old_output =
83 container_parent(container, C_OUTPUT);
84 old_parent = container_remove_child(container);
85 workspace_add_floating(new_ws, container);
86 container_handle_fullscreen_reparent(container, old_parent);
87 // If changing output, center it within the workspace
88 if (old_output != new_ws->parent && !container->is_fullscreen) {
89 container_floating_move_to_center(container);
90 }
91 } else {
92 old_parent = container_remove_child(container);
93 container->width = container->height = 0;
94 container->saved_width = container->saved_height = 0;
95
96 if (destination->type == C_VIEW) {
97 new_parent = container_add_sibling(destination, container);
98 } else {
99 new_parent = destination;
100 container_add_child(destination, container);
101 }
102 }
103
104 if (container->type == C_VIEW) {
105 ipc_event_window(container, "move");
106 }
107 container_notify_subtree_changed(old_parent);
108 container_notify_subtree_changed(new_parent);
109
110 // If view was moved to a fullscreen workspace, refocus the fullscreen view
111 struct sway_container *new_workspace = container;
112 if (new_workspace->type != C_WORKSPACE) {
113 new_workspace = container_parent(new_workspace, C_WORKSPACE);
114 }
115 if (new_workspace->sway_workspace->fullscreen) {
116 struct sway_seat *seat;
117 struct sway_container *focus, *focus_ws;
118 wl_list_for_each(seat, &input_manager->seats, link) {
119 focus = seat_get_focus(seat);
120 focus_ws = focus;
121 if (focus_ws->type != C_WORKSPACE) {
122 focus_ws = container_parent(focus_ws, C_WORKSPACE);
123 }
124 if (focus_ws == new_workspace) {
125 struct sway_container *new_focus = seat_get_focus_inactive(seat,
126 new_workspace->sway_workspace->fullscreen);
127 seat_set_focus(seat, new_focus);
128 }
129 }
130 }
131 // Update workspace urgent state
132 struct sway_container *old_workspace = old_parent;
133 if (old_workspace->type != C_WORKSPACE) {
134 old_workspace = container_parent(old_workspace, C_WORKSPACE);
135 }
136 if (new_workspace != old_workspace) {
137 workspace_detect_urgent(new_workspace);
138 if (old_workspace) {
139 workspace_detect_urgent(old_workspace);
140 }
141 }
142}
143
144static bool is_parallel(enum sway_container_layout layout,
145 enum movement_direction dir) {
146 switch (layout) {
147 case L_TABBED:
148 case L_HORIZ:
149 return dir == MOVE_LEFT || dir == MOVE_RIGHT;
150 case L_STACKED:
151 case L_VERT:
152 return dir == MOVE_UP || dir == MOVE_DOWN;
153 default:
154 return false;
155 }
156}
157
158static enum movement_direction invert_movement(enum movement_direction dir) {
159 switch (dir) {
160 case MOVE_LEFT:
161 return MOVE_RIGHT;
162 case MOVE_RIGHT:
163 return MOVE_LEFT;
164 case MOVE_UP:
165 return MOVE_DOWN;
166 case MOVE_DOWN:
167 return MOVE_UP;
168 default:
169 sway_assert(0, "This function expects left|right|up|down");
170 return MOVE_LEFT;
171 }
172}
173
174static int move_offs(enum movement_direction move_dir) {
175 return move_dir == MOVE_LEFT || move_dir == MOVE_UP ? -1 : 1;
176}
177
178/* Gets the index of the most extreme member based on the movement offset */
179static int container_limit(struct sway_container *container,
180 enum movement_direction move_dir) {
181 return move_offs(move_dir) < 0 ? 0 : container->children->length;
182}
183
184/* Takes one child, sets it aside, wraps the rest of the children in a new
185 * container, switches the layout of the workspace, and drops the child back in.
186 * In other words, rejigger it. */
187static void workspace_rejigger(struct sway_container *ws,
188 struct sway_container *child, enum movement_direction move_dir) {
189 struct sway_container *original_parent = child->parent;
190 struct sway_container *new_parent =
191 container_split(ws, ws->layout);
192
193 container_remove_child(child);
194 for (int i = 0; i < ws->children->length; ++i) {
195 struct sway_container *_child = ws->children->items[i];
196 container_move_to(new_parent, _child);
197 }
198
199 int index = move_offs(move_dir);
200 container_insert_child(ws, child, index < 0 ? 0 : 1);
201 ws->layout =
202 move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT;
203
204 container_flatten(ws);
205 container_reap_empty(original_parent);
206 container_create_notify(new_parent);
207}
208
209static void move_out_of_tabs_stacks(struct sway_container *container,
210 struct sway_container *current, enum movement_direction move_dir,
211 int offs) {
212 if (container->parent == current->parent
213 && current->parent->children->length == 1) {
214 wlr_log(WLR_DEBUG, "Changing layout of %zd", current->parent->id);
215 current->parent->layout = move_dir ==
216 MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT;
217 return;
218 }
219
220 wlr_log(WLR_DEBUG, "Moving out of tab/stack into a split");
221 bool is_workspace = current->parent->type == C_WORKSPACE;
222 struct sway_container *new_parent = container_split(current->parent,
223 move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT);
224 if (is_workspace) {
225 container_insert_child(new_parent->parent, container, offs < 0 ? 0 : 1);
226 } else {
227 container_insert_child(new_parent, container, offs < 0 ? 0 : 1);
228 container_reap_empty(new_parent->parent);
229 container_flatten(new_parent->parent);
230 }
231 container_create_notify(new_parent);
232 container_notify_subtree_changed(new_parent);
233}
234
235static void container_move(struct sway_container *container,
236 enum movement_direction move_dir, int move_amt) {
237 if (!sway_assert(
238 container->type != C_CONTAINER || container->type != C_VIEW,
239 "Can only move containers and views")) {
240 return;
241 }
242 int offs = move_offs(move_dir);
243
244 struct sway_container *sibling = NULL;
245 struct sway_container *current = container;
246 struct sway_container *parent = current->parent;
247 struct sway_container *top = &root_container;
248
249 // If moving a fullscreen view, only consider outputs
250 if (container->is_fullscreen) {
251 current = container_parent(container, C_OUTPUT);
252 } else if (container_is_fullscreen_or_child(container) ||
253 container_is_floating_or_child(container)) {
254 // If we've fullscreened a split container, only allow the child to move
255 // around within the fullscreen parent.
256 // Same with floating a split container.
257 struct sway_container *ws = container_parent(container, C_WORKSPACE);
258 top = ws->sway_workspace->fullscreen;
259 }
260
261 struct sway_container *new_parent = container_flatten(parent);
262 if (new_parent != parent) {
263 // Special case: we were the last one in this container, so leave
264 return;
265 }
266
267 while (!sibling) {
268 if (current == top) {
269 return;
270 }
271
272 parent = current->parent;
273 wlr_log(WLR_DEBUG, "Visiting %p %s '%s'", current,
274 container_type_to_str(current->type), current->name);
275
276 int index = container_sibling_index(current);
277
278 switch (current->type) {
279 case C_OUTPUT: {
280 enum wlr_direction wlr_dir = 0;
281 if (!sway_assert(sway_dir_to_wlr(move_dir, &wlr_dir),
282 "got invalid direction: %d", move_dir)) {
283 return;
284 }
285 double ref_lx = current->x + current->width / 2;
286 double ref_ly = current->y + current->height / 2;
287 struct wlr_output *next = wlr_output_layout_adjacent_output(
288 root_container.sway_root->output_layout, wlr_dir,
289 current->sway_output->wlr_output, ref_lx, ref_ly);
290 if (!next) {
291 wlr_log(WLR_DEBUG, "Hit edge of output, nowhere else to go");
292 return;
293 }
294 struct sway_output *next_output = next->data;
295 current = next_output->swayc;
296 wlr_log(WLR_DEBUG, "Selected next output (%s)", current->name);
297 // Select workspace and get outta here
298 current = seat_get_focus_inactive(
299 config->handler_context.seat, current);
300 if (current->type != C_WORKSPACE) {
301 current = container_parent(current, C_WORKSPACE);
302 }
303 sibling = current;
304 break;
305 }
306 case C_WORKSPACE:
307 if (!is_parallel(current->layout, move_dir)) {
308 if (current->children->length >= 2) {
309 wlr_log(WLR_DEBUG, "Rejiggering the workspace (%d kiddos)",
310 current->children->length);
311 workspace_rejigger(current, container, move_dir);
312 return;
313 } else {
314 wlr_log(WLR_DEBUG, "Selecting output");
315 current = current->parent;
316 }
317 } else if (current->layout == L_TABBED
318 || current->layout == L_STACKED) {
319 wlr_log(WLR_DEBUG, "Rejiggering out of tabs/stacks");
320 workspace_rejigger(current, container, move_dir);
321 } else {
322 wlr_log(WLR_DEBUG, "Selecting output");
323 current = current->parent;
324 }
325 break;
326 case C_CONTAINER:
327 case C_VIEW:
328 if (is_parallel(parent->layout, move_dir)) {
329 if ((index == parent->children->length - 1 && offs > 0)
330 || (index == 0 && offs < 0)) {
331 if (current->parent == container->parent) {
332 if (!parent->is_fullscreen &&
333 (parent->layout == L_TABBED ||
334 parent->layout == L_STACKED)) {
335 move_out_of_tabs_stacks(container, current,
336 move_dir, offs);
337 return;
338 } else {
339 wlr_log(WLR_DEBUG, "Hit limit, selecting parent");
340 current = current->parent;
341 }
342 } else {
343 wlr_log(WLR_DEBUG, "Hit limit, "
344 "promoting descendant to sibling");
345 // Special case
346 container_insert_child(current->parent, container,
347 index + (offs < 0 ? 0 : 1));
348 container->width = container->height = 0;
349 return;
350 }
351 } else {
352 sibling = parent->children->items[index + offs];
353 wlr_log(WLR_DEBUG, "Selecting sibling id:%zd", sibling->id);
354 }
355 } else if (!parent->is_fullscreen && (parent->layout == L_TABBED ||
356 parent->layout == L_STACKED)) {
357 move_out_of_tabs_stacks(container, current, move_dir, offs);
358 return;
359 } else {
360 wlr_log(WLR_DEBUG, "Moving up to find a parallel container");
361 current = current->parent;
362 }
363 break;
364 default:
365 sway_assert(0, "Not expecting to see container of type %s here",
366 container_type_to_str(current->type));
367 return;
368 }
369 }
370
371 // Part two: move stuff around
372 int index = container_sibling_index(container);
373 struct sway_container *old_parent = container->parent;
374
375 while (sibling) {
376 switch (sibling->type) {
377 case C_VIEW:
378 if (sibling->parent == container->parent) {
379 wlr_log(WLR_DEBUG, "Swapping siblings");
380 sibling->parent->children->items[index + offs] = container;
381 sibling->parent->children->items[index] = sibling;
382 } else {
383 wlr_log(WLR_DEBUG, "Promoting to sibling of cousin");
384 container_insert_child(sibling->parent, container,
385 container_sibling_index(sibling) + (offs > 0 ? 0 : 1));
386 container->width = container->height = 0;
387 }
388 sibling = NULL;
389 break;
390 case C_WORKSPACE: // Note: only in the case of moving between outputs
391 case C_CONTAINER:
392 if (is_parallel(sibling->layout, move_dir)) {
393 int limit = container_limit(sibling, invert_movement(move_dir));
394 wlr_log(WLR_DEBUG, "limit: %d", limit);
395 wlr_log(WLR_DEBUG,
396 "Reparenting container (parallel) to index %d "
397 "(move dir: %d)", limit, move_dir);
398 container_insert_child(sibling, container, limit);
399 container->width = container->height = 0;
400 sibling = NULL;
401 } else {
402 wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)");
403 struct sway_container *focus_inactive = seat_get_focus_inactive(
404 config->handler_context.seat, sibling);
405 if (focus_inactive && focus_inactive != sibling) {
406 while (focus_inactive->parent != sibling) {
407 focus_inactive = focus_inactive->parent;
408 }
409 wlr_log(WLR_DEBUG, "Focus inactive: id:%zd",
410 focus_inactive->id);
411 sibling = focus_inactive;
412 continue;
413 } else if (sibling->children->length) {
414 wlr_log(WLR_DEBUG, "No focus-inactive, adding arbitrarily");
415 container_remove_child(container);
416 container_add_sibling(sibling->children->items[0], container);
417 } else {
418 wlr_log(WLR_DEBUG, "No kiddos, adding container alone");
419 container_remove_child(container);
420 container_add_child(sibling, container);
421 }
422 container->width = container->height = 0;
423 sibling = NULL;
424 }
425 break;
426 default:
427 sway_assert(0, "Not expecting to see container of type %s here",
428 container_type_to_str(sibling->type));
429 return;
430 }
431 }
432
433 container_notify_subtree_changed(old_parent);
434 container_notify_subtree_changed(container->parent);
435
436 if (container->type == C_VIEW) {
437 ipc_event_window(container, "move");
438 }
439
440 if (old_parent) {
441 seat_set_focus(config->handler_context.seat, old_parent);
442 seat_set_focus(config->handler_context.seat, container);
443 }
444
445 struct sway_container *last_ws = old_parent;
446 struct sway_container *next_ws = container->parent;
447 if (last_ws && last_ws->type != C_WORKSPACE) {
448 last_ws = container_parent(last_ws, C_WORKSPACE);
449 }
450 if (next_ws && next_ws->type != C_WORKSPACE) {
451 next_ws = container_parent(next_ws, C_WORKSPACE);
452 }
453 if (last_ws && next_ws && last_ws != next_ws) {
454 ipc_event_workspace(last_ws, next_ws, "focus");
455 workspace_detect_urgent(last_ws);
456 workspace_detect_urgent(next_ws);
457 }
458 container_end_mouse_operation(container);
459}
460
55static struct cmd_results *cmd_move_container(struct sway_container *current, 461static struct cmd_results *cmd_move_container(struct sway_container *current,
56 int argc, char **argv) { 462 int argc, char **argv) {
57 struct cmd_results *error = NULL; 463 struct cmd_results *error = NULL;
diff --git a/sway/commands/sticky.c b/sway/commands/sticky.c
index a0dd7215..72ef4282 100644
--- a/sway/commands/sticky.c
+++ b/sway/commands/sticky.c
@@ -8,6 +8,7 @@
8#include "sway/tree/container.h" 8#include "sway/tree/container.h"
9#include "sway/tree/layout.h" 9#include "sway/tree/layout.h"
10#include "sway/tree/view.h" 10#include "sway/tree/view.h"
11#include "sway/tree/workspace.h"
11#include "list.h" 12#include "list.h"
12 13
13struct cmd_results *cmd_sticky(int argc, char **argv) { 14struct cmd_results *cmd_sticky(int argc, char **argv) {
@@ -44,7 +45,9 @@ struct cmd_results *cmd_sticky(int argc, char **argv) {
44 struct sway_container *focused_workspace = container_parent(focus, C_WORKSPACE); 45 struct sway_container *focused_workspace = container_parent(focus, C_WORKSPACE);
45 struct sway_container *current_workspace = container_parent(container, C_WORKSPACE); 46 struct sway_container *current_workspace = container_parent(container, C_WORKSPACE);
46 if (current_workspace != focused_workspace) { 47 if (current_workspace != focused_workspace) {
47 container_move_to(container, focused_workspace); 48 container_remove_child(container);
49 workspace_add_floating(focused_workspace, container);
50 container_handle_fullscreen_reparent(container, current_workspace);
48 arrange_windows(focused_workspace); 51 arrange_windows(focused_workspace);
49 if (!container_reap_empty(current_workspace)) { 52 if (!container_reap_empty(current_workspace)) {
50 arrange_windows(current_workspace); 53 arrange_windows(current_workspace);