diff options
author | Johan Redestig <johan.redestig@sonymobile.com> | 2015-10-09 13:25:39 +0200 |
---|---|---|
committer | Johan Redestig <johan.redestig@sonymobile.com> | 2015-10-10 18:41:12 +0200 |
commit | 810ae48efc7e09bd06de0360b939dddb3c7e486a (patch) | |
tree | e4b3198da1b4d3e31c80cf61c592d2591ba6a58f /slideshow | |
parent | f7b1a8f34349291589f7c4dd255c838454bb53d4 (diff) | |
download | extras-810ae48efc7e09bd06de0360b939dddb3c7e486a.tar.gz |
slideshow: Filter out non key events
The driver could send EV_SYN events which need
to be filtered out, otherwise we would change
image too soon.
Change-Id: I954e8a4f228da4165a7af3fa544e95a22390a35b
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/slideshow.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/slideshow/slideshow.cpp b/slideshow/slideshow.cpp index d5b06ffc..86e3c1b6 100644 --- a/slideshow/slideshow.cpp +++ b/slideshow/slideshow.cpp @@ -118,13 +118,19 @@ int main(int argc, char **argv) while (optind < argc - 1) { draw(argv[optind++]); - if (ev_wait(timeout) == 0) { - ev_dispatch(); + start = time(NULL); + long int timeout_remaining = timeout; + do { + if (ev_wait(timeout_remaining) == 0) { + ev_dispatch(); - if (key_code != -1) { - input = true; + if (key_code != -1) { + input = true; + break; + } } - } + timeout_remaining -= (long int)(time(NULL) - start) * 1000; + } while (timeout_remaining > 0); }; /* if there was user input while showing the images, display the last |