diff --git a/src/remote.cc b/src/remote.cc index e798ee2b..39542a0b 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -335,13 +335,25 @@ bool RemoteUI::is_key_available() Key RemoteUI::get_key() { - Key key = read(m_socket_watcher.fd()); - if (key.modifiers == resize_modifier) + try { - m_dimensions = { (int)(key.key >> 16), (int)(key.key & 0xFFFF) }; - return Key::Invalid; + Key key = read(m_socket_watcher.fd()); + if (key.modifiers == resize_modifier) + { + m_dimensions = { (int)(key.key >> 16), (int)(key.key & 0xFFFF) }; + return Key::Invalid; + } + return key; + } + catch (peer_disconnected&) + { + throw client_removed{}; + } + catch (socket_error&) + { + write_debug("ungraceful deconnection detected"); + throw client_removed{}; } - return key; } DisplayCoord RemoteUI::dimensions()