mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
Modern WoW exposes GetMouseFoci() (the stack of frames under the cursor) alongside GetMouseFocus(), with GetMouseFocus() == GetMouseFoci()[1]. Vanilla stores only the single topmost focus (Script_GetMouseFocus reads *(ctx + 0x7C)); there is no stored stack. Reimplement natively (no Lua polyfill, no hooks): walk the engine frame list that Script_EnumerateFrames iterates (head *(ctx + 0xCC4), next +0x308, low-bit/null sentinel), keep frames that are visible + mouse-enabled and whose rect contains the cursor (Region getters + cursor/effective-scale, mirroring Frame::Modern's IsMouseOver), order top-first by strata rank then frame level (level read directly from +0xC4), and force index 1 to the engine's stored focus so the invariant holds by Lua table identity. Frames are pushed via the shared UI::FrameObject::Push so == compares the same wrapper GetMouseFocus returns. Filters to the mouse-enabled (interactive) stack, matching 1.15.x (verified: GetMouseFocus skips a higher non-mouse-enabled cooldown to land on the button, and 1.15.x GetMouseFoci returns the same set). /framestack lists more because it is a pure-geometry debug view, not the mouse-focus set. Docs: API.md entry (Simplified Technical English).