Adding sync patch ref. #21
This commit is contained in:
parent
3b88d65645
commit
56e208e0de
10 changed files with 141 additions and 2 deletions
31
x.c
31
x.c
|
|
@ -2539,7 +2539,11 @@ run(void)
|
|||
FD_SET(ttyfd, &rfd);
|
||||
FD_SET(xfd, &rfd);
|
||||
|
||||
#if SYNC_PATCH
|
||||
if (XPending(xw.dpy) || ttyread_pending())
|
||||
#else
|
||||
if (XPending(xw.dpy))
|
||||
#endif // SYNC_PATCH
|
||||
timeout = 0; /* existing events might not set xfd */
|
||||
|
||||
seltv.tv_sec = timeout / 1E3;
|
||||
|
|
@ -2553,8 +2557,14 @@ run(void)
|
|||
}
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
#if SYNC_PATCH
|
||||
int ttyin = FD_ISSET(ttyfd, &rfd) || ttyread_pending();
|
||||
if (ttyin)
|
||||
ttyread();
|
||||
#else
|
||||
if (FD_ISSET(ttyfd, &rfd))
|
||||
ttyread();
|
||||
#endif // SYNC_PATCH
|
||||
|
||||
xev = 0;
|
||||
while (XPending(xw.dpy)) {
|
||||
|
|
@ -2577,7 +2587,12 @@ run(void)
|
|||
* maximum latency intervals during `cat huge.txt`, and perfect
|
||||
* sync with periodic updates from animations/key-repeats/etc.
|
||||
*/
|
||||
if (FD_ISSET(ttyfd, &rfd) || xev) {
|
||||
#if SYNC_PATCH
|
||||
if (ttyin || xev)
|
||||
#else
|
||||
if (FD_ISSET(ttyfd, &rfd) || xev)
|
||||
#endif // SYNC_PATCH
|
||||
{
|
||||
if (!drawing) {
|
||||
trigger = now;
|
||||
#if BLINKING_CURSOR_PATCH
|
||||
|
|
@ -2594,6 +2609,20 @@ run(void)
|
|||
continue; /* we have time, try to find idle */
|
||||
}
|
||||
|
||||
#if SYNC_PATCH
|
||||
if (tinsync(su_timeout)) {
|
||||
/*
|
||||
* on synchronized-update draw-suspension: don't reset
|
||||
* drawing so that we draw ASAP once we can (just after
|
||||
* ESU). it won't be too soon because we already can
|
||||
* draw now but we skip. we set timeout > 0 to draw on
|
||||
* SU-timeout even without new content.
|
||||
*/
|
||||
timeout = minlatency;
|
||||
continue;
|
||||
}
|
||||
#endif // SYNC_PATCH
|
||||
|
||||
/* idle detected or maxlatency exhausted -> draw */
|
||||
timeout = -1;
|
||||
#if BLINKING_CURSOR_PATCH
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue