aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-01-27 20:41:09 +0100
committerThomas White <taw@bitwiz.org.uk>2013-01-27 20:41:09 +0100
commit72518f006c6bc8f5bc2458390b542453bb28151b (patch)
tree49d84937d0e478c93216d2b8a5799f79ac300860
parent09a240e765abbaa58365158acffaf26f1c7fee32 (diff)
Make margins work again
-rw-r--r--src/render.c16
1 files 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; i<fr->num_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;
}