Module Name: src Committed By: roy Date: Tue Jan 10 10:33:49 UTC 2017
Modified Files: src/lib/libcurses: refresh.c Log Message: When doupdate is called, check for typeahead input after N lines changed instead of aborting really early. This allows some screen update when holding the page down key for example. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/lib/libcurses/refresh.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libcurses/refresh.c diff -u src/lib/libcurses/refresh.c:1.84 src/lib/libcurses/refresh.c:1.85 --- src/lib/libcurses/refresh.c:1.84 Tue Jan 10 09:32:01 2017 +++ src/lib/libcurses/refresh.c Tue Jan 10 10:33:49 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: refresh.c,v 1.84 2017/01/10 09:32:01 roy Exp $ */ +/* $NetBSD: refresh.c,v 1.85 2017/01/10 10:33:49 roy Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94"; #else -__RCSID("$NetBSD: refresh.c,v 1.84 2017/01/10 09:32:01 roy Exp $"); +__RCSID("$NetBSD: refresh.c,v 1.85 2017/01/10 10:33:49 roy Exp $"); #endif #endif /* not lint */ @@ -58,6 +58,8 @@ int cellcmp( __LDATA *, __LDATA * ); int linecmp( __LDATA *, __LDATA *, size_t ); #endif /* HAVE_WCHAR */ +#define CHECK_INTERVAL 5 /* Change N lines before checking typeahead */ + #ifndef _CURSES_USE_MACROS /* @@ -498,7 +500,7 @@ doupdate(void) WINDOW *win; __LINE *wlp, *vlp; short wy; - int dnum, was_cleared; + int dnum, was_cleared, changed; #ifdef HAVE_WCHAR __LDATA *lp; nschar_t *np; @@ -595,16 +597,6 @@ doupdate(void) quickch(); } - if (_cursesi_screen->checkfd != -1) { - struct pollfd fds[1]; - - /* If we have input, abort the update. */ - fds[0].fd = _cursesi_screen->checkfd; - fds[0].events = POLLIN; - if (poll(fds, 1, 0) > 0) - goto cleanup; - } - #ifdef DEBUG { int i, j; @@ -657,6 +649,7 @@ doupdate(void) } #endif /* DEBUG */ + changed = 0; for (wy = 0; wy < win->maxy; wy++) { wlp = win->alines[wy]; vlp = _cursesi_screen->__virtscr->alines[win->begy + wy]; @@ -696,6 +689,21 @@ doupdate(void) #endif /* DEBUG */ wlp->flags &= ~(__ISDIRTY | __ISFORCED); } + + /* Check if we have input after + * changing N lines. */ + if (_cursesi_screen->checkfd != -1 && + ++changed == CHECK_INTERVAL) + { + struct pollfd fds[1]; + + /* If we have input, abort. */ + fds[0].fd = _cursesi_screen->checkfd; + fds[0].events = POLLIN; + if (poll(fds, 1, 0) > 0) + goto cleanup; + changed = 0; + } } }