+static int kgetch(SCREEN *, bool EVENTLIST_2nd(_nc_eventlist *));
+
+static void
+recur_wrefresh(WINDOW *win)
+{
+#ifdef USE_PTHREADS
+ SCREEN *sp = _nc_screen_of(win);
+ if (_nc_use_pthreads && sp != CURRENT_SCREEN) {
+ SCREEN *save_SP;
+
+ /* temporarily switch to the window's screen to check/refresh */
+ _nc_lock_global(curses);
+ save_SP = CURRENT_SCREEN;
+ _nc_set_screen(sp);
+ recur_wrefresh(win);
+ _nc_set_screen(save_SP);
+ _nc_unlock_global(curses);
+ } else
+#endif
+ if ((is_wintouched(win) || (win->_flags & _HASMOVED))
+ && !(win->_flags & _ISPAD)) {
+ wrefresh(win);
+ }
+}
+
+static int
+recur_wgetnstr(WINDOW *win, char *buf)
+{
+ SCREEN *sp = _nc_screen_of(win);
+ int rc;