X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_getch.c;h=22173242852452310b403dc4166abfb5e69e4766;hp=372d4ac7b2a830e7d9d1cb04d236d168ac614c72;hb=78e49873c69dc0494bb34c62f897f8b446584a33;hpb=1078c0231b8a58fbd2dd56b6e0a81b19d6b07f77 diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c index 372d4ac7..22173242 100644 --- a/ncurses/base/lib_getch.c +++ b/ncurses/base/lib_getch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,6 +30,7 @@ * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * ****************************************************************************/ /* @@ -41,7 +42,7 @@ #include -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.100 2009/02/15 00:36:00 tom Exp $") #include @@ -54,27 +55,36 @@ NCURSES_PUBLIC_VAR(ESCDELAY) (void) } #else #define GetEscdelay(sp) ESCDELAY -NCURSES_EXPORT_VAR(int) -ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ +NCURSES_EXPORT_VAR (int) + ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */ #endif #if NCURSES_EXT_FUNCS NCURSES_EXPORT(int) -set_escdelay(int value) +NCURSES_SP_NAME(set_escdelay) (NCURSES_SP_DCLx int value) { int code = OK; #if USE_REENTRANT - if (SP) { - SP->_ESCDELAY = value; + if (SP_PARM) { + SP_PARM->_ESCDELAY = value; } else { code = ERR; } #else + (void) SP_PARM; ESCDELAY = value; #endif return code; } + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +set_escdelay(int value) +{ + return NCURSES_SP_NAME(set_escdelay) (CURRENT_SCREEN, value); +} #endif +#endif /* NCURSES_EXT_FUNCS */ static int _nc_use_meta(WINDOW *win) @@ -260,15 +270,15 @@ recur_wrefresh(WINDOW *win) { #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 @@ -284,23 +294,27 @@ recur_wgetnstr(WINDOW *win, char *buf) 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; } @@ -377,7 +391,7 @@ _nc_wgetch(WINDOW *win, recur_wrefresh(win); - if (!win->_notimeout && (win->_delay >= 0 || sp->_cbreak > 1)) { + if (win->_notimeout || (win->_delay >= 0) || (sp->_cbreak > 1)) { if (head == -1) { /* fifo is empty */ int delay; int rc;