summaryrefslogtreecommitdiff
path: root/src/remote.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/remote.cc')
-rw-r--r--src/remote.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/remote.cc b/src/remote.cc
index 7bd99d59..a5bd87b9 100644
--- a/src/remote.cc
+++ b/src/remote.cc
@@ -193,6 +193,20 @@ void RemoteUI::draw(const DisplayBuffer& display_buffer,
static const Key::Modifiers resize_modifier = (Key::Modifiers)0x80;
+bool RemoteUI::is_key_available()
+{
+ timeval tv;
+ fd_set rfds;
+
+ FD_ZERO(&rfds);
+ FD_SET(m_socket, &rfds);
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ int res = select(m_socket+1, &rfds, NULL, NULL, &tv);
+ return res == 1;
+}
+
Key RemoteUI::get_key()
{
Key key = read<Key>(m_socket);