#include <curses.priv.h>
-MODULE_ID("$Id: lib_getch.c,v 1.95 2008/06/07 15:52:51 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.98 2008/08/16 21:20:48 Werner.Fink Exp $")
#include <fifo_defs.h>
{
#ifdef USE_PTHREADS
SCREEN *sp = _nc_screen_of(win);
- if (sp != SP) {
+ if (_nc_use_pthreads && sp != SP) {
SCREEN *save_SP;
/* temporarily switch to the window's screen to check/refresh */
_nc_lock_global(curses);
save_SP = SP;
- SP = sp;
+ _nc_set_screen(sp);
recur_wrefresh(win);
- SP = save_SP;
+ _nc_set_screen(save_SP);
_nc_unlock_global(curses);
} else
#endif
SCREEN *sp = _nc_screen_of(win);
int rc;
+ if (sp != 0) {
#ifdef USE_PTHREADS
- if (sp != SP) {
- SCREEN *save_SP;
-
- /* temporarily switch to the window's screen to get cooked input */
- _nc_lock_global(curses);
- save_SP = SP;
- SP = sp;
- rc = recur_wgetnstr(win, buf);
- SP = save_SP;
- _nc_unlock_global(curses);
- } else
+ if (_nc_use_pthreads && sp != SP) {
+ SCREEN *save_SP;
+
+ /* temporarily switch to the window's screen to get cooked input */
+ _nc_lock_global(curses);
+ save_SP = SP;
+ _nc_set_screen(sp);
+ rc = recur_wgetnstr(win, buf);
+ _nc_set_screen(save_SP);
+ _nc_unlock_global(curses);
+ } else
#endif
- {
- sp->_called_wgetch = TRUE;
- rc = wgetnstr(win, buf, MAXCOLUMNS);
- sp->_called_wgetch = FALSE;
+ {
+ sp->_called_wgetch = TRUE;
+ rc = wgetnstr(win, buf, MAXCOLUMNS);
+ sp->_called_wgetch = FALSE;
+ }
+ } else {
+ rc = ERR;
}
return rc;
}