Skip to content

SDL_WINDOWEVENT_LEAVE unreliable on macOS surfaceless EGL + CAMetalLayer setup #2992

Description

@iamaperson000

On the macOS Apple Silicon path (surfaceless EGL + CAMetalLayer present, introduced in #2991), `SDL_WINDOWEVENT_LEAVE` events do not appear to fire reliably. This causes BAR's `gfx_limit_idle_fps` widget to engage the VSync clamp during active play, dropping FPS to ~15.

Repro: run BAR on Apple Silicon with the workaround in beyond-all-reason/Beyond-All-Reason#7813 disabled (remove the `Platform.osFamily == "MacOS"` short-circuit at the top of `gfx_limit_idle_fps:Update()`). With mouse inside the window during active play, FPS should stay at 30+ but clamps to ~15 after a few seconds, as if the engine thought the mouse had left.

Workaround (in place): the BAR widget short-circuits its `Update()` on `Platform.osFamily == "MacOS"`. See beyond-all-reason/Beyond-All-Reason#7813 commit history for `gfx_limit_idle_fps`.

Proper fix (engine-side): investigate why SDL `WINDOWEVENT_LEAVE` doesn't fire on the surfaceless EGL + CAMetalLayer window. Likely candidates:

  • SDL2 surfaceless window may not be a "real" SDL_Window for event purposes; mouse-leave detection may need to come from CAMetalLayer's tracking area instead.
  • A synthetic mouse-leave event could be emitted from the Metal event-handling path.

Filed as a follow-up to #2991 so the Mac-side widget workaround can eventually be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions