aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-26 18:36:46 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-28 22:41:04 +1000
commit08cfba2192f5770d975c5fe70789a81aaee4dc7e (patch)
tree7f07e32020649ae5c049e8533f0cf040dc80e166 /sway/tree/layout.c
parentMerge pull request #2372 from RyanDwyer/fix-use-after-free-v2 (diff)
downloadsway-08cfba2192f5770d975c5fe70789a81aaee4dc7e.tar.gz
sway-08cfba2192f5770d975c5fe70789a81aaee4dc7e.tar.zst
sway-08cfba2192f5770d975c5fe70789a81aaee4dc7e.zip
Allow containers to float
Things worth noting: * When a fullscreen view unmaps, the check to unset fullscreen on the workspace has been moved out of view_unmap and into container_destroy, because containers can be fullscreen too * The calls to `container_reap_empty_recursive(workspace)` have been removed from `container_set_floating`. That function reaps upwards so it wouldn't do anything. I'm probably the one who originally added it... * My fix (b14bd1b0b1536039e4f46fe94515c7c44e7afc61) for the tabbed child crash has a side effect where when you close a floating container, focus is not given to the tiled container again. I've removed my fix and removed the call to `send_cursor_motion` from `seat_set_focus_warp`. We should consider calling it from somewhere earlier in the call stack.
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index ab5acc16..a0764a54 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -387,9 +387,11 @@ void container_move(struct sway_container *container,
387 // If moving a fullscreen view, only consider outputs 387 // If moving a fullscreen view, only consider outputs
388 if (container->is_fullscreen) { 388 if (container->is_fullscreen) {
389 current = container_parent(container, C_OUTPUT); 389 current = container_parent(container, C_OUTPUT);
390 } else if (container_is_fullscreen_or_child(container)) { 390 } else if (container_is_fullscreen_or_child(container) ||
391 container_is_floating_or_child(container)) {
391 // If we've fullscreened a split container, only allow the child to move 392 // If we've fullscreened a split container, only allow the child to move
392 // around within the fullscreen parent. 393 // around within the fullscreen parent.
394 // Same with floating a split container.
393 struct sway_container *ws = container_parent(container, C_WORKSPACE); 395 struct sway_container *ws = container_parent(container, C_WORKSPACE);
394 top = ws->sway_workspace->fullscreen; 396 top = ws->sway_workspace->fullscreen;
395 } 397 }
@@ -465,6 +467,9 @@ void container_move(struct sway_container *container,
465 if ((index == parent->children->length - 1 && offs > 0) 467 if ((index == parent->children->length - 1 && offs > 0)
466 || (index == 0 && offs < 0)) { 468 || (index == 0 && offs < 0)) {
467 if (current->parent == container->parent) { 469 if (current->parent == container->parent) {
470 if (parent->parent->layout == L_FLOATING) {
471 return;
472 }
468 if (!parent->is_fullscreen && 473 if (!parent->is_fullscreen &&
469 (parent->layout == L_TABBED || 474 (parent->layout == L_TABBED ||
470 parent->layout == L_STACKED)) { 475 parent->layout == L_STACKED)) {
@@ -488,10 +493,14 @@ void container_move(struct sway_container *container,
488 sibling = parent->children->items[index + offs]; 493 sibling = parent->children->items[index + offs];
489 wlr_log(WLR_DEBUG, "Selecting sibling id:%zd", sibling->id); 494 wlr_log(WLR_DEBUG, "Selecting sibling id:%zd", sibling->id);
490 } 495 }
491 } else if (!parent->is_fullscreen && (parent->layout == L_TABBED || 496 } else if (!parent->is_fullscreen &&
497 parent->parent->layout != L_FLOATING &&
498 (parent->layout == L_TABBED ||
492 parent->layout == L_STACKED)) { 499 parent->layout == L_STACKED)) {
493 move_out_of_tabs_stacks(container, current, move_dir, offs); 500 move_out_of_tabs_stacks(container, current, move_dir, offs);
494 return; 501 return;
502 } else if (parent->parent->layout == L_FLOATING) {
503 return;
495 } else { 504 } else {
496 wlr_log(WLR_DEBUG, "Moving up to find a parallel container"); 505 wlr_log(WLR_DEBUG, "Moving up to find a parallel container");
497 current = current->parent; 506 current = current->parent;
@@ -717,10 +726,6 @@ struct sway_container *container_get_in_direction(
717 enum movement_direction dir) { 726 enum movement_direction dir) {
718 struct sway_container *parent = container->parent; 727 struct sway_container *parent = container->parent;
719 728
720 if (container_is_floating(container)) {
721 return NULL;
722 }
723
724 if (dir == MOVE_CHILD) { 729 if (dir == MOVE_CHILD) {
725 return seat_get_focus_inactive(seat, container); 730 return seat_get_focus_inactive(seat, container);
726 } 731 }
@@ -732,7 +737,7 @@ struct sway_container *container_get_in_direction(
732 parent = container->parent; 737 parent = container->parent;
733 } else { 738 } else {
734 if (dir == MOVE_PARENT) { 739 if (dir == MOVE_PARENT) {
735 if (parent->type == C_OUTPUT) { 740 if (parent->type == C_OUTPUT || container_is_floating(container)) {
736 return NULL; 741 return NULL;
737 } else { 742 } else {
738 return parent; 743 return parent;