diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-04-17 00:15:52 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-04-17 00:18:34 -0400 |
commit | 07d4e10eae5d46f39cf26f57175c2b26524eefca (patch) | |
tree | 70ddcd815f83d48e4b4620995c66642ac64420b9 /window-xlib.c | |
parent | 502f14899885af2b8e96834f94a3bf638df0ad02 (diff) | |
download | runes-07d4e10eae5d46f39cf26f57175c2b26524eefca.tar.gz runes-07d4e10eae5d46f39cf26f57175c2b26524eefca.zip |
move this to the backend
Diffstat (limited to 'window-xlib.c')
-rw-r--r-- | window-xlib.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/window-xlib.c b/window-xlib.c index d529c79..c51ffe2 100644 --- a/window-xlib.c +++ b/window-xlib.c @@ -80,6 +80,7 @@ static void runes_window_backend_process_event(uv_work_t *req, int status); static void runes_window_backend_resize_window( RunesTerm *t, int width, int height); static void runes_window_backend_flush(RunesTerm *t); +static void runes_window_backend_draw_cursor(RunesTerm *t); void runes_window_backend_create_window(RunesTerm *t, int argc, char *argv[]) { @@ -437,6 +438,30 @@ static void runes_window_backend_flush(RunesTerm *t) { cairo_set_source_surface(t->backend_cr, cairo_get_target(t->cr), 0.0, 0.0); cairo_paint(t->backend_cr); - runes_display_draw_cursor(t); + runes_window_backend_draw_cursor(t); cairo_surface_flush(cairo_get_target(t->backend_cr)); } + +static void runes_window_backend_draw_cursor(RunesTerm *t) +{ + if (!t->hide_cursor) { + cairo_save(t->backend_cr); + cairo_set_source(t->backend_cr, t->cursorcolor); + if (t->unfocused) { + cairo_set_line_width(t->backend_cr, 1); + cairo_rectangle( + t->backend_cr, + t->col * t->fontx + 0.5, t->row * t->fonty + 0.5, + t->fontx, t->fonty); + cairo_stroke(t->backend_cr); + } + else { + cairo_rectangle( + t->backend_cr, + t->col * t->fontx, t->row * t->fonty, + t->fontx, t->fonty); + cairo_fill(t->backend_cr); + } + cairo_restore(t->backend_cr); + } +} |