]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[mucurses] Implement curs_set() to control cursor visibility
authorMichael Brown <mcb30@ipxe.org>
Mon, 2 Dec 2013 17:23:09 +0000 (17:23 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 2 Dec 2013 17:23:09 +0000 (17:23 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/hci/mucurses/ansi_screen.c
src/hci/mucurses/mucurses.c
src/hci/mucurses/wininit.c
src/include/curses.h

index ea9ab80cb099352544815b3fbdff44284f1fcda3..d3c685ed0d2a63431b6819d9c56ac7310da6884c 100644 (file)
@@ -86,6 +86,11 @@ static bool ansiscr_peek ( struct _curses_screen *scr __unused ) {
        return iskey();
 }
 
+static void ansiscr_cursor ( struct _curses_screen *scr __unused,
+                            int visibility ) {
+       printf ( "\033[?25%c", ( visibility ? 'h' : 'l' ) );
+}
+
 SCREEN _ansi_screen = {
        .init           = ansiscr_init,
        .exit           = ansiscr_exit,
@@ -94,4 +99,5 @@ SCREEN _ansi_screen = {
        .putc           = ansiscr_putc,
        .getc           = ansiscr_getc,
        .peek           = ansiscr_peek,
+       .cursor         = ansiscr_cursor,
 };
index ab9a6535ffad9e4a46bafb63aa97161159ebbd5f..c368b7637ce88818d0009ec45945363998a9335f 100644 (file)
@@ -144,3 +144,13 @@ int wmove ( WINDOW *win, int y, int x ) {
        _wupdcurs(win);
        return OK;
 }
+
+/**
+ * Set cursor visibility
+ *
+ * @v visibility cursor visibility
+ */
+int curs_set ( int visibility ) {
+       stdscr->scr->cursor ( stdscr->scr, visibility );
+       return OK;
+}
index 782e7b5c61d0d625757b2e5fff092bf1819d9471..b75abba44453e3205670b70e3f60cad83f75fe89 100644 (file)
@@ -31,6 +31,7 @@ WINDOW *initscr ( void ) {
 int endwin ( void ) {
        attrset ( 0 );
        color_set ( 0, NULL );
+       curs_set ( 1 );
        mvprintw ( ( LINES - 1 ), 0, "\n" );
        stdscr->scr->exit( stdscr->scr );
        return OK;
index 1230e0af30e5da38726353baafd4d0df66f337d6..c472d695f2bbee5bf1e47d85950266feae33a4d9 100644 (file)
@@ -75,6 +75,13 @@ typedef struct _curses_screen {
         * @ret FALSE   no character waiting in stream
         */
        bool ( *peek ) ( struct _curses_screen *scr );
+       /**
+        * Set cursor visibility
+        *
+        * @v scr       screen on which to operate
+        * @v visibility cursor visibility
+        */
+       void ( * cursor ) ( struct _curses_screen *scr, int visibility );
 } SCREEN;
 
 /** Curses Window struct */