1
0
mirror of synced 2025-01-18 00:56:49 +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;
// Wait 5 frames before actually enabling the long sleep mode to make animations not stutter
constexpr static auto LongSleepTimeout = 5;
static i32 lockTimeout = 0;
if (!shouldLongSleep) {
lockTimeout = LongSleepTimeout;
lockTimeout = m_lastFrameTime * 10'000;
} else if (lockTimeout > 0) {
lockTimeout -= 1;
}
@ -610,13 +609,12 @@ namespace hex {
previousVtxDataSize = vtxDataSize;
}
ImGui::UpdatePlatformWindows();
if (shouldRender) {
GLFWwindow *backupContext = glfwGetCurrentContext();
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
glfwMakeContextCurrent(backupContext);
if (shouldRender) {
int displayWidth, displayHeight;
glfwGetFramebufferSize(m_window, &displayWidth, &displayHeight);
glViewport(0, 0, displayWidth, displayHeight);