imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Examples: Win32: Let the CPU and GPU chill

Open CovERUshKA opened this issue 5 years ago • 1 comments

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

CovERUshKA avatar Mar 13 '21 13:03 CovERUshKA

I have tested with your code-changes, but I found another problem.

Reproduce the problem (my machine runs Window 10 Pro 19042.867):

  1. Maximize the window.
  2. Minimize the window. (You can see low-usage for GPU and CPU. This is good, but...)
  3. Restore the window. (The Problem: Window content does not update.)

Caused by:

  • g_wndMinimized still have true value even though window have restored(maximized).
  • The Window receives a WM_SIZE event with wParam = SIZE_MAXIMIZED, not SIZE_RESTORED in 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);

kayws426 avatar Mar 26 '21 09:03 kayws426