feat(ui): keep the wallet syncing while minimized

Previously the main loop just did SDL_Delay+continue when minimized, skipping app.update() —
so the wallet stopped draining RPC results, ticking the refresh scheduler, and reconnecting
until it was restored (and a large daemon-output backlog piled up, which is what produced the
spurious "rescan complete" toast on restore).

Now app.update() runs while minimized (it only reads GetIO/GetTime/IsAnyItemActive, all valid
outside a NewFrame) with a real-clock DeltaTime, skipping only the ImGui frame + GPU present,
throttled to ~5 Hz so CPU stays near-idle. Also clamp io.DeltaTime at the top of App::update()
so a long minimize (or machine sleep) can't report a huge delta and fire every refresh/animation
timer at once on the next update. No backlog now builds, so skipDaemonOutputBacklog becomes a
harmless no-op.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-01 01:09:50 -05:00
co-authored by Claude Opus 4.8
parent a3892c0fd3
commit 0343d48c13
2 changed files with 25 additions and 5 deletions
+4
View File
@@ -739,6 +739,10 @@ void App::update()
{
PERF_SCOPE("Update.Total");
ImGuiIO& io = ImGui::GetIO();
// Clamp the frame delta: after a long pause (window minimized, or the machine slept) NewFrame reports
// a huge DeltaTime that would fire every refresh/animation timer at once. Every timer reads
// io.DeltaTime, so one clamp here bounds them all (also caps the real-clock delta fed while minimized).
if (io.DeltaTime > 0.25f) io.DeltaTime = 0.25f;
// Full UI screenshot sweep: demo state is injected once and must stay frozen. Skip every live
// op (refresh/connect/pumps) so a real daemon can't clobber it — on Windows a running node's