Always redraw after getting some user input

This commit is contained in:
Maxime Coste 2021-03-11 09:08:35 +11:00
parent 4a59018dcd
commit d5282735f2
3 changed files with 7 additions and 3 deletions

View File

@ -84,8 +84,9 @@ Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui, int pi
return contains(m_clients, client) ? client : nullptr;
}
void ClientManager::process_pending_inputs()
bool ClientManager::process_pending_inputs()
{
bool processed_some_input = false;
while (true)
{
bool had_input = false;
@ -101,12 +102,14 @@ void ClientManager::process_pending_inputs()
continue;
}
had_input = m_clients[i]->process_pending_inputs() or had_input;
processed_some_input |= had_input;
++i;
}
if (not had_input)
break;
}
return processed_some_input;
}
bool ClientManager::has_pending_inputs() const

View File

@ -35,7 +35,7 @@ public:
void add_free_window(std::unique_ptr<Window>&& window, SelectionList selections);
void redraw_clients() const;
void process_pending_inputs();
bool process_pending_inputs();
bool has_pending_inputs() const;
Client* get_client_ifp(StringView name);

View File

@ -862,7 +862,8 @@ int run_server(StringView session, StringView server_init,
bool allow_blocking = not client_manager.has_pending_inputs();
while (event_manager.handle_next_events(EventMode::Normal, nullptr, allow_blocking))
{
client_manager.process_pending_inputs();
if (client_manager.process_pending_inputs())
break;
allow_blocking = false;
}
client_manager.process_pending_inputs();