1
0
mirror of synced 2025-01-18 09:04:52 +01:00

fix: Buggy window detachment

This commit is contained in:
WerWolv 2024-02-28 20:36:22 +01:00
parent f7b431902d
commit dc1a5a860c

View File

@ -165,10 +165,9 @@ namespace hex {
bool shouldLongSleep = !m_unlockFrameRate; bool shouldLongSleep = !m_unlockFrameRate;
// Wait 5 frames before actually enabling the long sleep mode to make animations not stutter // Wait 5 frames before actually enabling the long sleep mode to make animations not stutter
constexpr static auto LongSleepTimeout = 5;
static i32 lockTimeout = 0; static i32 lockTimeout = 0;
if (!shouldLongSleep) { if (!shouldLongSleep) {
lockTimeout = LongSleepTimeout; lockTimeout = m_lastFrameTime * 10'000;
} else if (lockTimeout > 0) { } else if (lockTimeout > 0) {
lockTimeout -= 1; lockTimeout -= 1;
} }
@ -610,13 +609,12 @@ namespace hex {
previousVtxDataSize = vtxDataSize; previousVtxDataSize = vtxDataSize;
} }
ImGui::UpdatePlatformWindows();
if (shouldRender) {
GLFWwindow *backupContext = glfwGetCurrentContext(); GLFWwindow *backupContext = glfwGetCurrentContext();
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault(); ImGui::RenderPlatformWindowsDefault();
glfwMakeContextCurrent(backupContext); glfwMakeContextCurrent(backupContext);
if (shouldRender) {
int displayWidth, displayHeight; int displayWidth, displayHeight;
glfwGetFramebufferSize(m_window, &displayWidth, &displayHeight); glfwGetFramebufferSize(m_window, &displayWidth, &displayHeight);
glViewport(0, 0, displayWidth, displayHeight); glViewport(0, 0, displayWidth, displayHeight);