Skip to content

Commit 773f862

Browse files
author
ryuukk
authored
Put process to sleep when minimized until it receives an event
1 parent c9e1865 commit 773f862

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

engine/system/win/sys_main.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,14 +842,16 @@ bool sys_main_c::Run(int argc, char** argv)
842842

843843
// Run frame loop
844844
while (exitFlag == false) {
845-
glfwPollEvents();
845+
if (minimized)
846+
glfwWaitEventsTimeout(); // while minimized, puts process to sleep until it receives an event
847+
else
848+
glfwPollEvents();
846849
auto wnd = (GLFWwindow*)video->GetWindowHandle();
847850
if (glfwWindowShouldClose(wnd)) {
848851
Exit();
849852
break;
850853
}
851-
if (minimized == false)
852-
core->Frame();
854+
core->Frame();
853855

854856
if (threadError) {
855857
Error(threadError);

0 commit comments

Comments
 (0)