From 61c8ef6ce47adf10a2bd0a0465835e8bcfa09609 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 26 Oct 2012 16:14:51 +0200 Subject: [PATCH] remote: send resize message when needed --- src/remote.cc | 12 +++++++++--- src/remote.hh | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/remote.cc b/src/remote.cc index 13e9ee79..4cf4e4eb 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -210,10 +210,9 @@ DisplayCoord RemoteUI::dimensions() } RemoteClient::RemoteClient(int socket, UserInterface* ui) - : m_socket(socket), m_ui(ui) + : m_socket(socket), m_ui(ui), m_dimensions(ui->dimensions()) { - DisplayCoord size = ui->dimensions(); - Key key{ resize_modifier, (Codepoint)(((int)size.line << 16) | (int)size.column) }; + Key key{ resize_modifier, Codepoint(((int)m_dimensions.line << 16) | (int)m_dimensions.column) }; Message msg(socket); write(msg, key); } @@ -256,7 +255,14 @@ void RemoteClient::process_next_message() void RemoteClient::write_next_key() { + DisplayCoord dimensions = m_ui->dimensions(); Message msg(m_socket); + if (dimensions != m_dimensions) + { + m_dimensions = dimensions; + Key key{ resize_modifier, Codepoint(((int)dimensions.line << 16) | (int)dimensions.column) }; + write(msg, m_dimensions); + } write(msg, m_ui->get_key()); } diff --git a/src/remote.hh b/src/remote.hh index 19e7ce4f..f4b062c4 100644 --- a/src/remote.hh +++ b/src/remote.hh @@ -43,6 +43,7 @@ public: private: int m_socket; std::unique_ptr m_ui; + DisplayCoord m_dimensions; }; }