diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 53f47b10..19ac4ba5 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -124,6 +124,9 @@ Latest slice: - `src/platform_windows/windows_lifecycle_state.*` now also owns the Win32 lifecycle close/VR control handoff, so `windows_lifecycle_shell.cpp` is down to a thinner message adapter over the retained lifecycle state helper. +- `src/platform_windows/windows_lifecycle_state.*` now also owns the Win32 + close-message shutdown/quit handoff, so `windows_lifecycle_shell.cpp` is + down to a one-line adapter over the retained lifecycle state helper. - `src/platform_windows/windows_runtime_shell.h` is now a thinner runtime entrypoint header that picks up the retained binding surface from `windows_runtime_state.h` instead of declaring a second shell-owned binding diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index f50ffe73..cf402807 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -133,6 +133,9 @@ Current slice: - `src/platform_windows/windows_lifecycle_state.*` now also owns the Win32 lifecycle close/VR control handoff, so `windows_lifecycle_shell.cpp` is down to a thinner message adapter over the retained lifecycle state helper. +- `src/platform_windows/windows_lifecycle_state.*` now also owns the Win32 + close-message shutdown/quit handoff, so `windows_lifecycle_shell.cpp` is + down to a one-line adapter over the retained lifecycle state helper. - `src/platform_windows/windows_runtime_shell.h` is thinner again and now imports that binding surface from `windows_runtime_state.h` instead of declaring shell-owned bind/release accessors itself. diff --git a/src/platform_windows/windows_lifecycle_shell.cpp b/src/platform_windows/windows_lifecycle_shell.cpp index 20b41cf7..c88db603 100644 --- a/src/platform_windows/windows_lifecycle_shell.cpp +++ b/src/platform_windows/windows_lifecycle_shell.cpp @@ -16,8 +16,7 @@ void request_window_close(HWND hWnd) void handle_window_close_message(VrShellState& vr) { - shutdown_bound_lifecycle(vr); - PostQuitMessage(0); + shutdown_bound_lifecycle_and_quit(vr); } void update_stylus_frame(float dt) diff --git a/src/platform_windows/windows_lifecycle_state.cpp b/src/platform_windows/windows_lifecycle_state.cpp index 9cbf180b..b7129946 100644 --- a/src/platform_windows/windows_lifecycle_state.cpp +++ b/src/platform_windows/windows_lifecycle_state.cpp @@ -46,6 +46,12 @@ void shutdown_bound_lifecycle(VrShellState& vr) shutdown_bound_app_runtime(); } +void shutdown_bound_lifecycle_and_quit(VrShellState& vr) +{ + shutdown_bound_lifecycle(vr); + PostQuitMessage(0); +} + bool start_bound_lifecycle_vr(VrShellState& vr, bool sandboxed) { return start_vr_shell(vr, sandboxed, retained_lifecycle_running_state()); diff --git a/src/platform_windows/windows_lifecycle_state.h b/src/platform_windows/windows_lifecycle_state.h index 2c1e3255..51b7ac7d 100644 --- a/src/platform_windows/windows_lifecycle_state.h +++ b/src/platform_windows/windows_lifecycle_state.h @@ -13,6 +13,7 @@ void mark_lifecycle_stopped() noexcept; [[nodiscard]] bool lifecycle_is_running() noexcept; [[nodiscard]] std::atomic& retained_lifecycle_running_state() noexcept; void shutdown_bound_lifecycle(VrShellState& vr); +void shutdown_bound_lifecycle_and_quit(VrShellState& vr); [[nodiscard]] bool start_bound_lifecycle_vr(VrShellState& vr, bool sandboxed); void stop_bound_lifecycle_vr(VrShellState& vr);