diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-04-03 13:23:34 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-04-03 13:23:34 -0400 |
commit | 9b567fc37e83ed9f0cbb028fd801a2f2609c79dc (patch) | |
tree | a1ebdea49233f10c016664159bb9e8c9738e407c /sway/tree/layout.c | |
parent | move container_set_layout to layout.h (diff) | |
download | sway-9b567fc37e83ed9f0cbb028fd801a2f2609c79dc.tar.gz sway-9b567fc37e83ed9f0cbb028fd801a2f2609c79dc.tar.zst sway-9b567fc37e83ed9f0cbb028fd801a2f2609c79dc.zip |
clean up container_get_default_layout
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r-- | sway/tree/layout.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index dfcdbb9c..c3cdaae0 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -168,12 +168,22 @@ void container_move(struct sway_container *container, | |||
168 | } | 168 | } |
169 | 169 | ||
170 | enum sway_container_layout container_get_default_layout( | 170 | enum sway_container_layout container_get_default_layout( |
171 | struct sway_container *output) { | 171 | struct sway_container *con) { |
172 | if (con->type != C_OUTPUT) { | ||
173 | con = container_parent(con, C_OUTPUT); | ||
174 | } | ||
175 | |||
176 | if (!sway_assert(con != NULL, | ||
177 | "container_get_default_layout must be called on an attached " | ||
178 | " container below the root container")) { | ||
179 | return 0; | ||
180 | } | ||
181 | |||
172 | if (config->default_layout != L_NONE) { | 182 | if (config->default_layout != L_NONE) { |
173 | return config->default_layout; | 183 | return config->default_layout; |
174 | } else if (config->default_orientation != L_NONE) { | 184 | } else if (config->default_orientation != L_NONE) { |
175 | return config->default_orientation; | 185 | return config->default_orientation; |
176 | } else if (output->width >= output->height) { | 186 | } else if (con->width >= con->height) { |
177 | return L_HORIZ; | 187 | return L_HORIZ; |
178 | } else { | 188 | } else { |
179 | return L_VERT; | 189 | return L_VERT; |