/* * GUI input routine called by gui_wait_for_chars(). Waits for a character * from the keyboard. * wtime == -1 Wait forever. * wtime == 0 This should never happen. * wtime > 0 Wait wtime milliseconds for a character. * Returns OK if a character was found to be available within the given time, * or FAIL otherwise. */ int gui_mch_wait_for_chars(long wtime) { if (!vim_is_input_buf_empty()) { return OK; } return vimshell->processEvents(wtime, true); }
/* * GUI input routine called by gui_wait_for_chars(). Waits for a character * from the keyboard. * wtime == -1 Wait forever. * wtime == 0 This should never happen. * wtime > 0 Wait wtime milliseconds for a character. * Returns OK if a character was found to be available within the given time, * or FAIL otherwise. */ int gui_mch_wait_for_chars(long wtime) { if (!vim_is_input_buf_empty()) return OK; if ( wtime == -1 ) { QApplication::processEvents( QEventLoop::WaitForMoreEvents); return OK; } else { // @see gui_mch_update QTime t; t.start(); do { QApplication::processEvents( QEventLoop::WaitForMoreEvents, wtime ); if (!vim_is_input_buf_empty()) { return OK; } } while( t.elapsed() < wtime ); } return FAIL; }