aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-04-19 12:53:02 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-04-19 12:53:02 +1000
commit45a2fad0dead2e00a41eedd3b524aacd29f00335 (patch)
tree3677c8c3d8645bf86cee3712ec768aeeab5b9ab1 /sway
parent7e38cc2e05f4a14a9e4043951b6fcc033cbb41c2 (diff)
container_get_in_direction(): Don't split this function
Diffstat (limited to 'sway')
-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) {
return NULL;
}
-static struct sway_container *container_get_in_direction_naive(
+struct sway_container *container_get_in_direction(
struct sway_container *container, struct sway_seat *seat,
enum movement_direction dir) {
struct sway_container *parent = container->parent;
@@ -936,6 +936,14 @@ static struct sway_container *container_get_in_direction_naive(
if (next == NULL) {
return NULL;
}
+ struct sway_container *next_workspace = next;
+ if (next_workspace->type != C_WORKSPACE) {
+ next_workspace = container_parent(next_workspace, C_WORKSPACE);
+ }
+ sway_assert(next_workspace, "Next container has no workspace");
+ if (next_workspace->sway_workspace->fullscreen) {
+ return next_workspace->sway_workspace->fullscreen->swayc;
+ }
if (next->children && next->children->length) {
// TODO consider floating children as well
return seat_get_focus_inactive_view(seat, next);
@@ -992,28 +1000,6 @@ static struct sway_container *container_get_in_direction_naive(
}
}
-struct sway_container *container_get_in_direction(
- struct sway_container *container, struct sway_seat *seat,
- enum movement_direction dir) {
- struct sway_container *result = container_get_in_direction_naive(container,
- seat, dir);
- if (!result) {
- return NULL;
- }
- struct sway_container *old_workspace = container;
- if (old_workspace->type != C_WORKSPACE) {
- old_workspace = container_parent(old_workspace, C_WORKSPACE);
- }
- struct sway_container *new_workspace = result;
- if (new_workspace->type != C_WORKSPACE) {
- new_workspace = container_parent(new_workspace, C_WORKSPACE);
- }
- if (old_workspace != new_workspace && new_workspace->sway_workspace->fullscreen) {
- result = new_workspace->sway_workspace->fullscreen->swayc;
- }
- return result;
-}
-
struct sway_container *container_replace_child(struct sway_container *child,
struct sway_container *new_child) {
struct sway_container *parent = child->parent;