Fix infinite vid_restart loop from SDL resize events on macOS#106
Merged
sago007 merged 1 commit intoOpenArena:masterfrom Apr 10, 2026
Merged
Fix infinite vid_restart loop from SDL resize events on macOS#106sago007 merged 1 commit intoOpenArena:masterfrom
sago007 merged 1 commit intoOpenArena:masterfrom
Conversation
On macOS, the SDL2 Cocoa backend fires SDL_WINDOWEVENT_RESIZED during fullscreen window creation as the window goes through a size negotiation with the window server. Since vid_restart destroys and recreates the SDL window, each restart triggers a resize event with the same dimensions, which sets vidRestartTime, which fires another vid_restart one second later, creating an infinite loop. This does not occur on Linux or Windows where the X11/Win32 backends do not emit resize events during fullscreen window creation. Skip the vidRestartTime when the reported dimensions match what r_customwidth and r_customheight already hold.
Member
|
This does indeed make sense. I have a feeling that this could also happen on Linux with some Nvidia+Wayland combinations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On macOS, the SDL2 Cocoa backend fires SDL_WINDOWEVENT_RESIZED during fullscreen window creation as the window goes through a size negotiation with the window server. Since vid_restart destroys and recreates the SDL window, each restart triggers a resize event with the same dimensions, which sets vidRestartTime, which fires another vid_restart one second later, creating an infinite loop.
This does not occur on Linux or Windows where the X11/Win32 backends do not emit resize events during fullscreen window creation.
Skip the vidRestartTime when the reported dimensions match what r_customwidth and r_customheight already hold.
With this PR applied, alongside #105 and #104 , I can run / play OpenArena just fine on a M4 Macbook Pro! :)