aboutsummaryrefslogtreecommitdiffstats
path: root/src/display.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-27 23:59:28 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-27 23:59:28 -0400
commit7e863cafd9f4c40893eb0e4d9e9883e54ab19255 (patch)
tree2fb7eb2e0073f5bd7216301e3365e489d044c8b3 /src/display.c
parentf74888f96379a4e1911002282a623cf40325a8fd (diff)
downloadrunes-7e863cafd9f4c40893eb0e4d9e9883e54ab19255.tar.gz
runes-7e863cafd9f4c40893eb0e4d9e9883e54ab19255.zip
stop drawing a transparent cursor
Diffstat (limited to 'src/display.c')
-rw-r--r--src/display.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/display.c b/src/display.c
index 02e7d1a..e6cb1d9 100644
--- a/src/display.c
+++ b/src/display.c
@@ -16,7 +16,7 @@ void runes_display_init(RunesTerm *t)
{
runes_display_recalculate_font_metrics(t);
- t->cursorcolor = cairo_pattern_create_rgba(0.0, 1.0, 0.0, 0.5);
+ t->cursorcolor = cairo_pattern_create_rgb(0.0, 1.0, 0.0);
}
void runes_display_set_window_size(RunesTerm *t)
@@ -104,6 +104,41 @@ void runes_display_draw_screen(RunesTerm *t)
runes_window_backend_request_flush(t);
}
+void runes_display_draw_cursor(RunesTerm *t, cairo_t *cr)
+{
+ if (!t->scr.hide_cursor) {
+ int row = t->scr.cur.row, col = t->scr.cur.col;
+
+ if (col >= t->scr.max.col) {
+ col = t->scr.max.col - 1;
+ }
+
+ cairo_save(cr);
+ cairo_set_source(cr, t->cursorcolor);
+ if (t->unfocused) {
+ cairo_set_line_width(cr, 1);
+ cairo_rectangle(
+ cr,
+ col * t->fontx + 0.5, row * t->fonty + 0.5,
+ t->fontx, t->fonty);
+ cairo_stroke(cr);
+ }
+ else {
+ struct runes_cell *cell = &t->scr.rows[row].cells[col];
+
+ cairo_rectangle(
+ cr,
+ col * t->fontx, row * t->fonty,
+ t->fontx, t->fonty);
+ cairo_fill(cr);
+ runes_display_draw_glyph(
+ t, cr, t->bgdefault, cell->attrs,
+ cell->contents, cell->len, row, col);
+ }
+ cairo_restore(cr);
+ }
+}
+
void runes_display_cleanup(RunesTerm *t)
{
g_object_unref(t->layout);
@@ -261,7 +296,7 @@ static void runes_display_draw_glyph(
cairo_move_to(cr, col * t->fontx, row * t->fonty);
cairo_set_source(cr, pattern);
pango_layout_set_text(t->layout, buf, len);
- pango_cairo_update_layout(t->cr, t->layout);
- pango_cairo_show_layout(t->cr, t->layout);
+ pango_cairo_update_layout(cr, t->layout);
+ pango_cairo_show_layout(cr, t->layout);
cairo_restore(cr);
}