From 0713819fd256bfdfcf241c71195b7e8c4e18c742 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 10 Apr 2015 09:40:53 -0700 Subject: Add ev_iterate_available_keys to minui. This lets us recognize whether we have up/down/power, say, and tailor the UI accordingly. Change-Id: If94e454f14243b59d2f473ac9a436bd60591da01 --- minui/minui.h | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'minui/minui.h') diff --git a/minui/minui.h b/minui/minui.h index 733b675f3..8f2ff1139 100644 --- a/minui/minui.h +++ b/minui/minui.h @@ -25,6 +25,10 @@ extern "C" { #endif +// +// Graphics. +// + typedef struct { int width; int height; @@ -56,30 +60,35 @@ void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy); unsigned int gr_get_width(gr_surface surface); unsigned int gr_get_height(gr_surface surface); -// input event structure, include for the definition. -// see http://www.mjmwired.net/kernel/Documentation/input/ for info. +// +// Input events. +// + struct input_event; -typedef int (*ev_callback)(int fd, uint32_t epevents, void *data); -typedef int (*ev_set_key_callback)(int code, int value, void *data); +typedef int (*ev_callback)(int fd, uint32_t epevents, void* data); +typedef int (*ev_set_key_callback)(int code, int value, void* data); +typedef void (*ev_key_callback)(int code, void* data); -int ev_init(ev_callback input_cb, void *data); +int ev_init(ev_callback input_cb, void* data); void ev_exit(void); -int ev_add_fd(int fd, ev_callback cb, void *data); -int ev_sync_key_state(ev_set_key_callback set_key_cb, void *data); - -/* timeout has the same semantics as for poll - * 0 : don't block - * < 0 : block forever - * > 0 : block for 'timeout' milliseconds - */ +int ev_add_fd(int fd, ev_callback cb, void* data); +int ev_sync_key_state(ev_set_key_callback set_key_cb, void* data); +void ev_iterate_available_keys(ev_key_callback cb, void* data); + +// 'timeout' has the same semantics as poll(2). +// 0 : don't block +// < 0 : block forever +// > 0 : block for 'timeout' milliseconds int ev_wait(int timeout); int ev_get_input(int fd, uint32_t epevents, struct input_event *ev); void ev_dispatch(void); int ev_get_epollfd(void); +// // Resources +// // res_create_*_surface() functions return 0 if no error, else // negative. -- cgit v1.2.3