summaryrefslogtreecommitdiffstats
path: root/minui
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-10 20:26:52 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-10 20:26:53 +0000
commit5d1630a926a02ca13a66eb1e385eabba16b04cfc (patch)
tree7e8d33676678e2240d5368fca8465712b24285cd /minui
parent6b0dd1d7e1e1f3645230f880db95cad1279a826b (diff)
parent642aaa7a3e11b2de719fc9decc45174bcc235c0c (diff)
downloadbootable_recovery-5d1630a926a02ca13a66eb1e385eabba16b04cfc.zip
bootable_recovery-5d1630a926a02ca13a66eb1e385eabba16b04cfc.tar.gz
bootable_recovery-5d1630a926a02ca13a66eb1e385eabba16b04cfc.tar.bz2
Merge "Fix ScreenRecoveryUI to handle devices without power/up/down."
Diffstat (limited to 'minui')
-rw-r--r--minui/events.cpp4
-rw-r--r--minui/minui.h9
2 files changed, 9 insertions, 4 deletions
diff --git a/minui/events.cpp b/minui/events.cpp
index 2c41eb8..daa10c6 100644
--- a/minui/events.cpp
+++ b/minui/events.cpp
@@ -201,7 +201,7 @@ int ev_sync_key_state(ev_set_key_callback set_key_cb, void* data) {
return 0;
}
-void ev_iterate_available_keys(ev_key_callback cb, void* data) {
+void ev_iterate_available_keys(std::function<void(int)> f) {
unsigned long ev_bits[BITS_TO_LONGS(EV_MAX)];
unsigned long key_bits[BITS_TO_LONGS(KEY_MAX)];
@@ -224,7 +224,7 @@ void ev_iterate_available_keys(ev_key_callback cb, void* data) {
for (int key_code = 0; key_code <= KEY_MAX; ++key_code) {
if (test_bit(key_code, key_bits)) {
- cb(key_code, data);
+ f(key_code);
}
}
}
diff --git a/minui/minui.h b/minui/minui.h
index 8f2ff11..82abb8a 100644
--- a/minui/minui.h
+++ b/minui/minui.h
@@ -68,13 +68,11 @@ 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 void (*ev_key_callback)(int code, 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);
-void ev_iterate_available_keys(ev_key_callback cb, void* data);
// 'timeout' has the same semantics as poll(2).
// 0 : don't block
@@ -130,4 +128,11 @@ void res_free_surface(gr_surface surface);
}
#endif
+#ifdef __cplusplus
+
+#include <functional>
+void ev_iterate_available_keys(std::function<void(int)> f);
+
+#endif
+
#endif