auto-sync: draw on idle to avoid flicker/tearing
st could easily tear/flicker with animation or other unattended output. This commit eliminates most of the tear/flicker. Before this commit, the display timing had two "modes": - Interactively, st was waiting fixed `1000/xfps` ms after forwarding the kb/mouse event to the application and before drawing. - Unattended, and specifically with animations, the draw frequency was throttled to `actionfps`. Animation at a higher rate would throttle and likely tear, and at lower rates it was tearing big frames (specifically, when one `read` didn't get a full "frame"). The interactive behavior was decent, but it was impossible to get good unattended-draw behavior even with carefully chosen configuration. This commit changes the behavior such that it draws on idle instead of using fixed latency/frequency. This means that it tries to draw only when it's very likely that the application has completed its output (or after some duration without idle), so it mostly succeeds to avoid tear, flicker, and partial drawing. The config values minlatency/maxlatency replace xfps/actionfps and define the range which the algorithm is allowed to wait from the initial draw-trigger until the actual draw. The range enables the flexibility to choose when to draw - when least likely to flicker. It also unifies the interactive and unattended behavior and config values, which makes the code simpler as well - without sacrificing latency during interactive use, because typically interactively idle arrives very quickly, so the wait is typically minlatency. While it only slighly improves interactive behavior, for animations and other unattended-drawing it improves greatly, as it effectively adapts to any [animation] output rate without tearing, throttling, redundant drawing, or unnecessary delays (sounds impossible, but it works).
This commit is contained in:
parent
87fe11cfcc
commit
5c7d8ab1ad
10 changed files with 75 additions and 287 deletions
|
|
@ -102,15 +102,6 @@
|
|||
*/
|
||||
#define FONT2_PATCH 0
|
||||
|
||||
/* This patch creates a global flag which is set when a keypress is sent
|
||||
* from X which forces the terminal to check for new data on the tty fd on
|
||||
* every return from pselect(). When new data read from the tty results in
|
||||
* a line being redrawn, the flag is reset. This results in a less input lag
|
||||
* when typing on the terminal.
|
||||
* https://lists.suckless.org/hackers/2004/17221.html
|
||||
*/
|
||||
#define FORCE_REDRAW_AFTER_KEYPRESS 0
|
||||
|
||||
/* Hide the X cursor whenever a key is pressed and show it back when the mouse is moved in
|
||||
* the terminal window.
|
||||
* https://st.suckless.org/patches/hidecursor/
|
||||
|
|
@ -203,30 +194,6 @@
|
|||
*/
|
||||
#define VERTCENTER_PATCH 0
|
||||
|
||||
/* On receiving a terminal bell event this patch briefly inverts the window content colors.
|
||||
* You may need to reduce the xfps value in config.h to less or equal to that of the refresh
|
||||
* rate of your monitor for this to be noticeble.
|
||||
* The visualbell 2 and 3 patches takes precedence over this patch.
|
||||
* https://st.suckless.org/patches/visualbell/
|
||||
*/
|
||||
#define VISUALBELL_1_PATCH 0
|
||||
|
||||
/* On receiving a terminal bell event this patch either:
|
||||
* - briefly inverts the window content colors across the whole terminal or
|
||||
* - briefly inverts the window content colors across the window border
|
||||
* The visualbell 3 patch takes precedence over this patch.
|
||||
* https://st.suckless.org/patches/visualbell/
|
||||
*/
|
||||
#define VISUALBELL_2_PATCH 0
|
||||
|
||||
/* On receiving a terminal bell event this patch either:
|
||||
* - briefly inverts the window content colors across the whole terminal or
|
||||
* - briefly inverts the window content colors across the window border or
|
||||
* - draws a (configurable) circle as a visual bell indicator
|
||||
* https://st.suckless.org/patches/visualbell/
|
||||
*/
|
||||
#define VISUALBELL_3_PATCH 0
|
||||
|
||||
/* This patch allows user to specify the initial path st should use as the working directory.
|
||||
* https://st.suckless.org/patches/workingdir/
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue