diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-10-06 23:47:44 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-10-06 23:47:44 +0100 |
| commit | f904402486e98fa2cfbac626f1d149db038110f6 (patch) | |
| tree | 74c7b973a04252cf2d97f6f90fd195ab5e7a7906 /src | |
| parent | 006be63a327ded416aa26f470af89e741d2cf651 (diff) | |
Handle all available keys when a RemoteClient input is available
We were just treating the next key. Which led to <esc> byte
remaining after suspend, that led that <esc> being interpretted
as <alt> when the following key got available.
Fixes #739
Diffstat (limited to 'src')
| -rw-r--r-- | src/remote.cc | 13 | ||||
| -rw-r--r-- | src/remote.hh | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/remote.cc b/src/remote.cc index 427f52b2..9de0a13a 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -518,7 +518,7 @@ RemoteClient::RemoteClient(StringView session, std::unique_ptr<UserInterface>&& msg.write(env_vars); } - m_ui->set_input_callback([this](EventMode){ write_next_key(); }); + m_ui->set_input_callback([this](EventMode){ send_available_keys(); }); MsgReader reader; m_socket_watcher.reset(new FDWatcher{sock, [this, reader](FDWatcher& watcher, EventMode) mutable { @@ -589,12 +589,13 @@ RemoteClient::RemoteClient(StringView session, std::unique_ptr<UserInterface>&& }}); } -void RemoteClient::write_next_key() +void RemoteClient::send_available_keys() { - MsgWriter msg(m_socket_watcher->fd(), MessageType::Key); - // do that before checking dimensions as get_key may - // handle a resize event. - msg.write(m_ui->get_key()); + while (m_ui->is_key_available()) + { + MsgWriter msg(m_socket_watcher->fd(), MessageType::Key); + msg.write(m_ui->get_key()); + } } void send_command(StringView session, StringView command) diff --git a/src/remote.hh b/src/remote.hh index 5740def9..5537e3fd 100644 --- a/src/remote.hh +++ b/src/remote.hh @@ -37,7 +37,7 @@ public: const EnvVarMap& env_vars, StringView init_command); private: - void write_next_key(); + void send_available_keys(); std::unique_ptr<UserInterface> m_ui; std::unique_ptr<FDWatcher> m_socket_watcher; |
