Skip to content

fix: aggressive window refresh loop and focus-stealing on Windows - #20

Open
ZFordDev wants to merge 3 commits into
mainfrom
19-aggressive-window-refresh-loop-and-focus-stealing-on-windows
Open

fix: aggressive window refresh loop and focus-stealing on Windows#20
ZFordDev wants to merge 3 commits into
mainfrom
19-aggressive-window-refresh-loop-and-focus-stealing-on-windows

Conversation

@ZFordDev

Copy link
Copy Markdown
Owner

Fixes #19

Summary

On legacy hardware (<=4 logical cores AND <=8 GiB RAM), Glint's translucent, painter-rendered HUD triggers a GPU/DWM recomposition loop that causes window flicker and focus-stealing. This PR adds a hardware capability check that forces software rendering on qualifying machines before the QApplication is constructed.

Changes

  • \src/core/compat.py\ (new): low-spec detection (\is_low_spec()), conservative thresholds so modern hardware keeps accelerated rendering
  • \src/app.py: applies \AA_UseSoftwareOpenGL\ before QApplication construction when low-spec; applied on every platform for consistent behavior. Factored into a testable _maybe_disable_hardware_acceleration()\ helper
  • \ ests/test_core.py\ + \ ests/test_ui.py: coverage for detection and the app-level gating
  • \CHANGELOG.md: moved Aggressive window refresh loop and focus-stealing on Windows #19 from Plan to Fixed

Important correction during implementation

The initial fallback used \AA_DisableHardwareAcceleration, which does not exist in Qt 6 and would have crashed at startup on every low-spec machine. A test I added caught this; the fallback now uses Qt 6's replacement \AA_UseSoftwareOpenGL.

Notes

Physical reproduction on a Dell Optiplex SFF (or a Windows 10 VM) is still needed to confirm the DWM behavior resolves on live low-spec hardware, per the reproduction checklist in the issue. The detection/decision logic is unit-tested.

Detect a low-spec profile (<=4 logical cores and <=8 GiB RAM) and disable
hardware acceleration before QApplication construction. This sidesteps the
GPU/DWM recomposition loop that causes the translucent HUD to flicker and
steal focus on older Windows machines. Closes #19.
Qt 6 removed AA_DisableHardwareAcceleration; the fallback used a
nonexistent attribute and would have crashed low-spec hosts at startup.
Switch to AA_UseSoftwareOpenGL and apply the low-spec software-rendering
fallback on every platform for consistent behavior independent of the
compositor or graphics stack. Factor the decision into a testable helper.
@ZFordDev ZFordDev linked an issue Aug 27, 2026 that may be closed by this pull request
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Aggressive window refresh loop and focus-stealing on Windows

1 participant