aboutsummaryrefslogtreecommitdiffstats
path: root/minui/events.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'minui/events.cpp')
-rw-r--r--minui/events.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/minui/events.cpp b/minui/events.cpp
index 3b2262a..120baed 100644
--- a/minui/events.cpp
+++ b/minui/events.cpp
@@ -78,8 +78,8 @@ int ev_init(ev_callback input_cb, void* data) {
continue;
}
- // We assume that only EV_KEY, EV_REL, and EV_SW event types are ever needed.
- if (!test_bit(EV_KEY, ev_bits) && !test_bit(EV_REL, ev_bits) && !test_bit(EV_SW, ev_bits)) {
+ // We assume that only EV_KEY, EV_REL, EV_SW, and EV_ABS event types are ever needed.
+ if (!test_bit(EV_KEY, ev_bits) && !test_bit(EV_REL, ev_bits) && !test_bit(EV_SW, ev_bits) && !test_bit(EV_ABS, ev_bits)) {
close(fd);
continue;
}
@@ -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);