summaryrefslogtreecommitdiffstats
path: root/minui/minui.h
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2011-08-30 11:59:45 -0700
committerDima Zavin <dima@android.com>2011-09-02 14:55:20 -0700
commitbc29063bf4e2312133d91e211dfe9c86ee811489 (patch)
tree7bc5a29a8f1201e3af7ab25846398722e8b05dc3 /minui/minui.h
parent4daf48a10bcba1fa92b8b3564504b90807c72274 (diff)
downloadbootable_recovery-bc29063bf4e2312133d91e211dfe9c86ee811489.zip
bootable_recovery-bc29063bf4e2312133d91e211dfe9c86ee811489.tar.gz
bootable_recovery-bc29063bf4e2312133d91e211dfe9c86ee811489.tar.bz2
minui: events: refactor event acquisition
Events are now delivered through a callback mechanism during a call to ev_dispatch(). This will allow us to extend the events code to handle other devices/fds, not just input. One such example is the ability to process uevents. During initialization, we provide an input callback to ev_init that gets called when a new event is encountered during dispatch. ev_get has been removed and replaced with ev_get_input() helper function that can be called from inside the callback to attempt to get an input event. The existing client of ev_get in recovery has been split up such that the input thread just calls ev_wait(); ev_dispatch(); and the input_callback handles individual events by using the ev_get_input() helper. Change-Id: I24d8e71bd1533876b4ab1ae751ba200fea43c049 Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'minui/minui.h')
-rw-r--r--minui/minui.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/minui/minui.h b/minui/minui.h
index 2284a33..5a4168c 100644
--- a/minui/minui.h
+++ b/minui/minui.h
@@ -45,9 +45,20 @@ unsigned int gr_get_height(gr_surface surface);
// see http://www.mjmwired.net/kernel/Documentation/input/ for info.
struct input_event;
-int ev_init(void);
+typedef int (*ev_callback)(int fd, short revents, void *data);
+
+int ev_init(ev_callback input_cb, void *data);
void ev_exit(void);
-int ev_get(struct input_event *ev, unsigned dont_wait);
+
+/* timeout has the same semantics as for poll
+ * 0 : don't block
+ * < 0 : block forever
+ * > 0 : block for 'timeout' milliseconds
+ */
+int ev_wait(int timeout);
+
+int ev_get_input(int fd, short revents, struct input_event *ev);
+void ev_dispatch(void);
// Resources