aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/layout.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-04-19 12:53:02 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-04-19 12:53:02 +1000
commit45a2fad0dead2e00a41eedd3b524aacd29f00335 (patch)
tree3677c8c3d8645bf86cee3712ec768aeeab5b9ab1 /sway/tree/layout.c
parentarrange_windows(): Calculate workspace properties when fullscreen (diff)
downloadsway-45a2fad0dead2e00a41eedd3b524aacd29f00335.tar.gz
sway-45a2fad0dead2e00a41eedd3b524aacd29f00335.tar.zst
sway-45a2fad0dead2e00a41eedd3b524aacd29f00335.zip
container_get_in_direction(): Don't split this function
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r--sway/tree/layout.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 96d0c567..7ffc2484 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -883,7 +883,7 @@ static struct sway_container *sway_output_from_wlr(struct wlr_output *output) {
883 return NULL; 883 return NULL;
884} 884}
885 885
886static struct sway_container *container_get_in_direction_naive( 886struct sway_container *container_get_in_direction(
887 struct sway_container *container, struct sway_seat *seat, 887 struct sway_container *container, struct sway_seat *seat,
888 enum movement_direction dir) { 888 enum movement_direction dir) {
889 struct sway_container *parent = container->parent; 889 struct sway_container *parent = container->parent;
@@ -936,6 +936,14 @@ static struct sway_container *container_get_in_direction_naive(
936 if (next == NULL) { 936 if (next == NULL) {
937 return NULL; 937 return NULL;
938 } 938 }
939 struct sway_container *next_workspace = next;
940 if (next_workspace->type != C_WORKSPACE) {
941 next_workspace = container_parent(next_workspace, C_WORKSPACE);
942 }
943 sway_assert(next_workspace, "Next container has no workspace");
944 if (next_workspace->sway_workspace->fullscreen) {
945 return next_workspace->sway_workspace->fullscreen->swayc;
946 }
939 if (next->children && next->children->length) { 947 if (next->children && next->children->length) {
940 // TODO consider floating children as well 948 // TODO consider floating children as well
941 return seat_get_focus_inactive_view(seat, next); 949 return seat_get_focus_inactive_view(seat, next);
@@ -992,28 +1000,6 @@ static struct sway_container *container_get_in_direction_naive(
992 } 1000 }
993} 1001}
994 1002
995struct sway_container *container_get_in_direction(
996 struct sway_container *container, struct sway_seat *seat,
997 enum movement_direction dir) {
998 struct sway_container *result = container_get_in_direction_naive(container,
999 seat, dir);
1000 if (!result) {
1001 return NULL;
1002 }
1003 struct sway_container *old_workspace = container;
1004 if (old_workspace->type != C_WORKSPACE) {
1005 old_workspace = container_parent(old_workspace, C_WORKSPACE);
1006 }
1007 struct sway_container *new_workspace = result;
1008 if (new_workspace->type != C_WORKSPACE) {
1009 new_workspace = container_parent(new_workspace, C_WORKSPACE);
1010 }
1011 if (old_workspace != new_workspace && new_workspace->sway_workspace->fullscreen) {
1012 result = new_workspace->sway_workspace->fullscreen->swayc;
1013 }
1014 return result;
1015}
1016
1017struct sway_container *container_replace_child(struct sway_container *child, 1003struct sway_container *container_replace_child(struct sway_container *child,
1018 struct sway_container *new_child) { 1004 struct sway_container *new_child) {
1019 struct sway_container *parent = child->parent; 1005 struct sway_container *parent = child->parent;