code cleanup in remote.cc

This commit is contained in:
Maxime Coste 2012-12-10 18:46:57 +01:00
parent 9230ccc087
commit db3a953961

View File

@ -245,9 +245,9 @@ DisplayCoord RemoteUI::dimensions()
RemoteClient::RemoteClient(int socket, UserInterface* ui)
: m_socket(socket), m_ui(ui), m_dimensions(ui->dimensions())
{
Key key{ resize_modifier, Codepoint(((int)m_dimensions.line << 16) | (int)m_dimensions.column) };
Message msg(socket);
write(msg, key);
Key key{ resize_modifier, Codepoint(((int)m_dimensions.line << 16) | (int)m_dimensions.column) };
Message msg(socket);
write(msg, key);
}
void RemoteClient::process_next_message()
@ -288,19 +288,18 @@ void RemoteClient::process_next_message()
void RemoteClient::write_next_key()
{
// read key before checking dimensions
// so that get_key may handle a resize event
Key key = m_ui->get_key();
Message msg(m_socket);
// do that before checking dimensions as get_key may
// handle a resize event.
write(msg, m_ui->get_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, key);
}
write(msg, key);
}
}