diff options
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/sway/layout.c b/sway/layout.c index 3e467169..869a3bcb 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -296,7 +296,7 @@ void move_container(swayc_t *container, enum movement_direction dir) { | |||
296 | sway_log(L_DEBUG, "container:%p, parent:%p, child %p,", | 296 | sway_log(L_DEBUG, "container:%p, parent:%p, child %p,", |
297 | container,parent,child); | 297 | container,parent,child); |
298 | if (parent->layout == layout | 298 | if (parent->layout == layout |
299 | || layout == L_NONE /* accept any layout for next/prev direction */ | 299 | || (layout == L_NONE && parent->type == C_CONTAINER) /* accept any layout for next/prev direction */ |
300 | || (parent->layout == L_TABBED && layout == L_HORIZ) | 300 | || (parent->layout == L_TABBED && layout == L_HORIZ) |
301 | || (parent->layout == L_STACKED && layout == L_VERT) | 301 | || (parent->layout == L_STACKED && layout == L_VERT) |
302 | || is_auto_layout(parent->layout)) { | 302 | || is_auto_layout(parent->layout)) { |
@@ -321,16 +321,16 @@ void move_container(swayc_t *container, enum movement_direction dir) { | |||
321 | } | 321 | } |
322 | // if move command makes container change from master to slave | 322 | // if move command makes container change from master to slave |
323 | // (or the contrary), reset its geometry an the one of the replaced item. | 323 | // (or the contrary), reset its geometry an the one of the replaced item. |
324 | if (parent->nb_master && | 324 | if (parent->nb_master |
325 | (size_t) parent->children->length > parent->nb_master) { | 325 | && (size_t) parent->children->length > parent->nb_master) { |
326 | swayc_t *swap_geom = NULL; | 326 | swayc_t *swap_geom = NULL; |
327 | // if child is being promoted/demoted, it will swap geometry | 327 | // if child is being promoted/demoted, it will swap geometry |
328 | // with the sibling being demoted/promoted. | 328 | // with the sibling being demoted/promoted. |
329 | if ((dir == MOVE_NEXT && desired == 0) | 329 | if ((dir == MOVE_NEXT && desired == 0) |
330 | || (dir == MOVE_PREV && (size_t) desired == parent->nb_master - 1)) { | 330 | || (dir == MOVE_PREV && (size_t) desired == parent->nb_master - 1)) { |
331 | swap_geom = parent->children->items[parent->nb_master - 1]; | 331 | swap_geom = parent->children->items[parent->nb_master - 1]; |
332 | } else if ((dir == MOVE_NEXT && (size_t) desired == parent->nb_master) | 332 | } else if ((dir == MOVE_NEXT && (size_t) desired == parent->nb_master) |
333 | || (dir == MOVE_PREV && desired == parent->children->length - 1)) { | 333 | || (dir == MOVE_PREV && desired == parent->children->length - 1)) { |
334 | swap_geom = parent->children->items[parent->nb_master]; | 334 | swap_geom = parent->children->items[parent->nb_master]; |
335 | } | 335 | } |
336 | if (swap_geom) { | 336 | if (swap_geom) { |
@@ -837,9 +837,9 @@ static void apply_tabbed_or_stacked_layout(swayc_t *container, double x, | |||
837 | double height); | 837 | double height); |
838 | 838 | ||
839 | static void apply_auto_layout(swayc_t *container, const double x, const double y, | 839 | static void apply_auto_layout(swayc_t *container, const double x, const double y, |
840 | const double width, const double height, | 840 | const double width, const double height, |
841 | enum swayc_layouts group_layout, | 841 | enum swayc_layouts group_layout, |
842 | bool master_first); | 842 | bool master_first); |
843 | 843 | ||
844 | static void arrange_windows_r(swayc_t *container, double width, double height) { | 844 | static void arrange_windows_r(swayc_t *container, double width, double height) { |
845 | int i; | 845 | int i; |
@@ -972,11 +972,11 @@ static void arrange_windows_r(swayc_t *container, double width, double height) { | |||
972 | case L_HORIZ: | 972 | case L_HORIZ: |
973 | default: | 973 | default: |
974 | apply_horiz_layout(container, x, y, width, height, 0, | 974 | apply_horiz_layout(container, x, y, width, height, 0, |
975 | container->children->length); | 975 | container->children->length); |
976 | break; | 976 | break; |
977 | case L_VERT: | 977 | case L_VERT: |
978 | apply_vert_layout(container, x, y, width, height, 0, | 978 | apply_vert_layout(container, x, y, width, height, 0, |
979 | container->children->length); | 979 | container->children->length); |
980 | break; | 980 | break; |
981 | case L_TABBED: | 981 | case L_TABBED: |
982 | case L_STACKED: | 982 | case L_STACKED: |
@@ -1007,7 +1007,7 @@ static void arrange_windows_r(swayc_t *container, double width, double height) { | |||
1007 | if (swayc_is_fullscreen(view)) { | 1007 | if (swayc_is_fullscreen(view)) { |
1008 | wlc_view_bring_to_front(view->handle); | 1008 | wlc_view_bring_to_front(view->handle); |
1009 | } else if (!container->focused || | 1009 | } else if (!container->focused || |
1010 | !swayc_is_fullscreen(container->focused)) { | 1010 | !swayc_is_fullscreen(container->focused)) { |
1011 | wlc_view_bring_to_front(view->handle); | 1011 | wlc_view_bring_to_front(view->handle); |
1012 | } | 1012 | } |
1013 | } | 1013 | } |
@@ -1068,8 +1068,8 @@ void apply_horiz_layout(swayc_t *container, const double x, const double y, | |||
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | void apply_vert_layout(swayc_t *container, const double x, const double y, | 1070 | void apply_vert_layout(swayc_t *container, const double x, const double y, |
1071 | const double width, const double height, const int start, | 1071 | const double width, const double height, const int start, |
1072 | const int end) { | 1072 | const int end) { |
1073 | int i; | 1073 | int i; |
1074 | double scale = 0; | 1074 | double scale = 0; |
1075 | // Calculate total height | 1075 | // Calculate total height |
@@ -1121,7 +1121,7 @@ void apply_vert_layout(swayc_t *container, const double x, const double y, | |||
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | void apply_tabbed_or_stacked_layout(swayc_t *container, double x, double y, | 1123 | void apply_tabbed_or_stacked_layout(swayc_t *container, double x, double y, |
1124 | double width, double height) { | 1124 | double width, double height) { |
1125 | int i; | 1125 | int i; |
1126 | swayc_t *focused = NULL; | 1126 | swayc_t *focused = NULL; |
1127 | for (i = 0; i < container->children->length; ++i) { | 1127 | for (i = 0; i < container->children->length; ++i) { |
@@ -1141,9 +1141,9 @@ void apply_tabbed_or_stacked_layout(swayc_t *container, double x, double y, | |||
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | void apply_auto_layout(swayc_t *container, const double x, const double y, | 1143 | void apply_auto_layout(swayc_t *container, const double x, const double y, |
1144 | const double width, const double height, | 1144 | const double width, const double height, |
1145 | enum swayc_layouts group_layout, | 1145 | enum swayc_layouts group_layout, |
1146 | bool master_first) { | 1146 | bool master_first) { |
1147 | // Auto layout "container" in width x height @ x, y | 1147 | // Auto layout "container" in width x height @ x, y |
1148 | // using "group_layout" for each of the groups in the container. | 1148 | // using "group_layout" for each of the groups in the container. |
1149 | // There is one "master" group, plus container->nb_slave_groups. | 1149 | // There is one "master" group, plus container->nb_slave_groups. |
@@ -1342,7 +1342,7 @@ swayc_t *get_swayc_in_direction_under(swayc_t *container, enum movement_directio | |||
1342 | return NULL; | 1342 | return NULL; |
1343 | } else { | 1343 | } else { |
1344 | int desired = (focused_idx + (dir == MOVE_NEXT ? 1 : -1)) % | 1344 | int desired = (focused_idx + (dir == MOVE_NEXT ? 1 : -1)) % |
1345 | parent->children->length; | 1345 | parent->children->length; |
1346 | if (desired < 0) { | 1346 | if (desired < 0) { |
1347 | desired += parent->children->length; | 1347 | desired += parent->children->length; |
1348 | } | 1348 | } |