7 /* This is the console driver for systems that support the ncurses
11 /* Actually, this should work for curses, as well. But there may be
12 individual functions that are unsupported in plain curses or other
13 variants. Those should be detected and special-cased by autoconf.
16 /* When creating new drivers, you need to assign all the functions that
17 that driver supports into the driver struct. If it is a supplementary
18 driver, it should make sure to perserve the old values.
23 #undef ERR /* Use ncurses's err() */
26 SCREEN
*ncurses_screen
;
30 /* This should be the root driver so we can ignore anything
31 already in the struct. */
33 driver
.norefresh
= FALSE
;
35 driver
.init
= NCURSES_Init
;
36 driver
.write
= NCURSES_Write
;
37 driver
.close
= NCURSES_Close
;
38 driver
.moveCursor
= NCURSES_MoveCursor
;
39 driver
.getCursorPosition
= NCURSES_GetCursorPosition
;
40 driver
.getCharacterAtCursor
= NCURSES_GetCharacterAtCursor
;
41 driver
.clearScreen
= NCURSES_ClearScreen
;
43 driver
.checkForKeystroke
= NCURSES_CheckForKeystroke
;
44 driver
.getKeystroke
= NCURSES_GetKeystroke
;
46 driver
.refresh
= NCURSES_Refresh
;
51 ncurses_screen
= newterm("xterm", driver
.console_out
,
53 set_term(ncurses_screen
);
57 intrflush(stdscr
, FALSE
);
59 nodelay(stdscr
, TRUE
);
62 void NCURSES_Write(char output
, int fg
, int bg
, int attribute
)
64 /* We can discard all extended information. */
65 waddch(stdscr
, output
);
73 void NCURSES_GetKeystroke(char *scan
, char *ascii
)
75 while (!NCURSES_CheckForKeystroke(scan
, ascii
))
76 {} /* Wait until keystroke is detected */
78 /* When it is detected, we will already have the right value
79 in scan and ascii, but we need to take this keystroke
84 int NCURSES_CheckForKeystroke(char *scan
, char *ascii
)
86 /* We don't currently support scan codes here */
89 temp
= wgetch(stdscr
);
96 ungetch(temp
); /* Keystroke not removed from buffer */
102 void NCURSES_MoveCursor(char row
, char col
)
104 wmove(stdscr
, row
, col
);
107 void NCURSES_GetCursorPosition(char *row
, char *col
)
111 getyx(stdscr
, trow
, tcol
); /* MACRO, no need to pass pointer */
117 void NCURSES_GetCharacterAtCursor(char *ch
, int *fg_color
, int
118 *bg_color
, int *attribute
)
120 /* We will eventually have to convert the color data */
121 *ch
= (char) winch(stdscr
);
127 void NCURSES_Refresh()
132 void NCURSES_ClearScreen()
137 #endif /* WINE_NCURSES */