minui: Move callback functions to std::function.
Also make minor clean up to the header includes.
Test: mmma bootable/recovery system/core/healthd system/extra/slideshow
Change-Id: I3bfcf2c0e203c26a98ee08f1f8036c68356a69fd
diff --git a/ui.cpp b/ui.cpp
index f31660d..a0f741e 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -34,11 +34,11 @@
#include <android-base/properties.h>
#include <cutils/android_reboot.h>
+#include <minui/minui.h>
#include "common.h"
#include "roots.h"
#include "device.h"
-#include "minui/minui.h"
#define UI_WAIT_KEY_TIMEOUT_SEC 120
@@ -70,10 +70,6 @@
}
}
-int RecoveryUI::InputCallback(int fd, uint32_t epevents, void* data) {
- return reinterpret_cast<RecoveryUI*>(data)->OnInputEvent(fd, epevents);
-}
-
// Reads input events, handles special hot keys, and adds to the key queue.
static void* InputThreadLoop(void*) {
while (true) {
@@ -88,7 +84,7 @@
// Set up the locale info.
SetLocale(locale);
- ev_init(InputCallback, this);
+ ev_init(std::bind(&RecoveryUI::OnInputEvent, this, std::placeholders::_1, std::placeholders::_2));
ev_iterate_available_keys(std::bind(&RecoveryUI::OnKeyDetected, this, std::placeholders::_1));