Skip to content

[rcore][sdl] Fix: Ordered monitor indexing for SDL3#5717

Open
somamizobuchi wants to merge 1 commit intoraysan5:masterfrom
somamizobuchi:fix-sdl3-display-indexing
Open

[rcore][sdl] Fix: Ordered monitor indexing for SDL3#5717
somamizobuchi wants to merge 1 commit intoraysan5:masterfrom
somamizobuchi:fix-sdl3-display-indexing

Conversation

@somamizobuchi
Copy link
Copy Markdown
Contributor

Problem

SDL3 changed monitor indexing from ordered to logical IDs which breaks many functions that requires monitor index as input.

Solution

Similar to how gamepads are currently stored, keep an array of displayIDs that are queried and set once during PlatformInit() and indexed during function calls that require them. The event polling does not currently handle display add/remove events so this LUT is only valid if no monitors are added/removed.

Tests

MacOS Tahoe 26.3
MacBook Air M3
SDL 3.4.2
Tested using example/core/monitor_detector with two monitors

Formatting + fix missing ifdef
@somamizobuchi somamizobuchi force-pushed the fix-sdl3-display-indexing branch from 7651d53 to 9400289 Compare April 4, 2026 18:25
@somamizobuchi somamizobuchi marked this pull request as ready for review April 4, 2026 18:25
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