From f6e002fb8b664d80ef10126f6a204ffbb2f192df Mon Sep 17 00:00:00 2001 From: taiyu Date: Thu, 20 Aug 2015 04:57:01 -0700 Subject: small fix, default width/height 0 --- sway/container.c | 9 ++------- 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) { view->visible = true; view->is_focused = true; //Setup geometry - view->width = sibling->parent->width; - view->height = sibling->parent->height; - if (sibling->parent->layout == L_HORIZ) { - view->width /= sibling->parent->children->length; - } else { - view->height /= sibling->parent->children->length; - } + view->width = 0; + view->height = 0; view->gaps = config->gaps_inner; 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) { //Calculate total width for (i = 0; i < container->children->length; ++i) { int *old_width = &((swayc_t *)container->children->items[i])->width; - if (*old_width == 0) { + if (*old_width <= 0) { if (container->children->length > 1) { *old_width = width / (container->children->length - 1); } else { @@ -221,12 +221,12 @@ void arrange_windows(swayc_t *container, int width, int height) { //Calculate total height for (i = 0; i < container->children->length; ++i) { int *old_height = &((swayc_t *)container->children->items[i])->height; + if (*old_height <= 0) { if (container->children->length > 1) { *old_height = height / (container->children->length - 1); } else { *old_height = height; } - if (*old_height == 0) { } scale += *old_height; } -- cgit v1.2.3-70-g09d2