From de72b6d4d8f7106a9cbb611225dd0b726ba23720 Mon Sep 17 00:00:00 2001 From: that Date: Sun, 8 Feb 2015 08:55:00 +0100 Subject: 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 --- minuitwrp/events.c | 4 ++-- minuitwrp/minui.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'minuitwrp') diff --git a/minuitwrp/events.c b/minuitwrp/events.c index e2414a440..0309a9a21 100644 --- a/minuitwrp/events.c +++ b/minuitwrp/events.c @@ -719,7 +719,7 @@ static int vk_modify(struct ev *e, struct input_event *ev) 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 @@ int ev_get(struct input_event *ev) 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++) { diff --git a/minuitwrp/minui.h b/minuitwrp/minui.h index abebc1450..3aa486511 100644 --- a/minuitwrp/minui.h +++ b/minuitwrp/minui.h @@ -75,7 +75,7 @@ struct input_event; int ev_init(void); void ev_exit(void); -int ev_get(struct input_event *ev); +int ev_get(struct input_event *ev, int timeout_ms); int ev_has_mouse(void); // Resources -- cgit v1.2.3