Indent cleanups

This commit is contained in:
wil 2017-01-08 14:49:47 +01:00
parent d822150d83
commit 063c79874a
3 changed files with 34 additions and 33 deletions

View file

@ -49,8 +49,8 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
} else if (strcasecmp(argv[0], "splitv") == 0) { } else if (strcasecmp(argv[0], "splitv") == 0) {
swayc_change_layout(parent, L_VERT); swayc_change_layout(parent, L_VERT);
} else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) {
if (parent->layout == L_HORIZ && (parent->workspace_layout == L_NONE || if (parent->layout == L_HORIZ && (parent->workspace_layout == L_NONE
parent->workspace_layout == L_HORIZ)) { || parent->workspace_layout == L_HORIZ)) {
swayc_change_layout(parent, L_VERT); swayc_change_layout(parent, L_VERT);
} else { } else {
swayc_change_layout(parent, L_HORIZ); swayc_change_layout(parent, L_HORIZ);
@ -81,8 +81,8 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
is_auto_layout(container->parent->layout) && is_auto_layout(container->parent->layout) &&
((int)container->parent->nb_master + inc >= 0)) { ((int)container->parent->nb_master + inc >= 0)) {
for (int i = container->parent->nb_master; for (int i = container->parent->nb_master;
i >= 0 && i < container->parent->children->length && i >= 0 && i < container->parent->children->length
i != (int) container->parent->nb_master + inc;) { && i != (int) container->parent->nb_master + inc;) {
((swayc_t *) container->parent->children->items[i])->height = -1; ((swayc_t *) container->parent->children->items[i])->height = -1;
((swayc_t *) container->parent->children->items[i])->width = -1; ((swayc_t *) container->parent->children->items[i])->width = -1;
i += inc > 0 ? 1 : -1; i += inc > 0 ? 1 : -1;

View file

@ -965,10 +965,11 @@ swayc_t *swayc_change_layout(swayc_t *container, enum swayc_layouts layout) {
// if layout change modifies the auto layout's major axis, swap width and height // if layout change modifies the auto layout's major axis, swap width and height
// to preserve current ratios. // to preserve current ratios.
if (is_auto_layout(layout) && is_auto_layout(container->layout)) { if (is_auto_layout(layout) && is_auto_layout(container->layout)) {
enum swayc_layouts prev_major = (container->layout == L_AUTO_LEFT || enum swayc_layouts prev_major =
container->layout == L_AUTO_RIGHT) container->layout == L_AUTO_LEFT || container->layout == L_AUTO_RIGHT
? L_HORIZ : L_VERT; ? L_HORIZ : L_VERT;
enum swayc_layouts new_major = (layout == L_AUTO_LEFT || layout == L_AUTO_RIGHT) enum swayc_layouts new_major =
layout == L_AUTO_LEFT || layout == L_AUTO_RIGHT
? L_HORIZ : L_VERT; ? L_HORIZ : L_VERT;
if (new_major != prev_major) { if (new_major != prev_major) {
for (int i = 0; i < container->children->length; ++i) { for (int i = 0; i < container->children->length; ++i) {

View file

@ -296,7 +296,7 @@ void move_container(swayc_t *container, enum movement_direction dir) {
sway_log(L_DEBUG, "container:%p, parent:%p, child %p,", sway_log(L_DEBUG, "container:%p, parent:%p, child %p,",
container,parent,child); container,parent,child);
if (parent->layout == layout if (parent->layout == layout
|| layout == L_NONE /* accept any layout for next/prev direction */ || (layout == L_NONE && parent->type == C_CONTAINER) /* accept any layout for next/prev direction */
|| (parent->layout == L_TABBED && layout == L_HORIZ) || (parent->layout == L_TABBED && layout == L_HORIZ)
|| (parent->layout == L_STACKED && layout == L_VERT) || (parent->layout == L_STACKED && layout == L_VERT)
|| is_auto_layout(parent->layout)) { || is_auto_layout(parent->layout)) {
@ -321,8 +321,8 @@ void move_container(swayc_t *container, enum movement_direction dir) {
} }
// if move command makes container change from master to slave // if move command makes container change from master to slave
// (or the contrary), reset its geometry an the one of the replaced item. // (or the contrary), reset its geometry an the one of the replaced item.
if (parent->nb_master && if (parent->nb_master
(size_t) parent->children->length > parent->nb_master) { && (size_t) parent->children->length > parent->nb_master) {
swayc_t *swap_geom = NULL; swayc_t *swap_geom = NULL;
// if child is being promoted/demoted, it will swap geometry // if child is being promoted/demoted, it will swap geometry
// with the sibling being demoted/promoted. // with the sibling being demoted/promoted.