From 040441da7d90285e63bd920f4f416a0659e095be Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 7 Dec 2009 16:49:15 -0800 Subject: [PATCH] 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/include/syslinux/vesacon.h | 3 +++ 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 ++++++++++++-- com32/menu/menu.c | 5 +++++ com32/menu/menu.h | 1 + com32/menu/menumain.c | 2 ++ com32/menu/vesamenu.c | 5 +++++ 10 files changed, 35 insertions(+), 8 deletions(-) diff --git a/com32/include/syslinux/vesacon.h b/com32/include/syslinux/vesacon.h index 11d72f3..b99e649 100644 --- a/com32/include/syslinux/vesacon.h +++ b/com32/include/syslinux/vesacon.h @@ -28,9 +28,12 @@ #ifndef _SYSLINUX_VESACON_H #define _SYSLINUX_VESACON_H +#include + int vesacon_default_background(void); void vesacon_set_resolution(int, int); int vesacon_load_background(const char *); int vesacon_set_background(unsigned int); +void vesacon_cursor_enable(bool); #endif /* _SYSLINUX_VESACON_H */ diff --git a/com32/lib/sys/ansi.h b/com32/lib/sys/ansi.h index 40a531c..7ccafc8 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 7c2754e..b25f2d2 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 92d8901..85a9e97 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 0bd1abf..764228a 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 e85aba8..3769317 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) diff --git a/com32/menu/menu.c b/com32/menu/menu.c index 797189b..8f7af4d 100644 --- a/com32/menu/menu.c +++ b/com32/menu/menu.c @@ -33,6 +33,11 @@ void set_resolution(int x, int y) (void)y; } +void local_cursor_enable(bool enabled) +{ + (void)enabled; +} + void start_console(void) { console_ansi_raw(); diff --git a/com32/menu/menu.h b/com32/menu/menu.h index 72f5c99..52b4e4d 100644 --- a/com32/menu/menu.h +++ b/com32/menu/menu.h @@ -186,6 +186,7 @@ void parse_configs(char **argv); int draw_background(const char *filename); void set_resolution(int x, int y); void start_console(void); +void local_cursor_enable(bool); static inline int my_isspace(char c) { diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c index 32ed1b0..cbeb9a1 100644 --- a/com32/menu/menumain.c +++ b/com32/menu/menumain.c @@ -1115,8 +1115,10 @@ int main(int argc, char *argv[]) } for (;;) { + local_cursor_enable(true); cmdline = run_menu(); + local_cursor_enable(false); printf("\033[?25h\033[%d;1H\033[0m", END_ROW); if (cmdline) { diff --git a/com32/menu/vesamenu.c b/com32/menu/vesamenu.c index 22b4623..62e29bd 100644 --- a/com32/menu/vesamenu.c +++ b/com32/menu/vesamenu.c @@ -41,6 +41,11 @@ void set_resolution(int x, int y) vesacon_set_resolution(x, y); } +void local_cursor_enable(bool enabled) +{ + vesacon_cursor_enable(enabled); +} + void start_console(void) { openconsole(&dev_rawcon_r, &dev_vesaserial_w); -- 2.7.4