Reduce lock usage during window events

This commit is contained in:
2025-04-19 21:12:38 +03:00
parent f5fbc1e32d
commit c40c31fbb7
4 changed files with 5 additions and 25 deletions

View File

@@ -913,11 +913,10 @@ void InputService::Update()
WindowsManager::WindowsLocker.Unlock();
// Send input events for the focused window
WindowsManager::WindowsLocker.Lock();
for (const auto& e : InputEvents)
{
auto window = e.Target ? e.Target : defaultWindow;
if (!window || !WindowsManager::Windows.Contains(window))
if (!window || window->IsClosed())
continue;
switch (e.Type)
{
@@ -965,7 +964,6 @@ void InputService::Update()
break;
}
}
WindowsManager::WindowsLocker.Unlock();
// Skip if game has no focus to handle the input
if (!Engine::HasGameViewportFocus())