Browse Source

[mucurses] Implement curs_set() to control cursor visibility

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
936971d0ed

+ 6
- 0
src/hci/mucurses/ansi_screen.c View File

86
 	return iskey();
86
 	return iskey();
87
 }
87
 }
88
 
88
 
89
+static void ansiscr_cursor ( struct _curses_screen *scr __unused,
90
+			     int visibility ) {
91
+	printf ( "\033[?25%c", ( visibility ? 'h' : 'l' ) );
92
+}
93
+
89
 SCREEN _ansi_screen = {
94
 SCREEN _ansi_screen = {
90
 	.init		= ansiscr_init,
95
 	.init		= ansiscr_init,
91
 	.exit		= ansiscr_exit,
96
 	.exit		= ansiscr_exit,
94
 	.putc		= ansiscr_putc,
99
 	.putc		= ansiscr_putc,
95
 	.getc		= ansiscr_getc,
100
 	.getc		= ansiscr_getc,
96
 	.peek		= ansiscr_peek,
101
 	.peek		= ansiscr_peek,
102
+	.cursor		= ansiscr_cursor,
97
 };
103
 };

+ 10
- 0
src/hci/mucurses/mucurses.c View File

144
 	_wupdcurs(win);
144
 	_wupdcurs(win);
145
 	return OK;
145
 	return OK;
146
 }
146
 }
147
+
148
+/**
149
+ * Set cursor visibility
150
+ *
151
+ * @v visibility cursor visibility
152
+ */
153
+int curs_set ( int visibility ) {
154
+	stdscr->scr->cursor ( stdscr->scr, visibility );
155
+	return OK;
156
+}

+ 1
- 0
src/hci/mucurses/wininit.c View File

31
 int endwin ( void ) {
31
 int endwin ( void ) {
32
 	attrset ( 0 );
32
 	attrset ( 0 );
33
 	color_set ( 0, NULL );
33
 	color_set ( 0, NULL );
34
+	curs_set ( 1 );
34
 	mvprintw ( ( LINES - 1 ), 0, "\n" );
35
 	mvprintw ( ( LINES - 1 ), 0, "\n" );
35
 	stdscr->scr->exit( stdscr->scr );
36
 	stdscr->scr->exit( stdscr->scr );
36
 	return OK;
37
 	return OK;

+ 7
- 0
src/include/curses.h View File

75
 	 * @ret FALSE	no character waiting in stream
75
 	 * @ret FALSE	no character waiting in stream
76
 	 */
76
 	 */
77
 	bool ( *peek ) ( struct _curses_screen *scr );
77
 	bool ( *peek ) ( struct _curses_screen *scr );
78
+	/**
79
+	 * Set cursor visibility
80
+	 *
81
+	 * @v scr	screen on which to operate
82
+	 * @v visibility cursor visibility
83
+	 */
84
+	void ( * cursor ) ( struct _curses_screen *scr, int visibility );
78
 } SCREEN;
85
 } SCREEN;
79
 
86
 
80
 /** Curses Window struct */
87
 /** Curses Window struct */

Loading…
Cancel
Save