From 040441da7d90285e63bd920f4f416a0659e095be Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 7 Dec 2009 16:49:15 -0800 Subject: vesacon: don't display the cursor when doing a quiet boot Don't display the cursor on the graphical screen while doing a quiet boot. When doing a quiet boot we will probably show the graphical screen for a fair bit of time; as a result, we really don't want a completely bogus cursor blob on the bottom of the screen. Signed-off-by: H. Peter Anvin --- com32/lib/sys/ansi.h | 2 +- com32/lib/sys/ansicon_write.c | 6 +++--- com32/lib/sys/vesa/drawtxt.c | 2 +- com32/lib/sys/vesa/video.h | 3 ++- com32/lib/sys/vesacon_write.c | 14 ++++++++++++-- 5 files changed, 19 insertions(+), 8 deletions(-) (limited to 'com32/lib/sys') diff --git a/com32/lib/sys/ansi.h b/com32/lib/sys/ansi.h index 40a531cc..7ccafc8b 100644 --- a/com32/lib/sys/ansi.h +++ b/com32/lib/sys/ansi.h @@ -48,7 +48,7 @@ struct ansi_ops { void (*write_char) (int x, int y, uint8_t ch, const struct term_state * st); void (*showcursor) (const struct term_state * st); void (*scroll_up) (const struct term_state * st); - void (*set_cursor) (int x, int y, int visible); + void (*set_cursor) (int x, int y, bool visible); void (*beep) (void); }; diff --git a/com32/lib/sys/ansicon_write.c b/com32/lib/sys/ansicon_write.c index 7c2754e7..b25f2d2e 100644 --- a/com32/lib/sys/ansicon_write.c +++ b/com32/lib/sys/ansicon_write.c @@ -47,7 +47,7 @@ static void ansicon_erase(const struct term_state *, int, int, int, int); static void ansicon_write_char(int, int, uint8_t, const struct term_state *); static void ansicon_showcursor(const struct term_state *); static void ansicon_scroll_up(const struct term_state *); -static void ansicon_set_cursor(int, int, int); +static void ansicon_set_cursor(int, int, bool); static struct term_state ts; struct ansi_ops __ansicon_ops = { @@ -176,7 +176,7 @@ static void ansicon_showcursor(const struct term_state *st) __intcall(0x10, &ireg, NULL); } -static void ansicon_set_cursor(int x, int y, int visible) +static void ansicon_set_cursor(int x, int y, bool visible) { const int page = BIOS_PAGE; struct curxy xy = BIOS_CURXY[page]; @@ -198,7 +198,7 @@ static void ansicon_write_char(int x, int y, uint8_t ch, { static com32sys_t ireg; - ansicon_set_cursor(x, y, 0); + ansicon_set_cursor(x, y, false); ireg.eax.b[1] = 0x09; ireg.eax.b[0] = ch; diff --git a/com32/lib/sys/vesa/drawtxt.c b/com32/lib/sys/vesa/drawtxt.c index 92d89018..85a9e974 100644 --- a/com32/lib/sys/vesa/drawtxt.c +++ b/com32/lib/sys/vesa/drawtxt.c @@ -279,7 +279,7 @@ void __vesacon_write_char(int x, int y, uint8_t ch, attr_t attr) vesacon_touch(y, x, 1, 1); } -void __vesacon_set_cursor(int x, int y, int visible) +void __vesacon_set_cursor(int x, int y, bool visible) { struct vesa_char *ptr = &__vesacon_text_display [(y + 1) * (__vesacon_text_cols + 2) + (x + 1)]; diff --git a/com32/lib/sys/vesa/video.h b/com32/lib/sys/vesa/video.h index 0bd1abff..764228a0 100644 --- a/com32/lib/sys/vesa/video.h +++ b/com32/lib/sys/vesa/video.h @@ -28,6 +28,7 @@ #ifndef LIB_SYS_VESA_VIDEO_H #define LIB_SYS_VESA_VIDEO_H +#include #include #include "vesa.h" @@ -87,7 +88,7 @@ void __vesacon_scroll_up(int, attr_t); void __vesacon_write_char(int, int, uint8_t, attr_t); void __vesacon_redraw_text(void); void __vesacon_doit(void); -void __vesacon_set_cursor(int, int, int); +void __vesacon_set_cursor(int, int, bool); void __vesacon_copy_to_screen(size_t, const uint32_t *, size_t); void __vesacon_init_copy_to_screen(void); diff --git a/com32/lib/sys/vesacon_write.c b/com32/lib/sys/vesacon_write.c index e85aba88..37693177 100644 --- a/com32/lib/sys/vesacon_write.c +++ b/com32/lib/sys/vesacon_write.c @@ -48,6 +48,7 @@ static void vesacon_erase(const struct term_state *, int, int, int, int); static void vesacon_write_char(int, int, uint8_t, const struct term_state *); static void vesacon_showcursor(const struct term_state *); +static void vesacon_setcursor(int x, int y, bool visible); static void vesacon_scroll_up(const struct term_state *); static struct term_state ts; @@ -55,7 +56,7 @@ static struct ansi_ops op = { .erase = vesacon_erase, .write_char = vesacon_write_char, .showcursor = vesacon_showcursor, - .set_cursor = __vesacon_set_cursor, /* in drawtxt.c */ + .set_cursor = vesacon_setcursor, .scroll_up = vesacon_scroll_up, .beep = __ansicon_beep, }; @@ -141,9 +142,18 @@ static void vesacon_write_char(int x, int y, uint8_t ch, } /* Show or hide the cursor */ +static bool cursor_enabled = true; +void vesacon_cursor_enable(bool enabled) +{ + cursor_enabled = enabled; +} static void vesacon_showcursor(const struct term_state *st) { - __vesacon_set_cursor(st->xy.x, st->xy.y, st->cursor); + vesacon_setcursor(st->xy.x, st->xy.y, st->cursor); +} +static void vesacon_setcursor(int x, int y, bool visible) +{ + __vesacon_set_cursor(x, y, visible && cursor_enabled); } static void vesacon_scroll_up(const struct term_state *st) -- cgit v1.2.1