From 0dd9b216bf98c0504e039f7d71b0cae7493f4f2c Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 6 Jan 2025 00:38:12 +0100 Subject: FIx input (2: keyboard and touchpad) --- UI.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'UI.cpp') 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); -- cgit v1.2.3