impr: Make window less prone to flickering during resizes on Windows

This commit is contained in:
WerWolv
2024-05-30 16:57:07 +02:00
parent 63f66662ce
commit 08c2f3fc15
3 changed files with 17 additions and 6 deletions

View File

@@ -551,6 +551,16 @@ namespace hex {
});
ImGui::GetIO().ConfigDebugIsDebuggerPresent = ::IsDebuggerPresent();
glfwSetFramebufferSizeCallback(m_window, [](GLFWwindow* window, int width, int height) {
auto *win = static_cast<Window *>(glfwGetWindowUserPointer(window));
win->m_unlockFrameRate = true;
glViewport(0, 0, width, height);
ImHexApi::System::impl::setMainWindowSize(width, height);
win->fullFrame();
});
}
void Window::beginNativeWindowFrame() {

View File

@@ -820,12 +820,14 @@ namespace hex {
// Register window resize callback
glfwSetWindowSizeCallback(m_window, [](GLFWwindow *window, int width, int height) {
if (!glfwGetWindowAttrib(window, GLFW_ICONIFIED))
ImHexApi::System::impl::setMainWindowSize(width, height);
auto win = static_cast<Window *>(glfwGetWindowUserPointer(window));
win->m_unlockFrameRate = true;
#if !defined(OS_WINDOWS)
if (!glfwGetWindowAttrib(window, GLFW_ICONIFIED))
ImHexApi::System::impl::setMainWindowSize(width, height);
#endif
#if defined(OS_MACOS)
// Stop widgets registering hover effects while the window is being resized
if (macosIsWindowBeingResizedByUser(window)) {