mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: High background GPU usage on Windows if window is minimized
This commit is contained in:
@@ -322,9 +322,12 @@ namespace hex {
|
||||
ImHexApi::System::impl::setMainWindowSize(width, height);
|
||||
}
|
||||
|
||||
if (!glfwGetWindowAttrib(m_window, GLFW_VISIBLE) || glfwGetWindowAttrib(m_window, GLFW_ICONIFIED)) {
|
||||
while (!glfwGetWindowAttrib(m_window, GLFW_VISIBLE) || glfwGetWindowAttrib(m_window, GLFW_ICONIFIED)) {
|
||||
// If the application is minimized or not visible, don't render anything
|
||||
// glfwWaitEvents() is supposed to block the thread, but it does pretty often spuriously wake up anyway
|
||||
// so we need to keep looping here until the window is visible again, adding a short sleep to avoid busy-waiting
|
||||
glfwWaitEvents();
|
||||
std::this_thread::sleep_for(100ms);
|
||||
}
|
||||
|
||||
static ImVec2 lastWindowSize = ImHexApi::System::getMainWindowSize();
|
||||
|
||||
Reference in New Issue
Block a user