summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-11-07 17:07:46 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-11-07 17:07:46 +0100
commit94feb37301c336070fbc1c5d2fee40a890ae07e5 (patch)
tree324a0f11f2d927708202f604b638659355094222
parentae3c976e5f6fdeb6755f3ae39d7ca38d9ac57388 (diff)
Draw padding
We need to draw the padding-space around the main cells if our size is not a multiple of the cell size. We retrieve the default bg color via a new libtsm helper. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--src/wlt_render.c19
-rw-r--r--src/wlterm.c1
-rw-r--r--src/wlterm.h1
3 files changed, 21 insertions, 0 deletions
diff --git a/src/wlt_render.c b/src/wlt_render.c
index f89885d..33b99f6 100644
--- a/src/wlt_render.c
+++ b/src/wlt_render.c
@@ -354,6 +354,8 @@ static int wlt_renderer_draw_cell(struct tsm_screen *screen, uint32_t id,
void wlt_renderer_draw(const struct wlt_draw_ctx *ctx)
{
struct wlt_renderer *rend = ctx->rend;
+ struct tsm_screen_attr attr;
+ unsigned int w, h;
/* cairo is *way* too slow to render all masks efficiently. Therefore,
* we render all glyphs into a shadow buffer on the CPU and then tell
@@ -367,4 +369,21 @@ void wlt_renderer_draw(const struct wlt_draw_ctx *ctx)
cairo_set_source_surface(ctx->cr, rend->surface, 0, 0);
cairo_paint(ctx->cr);
+
+ /* draw padding */
+ w = tsm_screen_get_width(ctx->screen);
+ h = tsm_screen_get_height(ctx->screen);
+ tsm_vte_get_def_attr(ctx->vte, &attr);
+ cairo_set_source_rgb(ctx->cr,
+ attr.br / 255.0,
+ attr.bg / 255.0,
+ attr.bb / 255.0);
+ cairo_move_to(ctx->cr, w * ctx->cell_width, 0);
+ cairo_line_to(ctx->cr, w * ctx->cell_width, h * ctx->cell_height);
+ cairo_line_to(ctx->cr, 0, h * ctx->cell_height);
+ cairo_line_to(ctx->cr, 0, rend->height);
+ cairo_line_to(ctx->cr, rend->width, rend->height);
+ cairo_line_to(ctx->cr, rend->width, 0);
+ cairo_close_path(ctx->cr);
+ cairo_fill(ctx->cr);
}
diff --git a/src/wlterm.c b/src/wlterm.c
index a50ad8c..2301c37 100644
--- a/src/wlterm.c
+++ b/src/wlterm.c
@@ -334,6 +334,7 @@ static gboolean term_redraw_cb(GtkWidget *widget, cairo_t *cr, gpointer data)
ctx.cell_width = term->cell_width;
ctx.cell_height = term->cell_height;
ctx.screen = term->screen;
+ ctx.vte = term->vte;
cairo_clip_extents(cr, &ctx.x1, &ctx.y1, &ctx.x2, &ctx.y2);
wlt_renderer_draw(&ctx);
diff --git a/src/wlterm.h b/src/wlterm.h
index 0c9efd0..d3c2c8d 100644
--- a/src/wlterm.h
+++ b/src/wlterm.h
@@ -89,6 +89,7 @@ struct wlt_draw_ctx {
unsigned int cell_width;
unsigned int cell_height;
struct tsm_screen *screen;
+ struct tsm_vte *vte;
double x1;
double y1;