Skip to content

Deliver quit events and survive SDL3's asynchronous fullscreen - #570

Merged
bibendovsky merged 4 commits into
bibendovsky:wipfrom
AdamCoulterOz:fix/runtime-found
Aug 7, 2026
Merged

Deliver quit events and survive SDL3's asynchronous fullscreen#570
bibendovsky merged 4 commits into
bibendovsky:wipfrom
AdamCoulterOz:fix/runtime-found

Conversation

@AdamCoulterOz

Copy link
Copy Markdown

Found by running wip; each of these has a user-visible symptom.

  • Deliver the quit request to the game — closing the window did nothing
  • Survive SDL3's asynchronous fullscreen at startup — SDL3 defers mode changes for hidden windows, so the layout and the renderer's offscreen chain were sized from the stale pre-fullscreen window and a fullscreen boot showed only black. Size from what was requested, and re-derive the layout when the real pixel size arrives
  • Do not end the process when shutting down a lost device
  • Carry the level across from the back-end logger — every message was logged as information

🤖 Generated with Claude Code

@AdamCoulterOz
AdamCoulterOz force-pushed the fix/runtime-found branch 4 times, most recently from 8921260 to ae9fc1b Compare August 4, 2026 15:52
AdamCoulterOz and others added 4 commits August 7, 2026 14:59
Tearing the video system down waits for the device to go idle, and that wait
fails once the device has been lost. The destructor let the failure escape,
and a destructor may not throw, so a recoverable graphics error ended the
process with an abort during shut-down instead of a clean exit.

Report the failure and carry on with the shut-down. The reporting is itself
guarded, since a throw from there would end the process just the same.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The system logger adapter asserted that everything reaching it was
informational, then logged it as such regardless. The graphics and audio
back-ends report genuine warnings and failures through that interface - a lost
graphics device among them - so the assertion ended a debug build at the
moment something had already gone wrong, and a release build filed the failure
away as information.

Carry the level across instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The event enumeration has had a quit type all along and the game acts on it,
shutting down cleanly, but the SDL back-end never produced one: closing the
last window, quitting from the dock or the application menu, and a termination
request from the system were all discarded, leaving the process to be killed
outright with the configuration unsaved.

Translate the event.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SDL3 applies fullscreen changes asynchronously and defers them entirely
for hidden windows, so apply_window_mode's get_size_in_pixels() right
after set_window_mode returned the pre-fullscreen 320x240 during
startup.  The layout, the vanilla raycaster, and the renderer's
offscreen chain were then built for that stale size, and a fullscreen
boot showed only black while the game ran normally underneath.

Size the layout from what was actually requested instead of the live
window: set_window_mode now reports the effective size (the chosen
closest display mode for exclusive fullscreen, the clamped request for
windowed) and syncs where the window can settle.  As a backstop,
translate SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED and re-derive the layout
whenever the real pixel size diverges - this also covers fake
fullscreen on a hidden startup window, whose final size is only known
once shown.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bibendovsky bibendovsky added the bug label Aug 7, 2026
@bibendovsky bibendovsky added this to the v1.4.0 milestone Aug 7, 2026
@bibendovsky
bibendovsky merged commit 2bb8570 into bibendovsky:wip Aug 7, 2026
6 checks passed
@bibendovsky

Copy link
Copy Markdown
Owner

Thank you!

@AdamCoulterOz
AdamCoulterOz deleted the fix/runtime-found branch August 8, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants