summaryrefslogtreecommitdiff
path: root/src/remote.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-10-28 09:26:54 +0100
committerMaxime Coste <frrrwww@gmail.com>2012-10-28 09:26:54 +0100
commitd9729cc29eb717aae2c68ced24d4b04d4c2ea4cf (patch)
treedfa12788197425cd8c02d1b5a7c10078b2ac4cff /src/remote.cc
parent13a081ed4ab770c80e6a258b6aa507ca55df3529 (diff)
Handle all available input before redrawing
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);