Skip to content

cocoa: Fix macOS 26 popup window regression in 3.4.14 - #16153

Open
rlanday wants to merge 1 commit into
libsdl-org:mainfrom
rlanday:fix-macos26-popup-mouse
Open

cocoa: Fix macOS 26 popup window regression in 3.4.14#16153
rlanday wants to merge 1 commit into
libsdl-org:mainfrom
rlanday:fix-macos26-popup-mouse

Conversation

@rlanday

@rlanday rlanday commented Aug 15, 2026

Copy link
Copy Markdown

Summary

SDL 3.4.14 widened the macOS 26 stale-mouse-motion workaround from fullscreen Spaces to all windows (958c4cb). The workaround recomputes each motion event's position as SDL_GetGlobalMouseState() minus SDL_GetWindowPosition(), but window positions are parent-relative for popup windows, so popups received coordinates offset by their parent's global origin — or no usable motion events at all. The popup path was unreachable before 3.4.14 because a popup is never a fullscreen Space.

This converts the window position to global with SDL_RelativeToGlobalForWindow() before the subtraction. The helper is a no-op for non-popup windows, so top-level windows behave exactly as before — and SDL_cocoawindow.m already uses it for this conversion in four other places, so this applies the file's established pattern to the one call site that missed it.

Diagnosed by @pipiwoaini in #15967 (comment).

Testing

Fixes #16152

The macOS 26 mouse workaround recomputes motion positions as the
global mouse position minus SDL_GetWindowPosition(), but window
positions are parent-relative for popup windows, so popups received
coordinates offset by their parent's global origin. Unreachable
before 3.4.14, when the workaround was widened beyond fullscreen
spaces. Convert the position to global first with
SDL_RelativeToGlobalForWindow(), a no-op for non-popup windows.

Diagnosed by @pipiwoaini in libsdl-org#15967.
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.

macOS 26: popup windows receive wrong mouse coordinates since 3.4.14 (regression from widening the macOS 26 mouse workaround)

1 participant