diff options
author | N-R-K <nrk@disroot.org> | 2022-05-28 06:48:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-28 06:48:44 +0000 |
commit | 450797c573ef4ae42e93de5571319a5318142df9 (patch) | |
tree | 0d2fa59b315748900232fb3b27e2df8b4070da61 /util.c | |
parent | b4268fbf38d1f8433c73999466e116e68c7f81e7 (diff) |
fix: broken slideshow if redraw takes too long (#282)
currently the way check_timeout() is implemented, animate has higher
priority than slideshow. so if doing a redraw takes longer than the
frame delay of the animated image then it's going to continuously keep
animating and never reliably get to slideshow.
this issue can occur if the animated image has too fast of a delay or if
nsxiv is being run on a slow system where doing redraw takes too long.
the issue can be emulated by artificially slowing down img_render by
sticking a sleep in there.
diff --git a/main.c b/main.c
index 5dc52d4..0580011 100644
--- a/main.c
+++ b/main.c
@@ -441,6 +441,7 @@ void redraw(void)
if (mode == MODE_IMAGE) {
img_render(&img);
+ nanosleep(&(struct timespec){0, 62000000}, NULL); /* 62ms */
if (img.ss.on) {
t = img.ss.delay * 100;
if (img.multi.cnt > 0 && img.multi.animate)
make it so that slideshow has higher priority than animate to fix
the issue.
Closes: https://github.com/nsxiv/nsxiv/issues/281
Diffstat (limited to 'util.c')
0 files changed, 0 insertions, 0 deletions