vesacon: don't display the cursor when doing a quiet boot
authorH. Peter Anvin <hpa@zytor.com>
Tue, 8 Dec 2009 00:49:15 +0000 (16:49 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 8 Dec 2009 00:49:15 +0000 (16:49 -0800)
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 <hpa@zytor.com>
com32/include/syslinux/vesacon.h
com32/lib/sys/ansi.h
com32/lib/sys/ansicon_write.c
com32/lib/sys/vesa/drawtxt.c
com32/lib/sys/vesa/video.h
com32/lib/sys/vesacon_write.c
com32/menu/menu.c
com32/menu/menu.h
com32/menu/menumain.c
com32/menu/vesamenu.c

index 11d72f3..b99e649 100644 (file)
 #ifndef _SYSLINUX_VESACON_H
 #define _SYSLINUX_VESACON_H
 
+#include <stdbool.h>
+
 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 */
index 40a531c..7ccafc8 100644 (file)
@@ -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);
 };
 
index 7c2754e..b25f2d2 100644 (file)
@@ -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;
index 92d8901..85a9e97 100644 (file)
@@ -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)];
index 0bd1abf..764228a 100644 (file)
@@ -28,6 +28,7 @@
 #ifndef LIB_SYS_VESA_VIDEO_H
 #define LIB_SYS_VESA_VIDEO_H
 
+#include <stdbool.h>
 #include <colortbl.h>
 #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);
 
index e85aba8..3769317 100644 (file)
@@ -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)
index 797189b..8f7af4d 100644 (file)
@@ -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();
index 72f5c99..52b4e4d 100644 (file)
@@ -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)
 {
index 32ed1b0..cbeb9a1 100644 (file)
@@ -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) {
index 22b4623..62e29bd 100644 (file)
@@ -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);