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 <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-10-01 15:02:54 +02:00
parent bcb058134f
commit c7b458df3d

View File

@ -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);
}