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