#include <curses.priv.h>
-MODULE_ID("$Id: lib_getch.c,v 1.75 2006/03/04 20:06:09 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.77 2007/02/25 00:43:54 tom Exp $")
#include <fifo_defs.h>
T((T_CALLED("_nc_wgetch(%p)"), win));
*result = 0;
- if (win == 0 || SP == 0)
+ if (win == 0 || SP == 0) {
returnCode(ERR);
+ }
if (cooked_key_in_fifo()) {
if (wgetch_should_refresh(win))
wrefresh(win);
*result = fifo_pull();
- returnCode(OK);
+ returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
#ifdef NCURSES_WGETCH_EVENTS
if (evl && (evl->count == 0))
/* Return it first */
if (rc == KEY_EVENT) {
*result = rc;
- returnCode(OK);
- }
+ } else
#endif
-
- *result = fifo_pull();
- returnCode(OK);
+ *result = fifo_pull();
+ returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
if (win->_use_keypad != SP->_keypad_on)
#ifdef NCURSES_WGETCH_EVENTS
if (rc & 4) {
*result = KEY_EVENT;
- returnCode(OK);
+ returnCode(KEY_CODE_YES);
}
#endif
if (!rc)
static int
kgetch(EVENTLIST_0th(_nc_eventlist * evl))
{
- struct tries *ptr;
+ TRIES *ptr;
int ch = 0;
int timeleft = ESCDELAY;