Skip to content

Fix infinite vid_restart loop from SDL resize events on macOS#106

Merged
sago007 merged 1 commit intoOpenArena:masterfrom
jackharrhy:fix/sdl-resize-loop
Apr 10, 2026
Merged

Fix infinite vid_restart loop from SDL resize events on macOS#106
sago007 merged 1 commit intoOpenArena:masterfrom
jackharrhy:fix/sdl-resize-loop

Conversation

@jackharrhy
Copy link
Copy Markdown

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! :)

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.
@sago007
Copy link
Copy Markdown
Member

sago007 commented Apr 10, 2026

This does indeed make sense. I have a feeling that this could also happen on Linux with some Nvidia+Wayland combinations.

@sago007 sago007 merged commit 905059d into OpenArena:master Apr 10, 2026
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.

2 participants