mirror of https://github.com/ipxe/ipxe.git
[mucurses] Implement curs_set() to control cursor visibility
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/17/head
parent
135bf35b11
commit
936971d0ed
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue