aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerlaender2016-12-11 14:05:38 +0100
committerAdrian Kummerlaender2016-12-11 14:05:38 +0100
commitd139217ed53516bfcb71de171bf209706f5c842a (patch)
tree94731b40bc3314eb4357050e1295ff0fb5990f73 /src
parent0ab22bf684f4b30f1182eed6901bd3764e428ec7 (diff)
downloadtermlife-d139217ed53516bfcb71de171bf209706f5c842a.tar
termlife-d139217ed53516bfcb71de171bf209706f5c842a.tar.gz
termlife-d139217ed53516bfcb71de171bf209706f5c842a.tar.bz2
termlife-d139217ed53516bfcb71de171bf209706f5c842a.tar.lz
termlife-d139217ed53516bfcb71de171bf209706f5c842a.tar.xz
termlife-d139217ed53516bfcb71de171bf209706f5c842a.tar.zst
termlife-d139217ed53516bfcb71de171bf209706f5c842a.zip
Extract term event polling
Diffstat (limited to 'src')
-rw-r--r--src/util/term.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/term.cc b/src/util/term.cc
index 9e4c101..704f872 100644
--- a/src/util/term.cc
+++ b/src/util/term.cc
@@ -1,5 +1,7 @@
#include "term.h"
+#include <system_error>
+
#include <termbox.h>
namespace util {
@@ -27,4 +29,14 @@ TermGuard::~TermGuard() {
tb_shutdown();
}
+tb_event TermGuard::poll() const {
+ struct tb_event event;
+
+ if ( tb_poll_event(&event) == -1 ) {
+ throw std::system_error();
+ } else {
+ return event;
+ }
+}
+
}