gui: avoid high CPU usage while waiting for input
- add a timeout to ev_get
- set timeout to 1 second when idle
- delay timeout for 15 frames to keep animation objects working
- stop kinetic scrolling immediately at end of list
Change-Id: I77138055c464b65b71e296f9c7ef63ea06809bc1
diff --git a/minuitwrp/events.c b/minuitwrp/events.c
index e2414a4..0309a9a 100644
--- a/minuitwrp/events.c
+++ b/minuitwrp/events.c
@@ -719,7 +719,7 @@
return 0;
}
-int ev_get(struct input_event *ev)
+int ev_get(struct input_event *ev, int timeout_ms)
{
int r;
unsigned n;
@@ -740,7 +740,7 @@
lastInputStat = curr;
}
- r = poll(ev_fds, ev_count, 0);
+ r = poll(ev_fds, ev_count, timeout_ms);
if(r > 0) {
for(n = 0; n < ev_count; n++) {