summaryrefslogtreecommitdiffhomepage
path: root/UI.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2025-01-06 00:38:12 +0100
committerRoland Reichwein <mail@reichwein.it>2025-01-06 00:38:12 +0100
commit0dd9b216bf98c0504e039f7d71b0cae7493f4f2c (patch)
tree2f5310264deba5ae260261889eb83a90ec801067 /UI.cpp
parentc072b661564e1ce3f0f01f1b6ddba0266fbb47b6 (diff)
FIx input (2: keyboard and touchpad)
Diffstat (limited to 'UI.cpp')
-rw-r--r--UI.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/UI.cpp b/UI.cpp
index 2dab410..3a896a0 100644
--- a/UI.cpp
+++ b/UI.cpp
@@ -66,7 +66,7 @@ UI::UI(Config& config):
{
}
-bool UI::key_available() {
+bool stdin_available() {
struct pollfd fds{};
fds.fd = 0; // stdin
fds.events = POLLIN;
@@ -76,10 +76,14 @@ bool UI::key_available() {
else if (ret == 1)
return true;
else
- log_cout << "Error" << std::endl;
+ log_cout << "UI: Poll error" << std::endl;
return false;
}
+bool UI::key_available() {
+ return stdin_available() || m_touchpad.event_available();
+}
+
int read_key() {
char buf[1];
int got = read(0, buf, 1);