diff --git a/src/client_manager.cc b/src/client_manager.cc index f46d16ea..7c03dabc 100644 --- a/src/client_manager.cc +++ b/src/client_manager.cc @@ -84,8 +84,9 @@ Client* ClientManager::create_client(std::unique_ptr&& 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 diff --git a/src/client_manager.hh b/src/client_manager.hh index 7d92ed7e..2323e07b 100644 --- a/src/client_manager.hh +++ b/src/client_manager.hh @@ -35,7 +35,7 @@ public: void add_free_window(std::unique_ptr&& 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); diff --git a/src/main.cc b/src/main.cc index fbb074a0..998c24fd 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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();