From a56997aefb957c4f4ef9ce35139a366822235430 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 19 Aug 2008 11:38:57 +0200 Subject: [PATCH] draw: support for top margin Signed-off-by: Julien Danjou --- awesomerc.5.txt | 1 + common/draw.c | 4 +++- common/draw.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/awesomerc.5.txt b/awesomerc.5.txt index 49db4153..37a44b89 100644 --- a/awesomerc.5.txt +++ b/awesomerc.5.txt @@ -55,6 +55,7 @@ List of awesome markup and their attribute: * margin - left: left margin in pixel - right: right margin in pixel + - top: top margin in pixel * text - align: text alignment - shadow: shadow color diff --git a/common/draw.c b/common/draw.c index 6b928b8a..232b48a5 100644 --- a/common/draw.c +++ b/common/draw.c @@ -296,6 +296,8 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem, case A_TK_RIGHT: data->margin.right = atoi(*values); break; + case A_TK_TOP: + data->margin.top = atoi(*values); default: break; } @@ -419,7 +421,7 @@ draw_text(draw_context_t *ctx, font_t *font, /* + 1 is added for rounding, so that in any case of doubt we rather draw * the text 1px lower than too high which usually results in a better type * face */ - y = area.y + (ctx->height - font->height + 1) / 2; + y = area.y + (ctx->height - font->height + 1) / 2 + pdata->margin.top; switch(pdata->align) { diff --git a/common/draw.h b/common/draw.h index 3f5a9968..a61f97b7 100644 --- a/common/draw.h +++ b/common/draw.h @@ -179,7 +179,7 @@ typedef struct alignment_t align; struct { - int left, right; + int left, right, top; } margin; bool has_bg_color; xcolor_t bg_color;