From: David Herrmann Date: Mon, 1 Oct 2012 13:02:54 +0000 (+0200) Subject: wlt: terminal: draw background-margin when maximized X-Git-Tag: kmscon-7~420 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7b458df3d0c8e57cff2151831a1724f28bb6f38;p=platform%2Fupstream%2Fkmscon.git wlt: terminal: draw background-margin when maximized When maximized, we might have a small margin as we do not snap to grid-sizes. Therefore, we need to correctly draw the background color for these margins. Signed-off-by: David Herrmann --- diff --git a/src/wlt_terminal.c b/src/wlt_terminal.c index 11d1c9f..07c6d47 100644 --- a/src/wlt_terminal.c +++ b/src/wlt_terminal.c @@ -169,11 +169,43 @@ static int draw_cell(struct tsm_screen *scr, return 0; } +static void draw_background(struct wlt_terminal *term) +{ + uint8_t *dst; + uint32_t *line; + unsigned int i, j, w, h; + + /* when maximized, we might have a right and bottom border. So draw + * a black background for everything beyond grid-size. + * TODO: we should catch the color from tsm_screen instead of using + * black background by default. */ + w = term->buffer.width; + w /= term->font_normal->attr.width; + w *= term->font_normal->attr.width; + + h = term->buffer.height; + h /= term->font_normal->attr.height; + h *= term->font_normal->attr.height; + + dst = term->buffer.data; + for (i = 0; i < term->buffer.height; ++i) { + line = (uint32_t*)dst; + if (i >= h) + j = 0; + else + j = w; + for ( ; j < term->buffer.width; ++j) + line[j] = 0xff << 24; + dst += term->buffer.stride; + } +} + static void widget_redraw(struct wlt_widget *widget, unsigned int flags, void *data) { struct wlt_terminal *term = data; + draw_background(term); tsm_screen_draw(term->scr, NULL, draw_cell, NULL, term); }