imgui
imgui copied to clipboard
Examples: Win32: Let the CPU and GPU chill
When the window is minimized, in the task manager i see 100% GPU usage and 10% CPU usage When the window is restored, i see 7% GPU usage and 0,5% CPU usage
So i added SIZE_MINIMIZED handling, to prevent CPU and GPU usage when the window is minimized
I have tested with your code-changes, but I found another problem.
Reproduce the problem (my machine runs Window 10 Pro 19042.867):
- Maximize the window.
- Minimize the window. (You can see low-usage for GPU and CPU. This is good, but...)
- Restore the window. (The Problem: Window content does not update.)
Caused by:
g_wndMinimizedstill havetruevalue even though window have restored(maximized).- The Window receives a
WM_SIZEevent withwParam = SIZE_MAXIMIZED, notSIZE_RESTOREDin this case.
Maybe a simple solution is:
- if (wParam == SIZE_MINIMIZED)
- {
- g_wndMinimized = true;
- }
- else if (wParam == SIZE_RESTORED)
- {
- g_wndMinimized = false;
- }
+ g_wndMinimized = (wParam == SIZE_MINIMIZED);