Skip to content

Commit

Permalink
slideshow: Filter out non key events
Browse files Browse the repository at this point in the history
The driver could send EV_SYN events which need
to be filtered out, otherwise we would change
image too soon.

Change-Id: I954e8a4f228da4165a7af3fa544e95a22390a35b
  • Loading branch information
jredestig committed Oct 10, 2015
1 parent f7b1a8f commit 810ae48
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions slideshow/slideshow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 810ae48

Please sign in to comment.