Skip to content

Fix unit frame health fills breaking on window resize - #2076

Open
robert-clayton wants to merge 1 commit into
EllesmereGaming:mainfrom
robert-clayton:fix-unitframes-resize
Open

robert-clayton wants to merge 1 commit into
EllesmereGaming:mainfrom
robert-clayton:fix-unitframes-resize

Conversation

@robert-clayton

Copy link
Copy Markdown

What does this PR do?

Unit frame health fills render empty after the WoW window is resized, and only recover on a /reload. EllesmereUIUnitFrames registers no display or scale listeners, so a pure resolution change (DISPLAY_SIZE_CHANGED, which fires without a UI-scale change) never triggers a rebuild, and the bars keep their pre-resize pixel-snapped geometry. The main addon's scaleWatcher only re-runs the unit-frame reload through PP.SetUIScale, which a plain resize does not reach.

The fix registers DISPLAY_SIZE_CHANGED + UI_SCALE_CHANGED in the unit-frame addon and re-runs the existing ns.ReloadFrames on those events, deferred one frame so the new screen size settles before the rebuild reads GetPhysicalScreenSize.

How was it tested?

Live (Midnight 12.1) on a Hyprland/Wayland desktop, where Super+F toggles the game window between windowed and fullscreen and fires DISPLAY_SIZE_CHANGED. Before the patch the fills go empty on the toggle and stay empty until /reload; after, they refill correctly on every toggle with no manual reload, in and out of combat.

Screenshots

Before, using Super+F to toggle fullscreen in Hyprland:

before, using Super+F to toggle fullscreen in hyprland

After, using Super+F to toggle fullscreen in Hyprland:

after, using Super+F to toggle fullscreen in hyprland

Checklist

  • New settings default OFF -> N/A. Bug fix, no setting. Criterion 2 exempts genuine bug fixes; the behavior change is broken frames becoming correct frames.
  • Zero cost while disabled -> N/A for the same reason. As a bug fix it is always on: one frame and two event registrations. Both events fire only on a resolution/UI-scale change, essentially never during play, so the standing cost is nil.
  • Cheap while enabled: event-driven, no polling, no per-frame allocations. Two rare events; the C_Timer.After(0) is a one-shot next-frame defer, not a recurring timer gate.
  • No writes onto Blizzard-owned frames. SetScript is on the addon's own CreateFrame("Frame"), never a Blizzard frame. Reuses ns.ReloadFrames, already combat-safe (its throttle guards restricted Show/Hide behind InCombatLockdown and defers via PLAYER_REGEN_ENABLED), so no new taint surface.
  • Tested in-game on live; no version gates or pre-Midnight APIs added.

EllesmereUIUnitFrames registered no display/scale listeners, so a pure
resolution change (DISPLAY_SIZE_CHANGED, which fires without a UI-scale
change) never triggered a rebuild. Health fills kept their pre-resize
pixel-snapped geometry and rendered empty until a manual /reload. The
main addon's scaleWatcher only re-runs the unit-frame reload through
PP.SetUIScale, which a plain resize does not reach.

Register DISPLAY_SIZE_CHANGED + UI_SCALE_CHANGED and re-run the existing
ns.ReloadFrames on those events, deferred one frame so the new screen
size settles before the rebuild reads GetPhysicalScreenSize. ReloadFrames
is throttled and already combat-safe (guards restricted Show/Hide behind
InCombatLockdown, defers via PLAYER_REGEN_ENABLED), so no new taint
surface. SetScript is on the addon's own frame, not a Blizzard frame.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0133ZDCzs57VxRJ8YL3sQ7DB
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.

1 participant