diff options
author | zachir <zachir@librem.one> | 2023-02-20 03:57:35 -0600 |
---|---|---|
committer | zachir <zachir@librem.one> | 2023-02-20 03:57:35 -0600 |
commit | 32a99f67c4aebeceac8cd58edc63d9c59f1a3220 (patch) | |
tree | b7691f980c3a53d1e153535c60bc24606e7b237d /x.c | |
parent | c4aeb32df95c2ad8adfacae4b0627c65f9a9e929 (diff) |
add appsync patch
Diffstat (limited to 'x.c')
-rw-r--r-- | x.c | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -2164,6 +2164,9 @@ resize(XEvent *e) cresize(e->xconfigure.width, e->xconfigure.height); } +int tinsync(uint); +int ttyread_pending(); + void run(void) { @@ -2198,7 +2201,7 @@ run(void) FD_SET(ttyfd, &rfd); FD_SET(xfd, &rfd); - if (XPending(xw.dpy)) + if (XPending(xw.dpy) || ttyread_pending()) timeout = 0; /* existing events might not set xfd */ seltv.tv_sec = timeout / 1E3; @@ -2212,7 +2215,8 @@ run(void) } clock_gettime(CLOCK_MONOTONIC, &now); - if (FD_ISSET(ttyfd, &rfd)) + int ttyin = FD_ISSET(ttyfd, &rfd) || ttyread_pending(); + if (ttyin) ttyread(); xev = 0; @@ -2236,7 +2240,7 @@ 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 (ttyin || xev) { if (!drawing) { trigger = now; drawing = 1; @@ -2247,6 +2251,18 @@ run(void) continue; /* we have time, try to find idle */ } + 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; + } + /* idle detected or maxlatency exhausted -> draw */ timeout = -1; if (blinktimeout && tattrset(ATTR_BLINK)) { |