small fix, default width/height 0

master
taiyu 9 years ago
parent b76dcf6e0f
commit f6e002fb8b

@ -172,13 +172,8 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) {
view->visible = true; view->visible = true;
view->is_focused = true; view->is_focused = true;
//Setup geometry //Setup geometry
view->width = sibling->parent->width; view->width = 0;
view->height = sibling->parent->height; view->height = 0;
if (sibling->parent->layout == L_HORIZ) {
view->width /= sibling->parent->children->length;
} else {
view->height /= sibling->parent->children->length;
}
view->gaps = config->gaps_inner; view->gaps = config->gaps_inner;

@ -194,7 +194,7 @@ void arrange_windows(swayc_t *container, int width, int height) {
//Calculate total width //Calculate total width
for (i = 0; i < container->children->length; ++i) { for (i = 0; i < container->children->length; ++i) {
int *old_width = &((swayc_t *)container->children->items[i])->width; int *old_width = &((swayc_t *)container->children->items[i])->width;
if (*old_width == 0) { if (*old_width <= 0) {
if (container->children->length > 1) { if (container->children->length > 1) {
*old_width = width / (container->children->length - 1); *old_width = width / (container->children->length - 1);
} else { } else {
@ -221,12 +221,12 @@ void arrange_windows(swayc_t *container, int width, int height) {
//Calculate total height //Calculate total height
for (i = 0; i < container->children->length; ++i) { for (i = 0; i < container->children->length; ++i) {
int *old_height = &((swayc_t *)container->children->items[i])->height; int *old_height = &((swayc_t *)container->children->items[i])->height;
if (*old_height <= 0) {
if (container->children->length > 1) { if (container->children->length > 1) {
*old_height = height / (container->children->length - 1); *old_height = height / (container->children->length - 1);
} else { } else {
*old_height = height; *old_height = height;
} }
if (*old_height == 0) {
} }
scale += *old_height; scale += *old_height;
} }

Loading…
Cancel
Save