X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_getch.c;h=e66602c28ce1c60fc8df896a626eaa82b65a7c66;hp=f8f3512d077439f88c86ac626f9ea9d7cd19e993;hb=b6d7123594f6959ad0a6602b3952d9e6abe261a0;hpb=0c9774ef662e2137933ac0c79077eaa9c8981357 diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c index f8f3512d..e66602c2 100644 --- a/ncurses/base/lib_getch.c +++ b/ncurses/base/lib_getch.c @@ -41,7 +41,7 @@ #include -MODULE_ID("$Id: lib_getch.c,v 1.76 2006/12/30 16:03:27 tom Exp $") +MODULE_ID("$Id: lib_getch.c,v 1.77 2007/02/25 00:43:54 tom Exp $") #include @@ -234,15 +234,16 @@ _nc_wgetch(WINDOW *win, 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)) @@ -281,12 +282,10 @@ _nc_wgetch(WINDOW *win, /* 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) @@ -318,7 +317,7 @@ _nc_wgetch(WINDOW *win, #ifdef NCURSES_WGETCH_EVENTS if (rc & 4) { *result = KEY_EVENT; - returnCode(OK); + returnCode(KEY_CODE_YES); } #endif if (!rc)