Fix Windows high CPU usage during idle repaints#69
Merged
kissetfall merged 4 commits intoJul 17, 2026
Conversation
IgorArkhipov
marked this pull request as draft
July 14, 2026 01:23
Move Windows repaint delays off eframe event loop so hidden and Bluetooth windows remain in ControlFlow::Wait. Preserve connect, update, tray, shutdown, and non-Windows repaint behavior with regression tests.
Upgrade to eframe and egui 0.34.3 for upstream hidden-window repaint throttling. Run lifecycle and background work in App::logic while App::ui handles visible rendering, and keep Glow to avoid an unrelated renderer change.
IgorArkhipov
force-pushed
the
igor/windows-high-cpu-lifecycle-fix
branch
from
July 14, 2026 14:29
89b3fd6 to
dd2726d
Compare
IgorArkhipov
marked this pull request as ready for review
July 14, 2026 14:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EN
Summary
This PR targets the Windows high-CPU behavior tracked in #59.
The eframe/egui 0.34.3 lifecycle update fixed the hidden/minimized event-loop spin. Testing of the previous artifact confirmed low CPU in every USB, minimized, and tray-hidden scenario. One case remained: Bluetooth keyboard selected while the Entropy window was visible in the foreground.
That result matched a separate Bluetooth-only 16 ms idle repaint cadence. A visible eframe window rendered continuously at roughly 60 FPS; minimized and tray-hidden windows skipped UI rendering, explaining why those Bluetooth modes were already normal.
Windows now uses the normal 250 ms visible-idle cadence for Bluetooth too. Pending work still schedules faster repaints when needed. Non-Windows Bluetooth behavior is unchanged. A target-independent regression test covers both Windows and non-Windows policy.
PR #64 remains useful diagnostic evidence: suppressing unnecessary updates removed the load. This implementation uses the upstream eframe lifecycle fix plus bounded idle repaint scheduling rather than copying PR #64's one-frame workaround.
Runtime status
82984992598314186932Current Windows test build:
entropy-windowsWindows runtime validation is complete: zero CPU load was reported across foreground, minimized, and tray states for both USB and Bluetooth. Restoring from tray and closing the application also work as expected.
Verification
main; overlapping device-connect, layer-write, picker, and lifecycle behavior preservedcargo test --all-targets: 196 passedcargo check --all-targetscargo clippy --all-targets: passes with existing warning baselinerustfmt --checkgit diff --checkringrequires MSVC C headersReferences
App::logic/App::uilifecycle splitFixes #59
Related: #64
RU
Кратко
Этот PR исправляет высокую загрузку CPU в Windows из #59.
Обновление жизненного цикла до eframe/egui 0.34.3 устранило активный цикл для скрытого и свернутого окна. Проверка предыдущего artifact подтвердила нормальную загрузку CPU для всех USB-сценариев, а также для свернутого и скрытого в трей окна. Остался один случай: клавиатура подключена по Bluetooth, а окно Entropy находится на переднем плане.
Результат совпал с отдельным Bluetooth-интервалом idle repaint в 16 мс. Видимое окно eframe постоянно отрисовывалось примерно с частотой 60 FPS; свернутое и скрытое в трей окно UI не отрисовывало, поэтому в этих Bluetooth-режимах загрузка уже была нормальной.
Теперь в Windows для Bluetooth также используется обычный idle-интервал видимого окна в 250 мс. Незавершенные фоновые операции по-прежнему запрашивают более быстрый repaint при необходимости. Поведение Bluetooth в других ОС не изменено. Регрессионный тест проверяет политику Windows и других ОС независимо от host-системы.
PR #64 остается полезным диагностическим примером: устранение лишних обновлений убирало нагрузку. Эта реализация использует upstream-исправление жизненного цикла eframe и ограниченный idle repaint, а не копирует workaround PR #64 с одним update frame.
Статус проверки
82984992598314186932Текущая тестовая сборка для Windows:
entropy-windowsПроверка в Windows завершена: нулевая загрузка CPU подтверждена для обычного, свернутого и скрытого в трей окна при USB- и Bluetooth-подключении. Восстановление из трея и закрытие приложения также работают корректно.
Проверка
main; сохранено пересекающееся поведение device connect, layer write, picker и lifecyclecargo test --all-targets: 196 тестов проходитcargo check --all-targetscargo clippy --all-targets: проходит с существующим baseline предупрежденийrustfmt --checkдля затронутых файловgit diff --checkringСсылки
App::logic/App::uiСвязано с #59
Связано с #64