From ca681509709ca4db0743533b754ebc206c8c9a1c Mon Sep 17 00:00:00 2001 From: birdstakes Date: Tue, 17 Jan 2023 02:14:40 -0500 Subject: [PATCH] fix: Frame rate not unlocking correctly (#890) m_hadEvent could be set during glfwWaitEventsTimeout and then immediately cleared before ever being checked. --- main/source/window/window.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index d7c101452..5e80fe137 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -212,6 +212,7 @@ namespace hex { bool frameRateUnlocked = ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId) || TaskManager::getRunningTaskCount() > 0 || this->m_mouseButtonDown || this->m_hadEvent || !this->m_pressedKeys.empty(); const double timeout = std::max(0.0, (1.0 / 5.0) - (glfwGetTime() - this->m_lastFrameTime)); + this->m_hadEvent = false; if ((this->m_lastFrameTime - this->m_frameRateUnlockTime) > 5 && this->m_frameRateTemporarilyUnlocked && !frameRateUnlocked) { this->m_frameRateTemporarilyUnlocked = false; @@ -239,8 +240,6 @@ namespace hex { } this->m_lastFrameTime = glfwGetTime(); - - this->m_hadEvent = false; } }