diff options
author | taiyu <taiyu.len@gmail.com> | 2015-08-20 04:57:01 -0700 |
---|---|---|
committer | taiyu <taiyu.len@gmail.com> | 2015-08-20 04:57:01 -0700 |
commit | f6e002fb8b664d80ef10126f6a204ffbb2f192df (patch) | |
tree | 32fae9211bd6df4c4ecfd501703faedf83c14477 | |
parent | unnessesary log (diff) | |
download | sway-f6e002fb8b664d80ef10126f6a204ffbb2f192df.tar.gz sway-f6e002fb8b664d80ef10126f6a204ffbb2f192df.tar.zst sway-f6e002fb8b664d80ef10126f6a204ffbb2f192df.zip |
small fix, default width/height 0
-rw-r--r-- | sway/container.c | 9 | ||||
-rw-r--r-- | sway/layout.c | 4 |
2 files changed, 4 insertions, 9 deletions
diff --git a/sway/container.c b/sway/container.c index c9163784..59dc9e62 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -172,13 +172,8 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { | |||
172 | view->visible = true; | 172 | view->visible = true; |
173 | view->is_focused = true; | 173 | view->is_focused = true; |
174 | //Setup geometry | 174 | //Setup geometry |
175 | view->width = sibling->parent->width; | 175 | view->width = 0; |
176 | view->height = sibling->parent->height; | 176 | view->height = 0; |
177 | if (sibling->parent->layout == L_HORIZ) { | ||
178 | view->width /= sibling->parent->children->length; | ||
179 | } else { | ||
180 | view->height /= sibling->parent->children->length; | ||
181 | } | ||
182 | 177 | ||
183 | view->gaps = config->gaps_inner; | 178 | view->gaps = config->gaps_inner; |
184 | 179 | ||
diff --git a/sway/layout.c b/sway/layout.c index 6a4f8b45..192f09cf 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -194,7 +194,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
194 | //Calculate total width | 194 | //Calculate total width |
195 | for (i = 0; i < container->children->length; ++i) { | 195 | for (i = 0; i < container->children->length; ++i) { |
196 | int *old_width = &((swayc_t *)container->children->items[i])->width; | 196 | int *old_width = &((swayc_t *)container->children->items[i])->width; |
197 | if (*old_width == 0) { | 197 | if (*old_width <= 0) { |
198 | if (container->children->length > 1) { | 198 | if (container->children->length > 1) { |
199 | *old_width = width / (container->children->length - 1); | 199 | *old_width = width / (container->children->length - 1); |
200 | } else { | 200 | } else { |
@@ -221,12 +221,12 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
221 | //Calculate total height | 221 | //Calculate total height |
222 | for (i = 0; i < container->children->length; ++i) { | 222 | for (i = 0; i < container->children->length; ++i) { |
223 | int *old_height = &((swayc_t *)container->children->items[i])->height; | 223 | int *old_height = &((swayc_t *)container->children->items[i])->height; |
224 | if (*old_height <= 0) { | ||
224 | if (container->children->length > 1) { | 225 | if (container->children->length > 1) { |
225 | *old_height = height / (container->children->length - 1); | 226 | *old_height = height / (container->children->length - 1); |
226 | } else { | 227 | } else { |
227 | *old_height = height; | 228 | *old_height = height; |
228 | } | 229 | } |
229 | if (*old_height == 0) { | ||
230 | } | 230 | } |
231 | scale += *old_height; | 231 | scale += *old_height; |
232 | } | 232 | } |