From 72518f006c6bc8f5bc2458390b542453bb28151b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 27 Jan 2013 20:41:09 +0100 Subject: Make margins work again --- src/render.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/render.c b/src/render.c index f14d351..dd666d4 100644 --- a/src/render.c +++ b/src/render.c @@ -501,40 +501,44 @@ static int render_frame(struct frame *fr, cairo_t *cr) for ( i=0; inum_children; i++ ) { struct frame *ch = fr->children[i]; + double mtot; if ( ch->style != NULL ) { memcpy(&ch->lop, &ch->style->lop, sizeof(struct layout_parameters)); } + + mtot = ch->lop.margin_l + ch->lop.margin_r; switch ( ch->lop.w_units ) { case UNITS_SLIDE : - ch->w = ch->lop.w; + ch->w = ch->lop.w - mtot; break; case UNITS_FRAC : - ch->w = fr->w * ch->lop.w; + ch->w = fr->w * ch->lop.w - mtot; break; } + mtot = ch->lop.margin_t + ch->lop.margin_b; switch ( ch->lop.w_units ) { case UNITS_SLIDE : - ch->h = ch->lop.h; + ch->h = ch->lop.h - mtot; break; case UNITS_FRAC : - ch->h = fr->h * ch->lop.h; + ch->h = fr->h * ch->lop.h - mtot; break; } render_frame(ch, cr); - ch->x = ch->lop.x; - ch->y = ch->lop.y; + ch->x = ch->lop.x + ch->lop.margin_l; + ch->y = ch->lop.y + ch->lop.margin_t; } -- cgit v1.2.3