clean up container_get_default_layout

This commit is contained in:
Tony Crisci 2018-04-03 13:23:34 -04:00
parent 065887bb7b
commit 9b567fc37e
4 changed files with 15 additions and 7 deletions

View file

@ -168,12 +168,22 @@ void container_move(struct sway_container *container,
}
enum sway_container_layout container_get_default_layout(
struct sway_container *output) {
struct sway_container *con) {
if (con->type != C_OUTPUT) {
con = container_parent(con, C_OUTPUT);
}
if (!sway_assert(con != NULL,
"container_get_default_layout must be called on an attached "
" container below the root container")) {
return 0;
}
if (config->default_layout != L_NONE) {
return config->default_layout;
} else if (config->default_orientation != L_NONE) {
return config->default_orientation;
} else if (output->width >= output->height) {
} else if (con->width >= con->height) {
return L_HORIZ;
} else {
return L_VERT;