aboutsummaryrefslogtreecommitdiffstats
path: root/minui
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2014-11-24 15:11:41 -0800
committerTom Marshall <tdm@cyngn.com>2015-11-25 15:35:20 -0800
commit89e2dcf83fa3901090893e98c17708e279dea47f (patch)
tree23a69ea49d0897fc5052ef44f75afc9a7f53c89a /minui
parentacc855f711ae7bce20e4fc896c829e135a6801fc (diff)
downloadbootable_recovery-89e2dcf83fa3901090893e98c17708e279dea47f.zip
bootable_recovery-89e2dcf83fa3901090893e98c17708e279dea47f.tar.gz
bootable_recovery-89e2dcf83fa3901090893e98c17708e279dea47f.tar.bz2
recovery: Initial dialog implementation
Implement two types of dialogs: info and error. Info dialogs are intended to show that an operation is in progress and cannot be interrupted. Error dialogs are intended to show that an error occurred. The user must respond by dismissing the dialog with any input (a swipe or keypress). Dialogs may be initiated internally within the UI code or externally via a named local socket. Dialogs created via socket are presumed to be info and may not be dismissed. When the client socket is closed, the dialog automatically dismisses. Initial implementation shows dialogs for adb backup and restore. Future work will show dialogs for all errors and lengthy operations. Change-Id: Icefea12ec0fd70fb487d54aa2eb1cae9dd451355
Diffstat (limited to 'minui')
-rw-r--r--minui/events.cpp17
-rw-r--r--minui/minui.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/minui/events.cpp b/minui/events.cpp
index 3b2262a..4e9d80b 100644
--- a/minui/events.cpp
+++ b/minui/events.cpp
@@ -137,6 +137,23 @@ int ev_add_fd(int fd, ev_callback cb, void* data) {
return ret;
}
+int ev_del_fd(int fd)
+{
+ unsigned n;
+ for (n = 0; n < ev_count; ++n) {
+ if (ev_fdinfo[n].fd == fd) {
+ epoll_ctl(g_epoll_fd, EPOLL_CTL_DEL, fd, NULL);
+ if (n != ev_count-1) {
+ ev_fdinfo[n] = ev_fdinfo[ev_count-1];
+ }
+ ev_count--;
+ ev_misc_count--;
+ return 0;
+ }
+ }
+ return -1;
+}
+
void ev_exit(void) {
while (ev_count > 0) {
close(ev_fdinfo[--ev_count].fd);
diff --git a/minui/minui.h b/minui/minui.h
index d714632..7dec2d7 100644
--- a/minui/minui.h
+++ b/minui/minui.h
@@ -67,6 +67,7 @@ typedef int (*ev_set_key_callback)(int code, int value, void* data);
int ev_init(ev_callback input_cb, void* data);
void ev_exit();
int ev_add_fd(int fd, ev_callback cb, void* data);
+int ev_del_fd(int fd);
void ev_iterate_available_keys(std::function<void(int)> f);
int ev_sync_key_state(ev_set_key_callback set_key_cb, void* data);