remote: send resize message when needed

This commit is contained in:
Maxime Coste 2012-10-26 16:14:51 +02:00
parent 73aa11ac16
commit 61c8ef6ce4
2 changed files with 10 additions and 3 deletions

View File

@ -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());
}

View File

@ -43,6 +43,7 @@ public:
private:
int m_socket;
std::unique_ptr<UserInterface> m_ui;
DisplayCoord m_dimensions;
};
}