Fix timeout handling in wincurses and ncurses
Handle timeouts and fix input polling in curses builds