diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 10201500..acf852ea 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -70,6 +70,12 @@ What is already real: - `pp_app_core` Latest slice: +- `src/platform_windows/windows_runtime_shell.cpp` no longer keeps a second + retained `App*` copy alongside `App::I`; the runtime shell now reads the + bound app directly from the singleton composition edge. +- `src/platform_windows/windows_window_shell.*` and + `src/platform_windows/windows_platform_services.cpp` now keep Win32 VR state + outside the generic retained input-state bundle. - `src/platform_legacy/legacy_platform_state.*` no longer carries the dead generic storage-path singleton for the current runtime matrix. - `src/platform_legacy/legacy_platform_services.cpp` now drops the dead generic diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index 40f9dfac..4e20f32b 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -78,6 +78,11 @@ Completed, blocked, and superseded task history moved to the queue is now ordered by code movement instead. Current slice: +- `src/platform_windows/windows_runtime_shell.cpp` no longer stores a second + retained `App*` alongside `App::I`. +- `src/platform_windows/windows_window_shell.*` plus + `src/platform_windows/windows_platform_services.cpp` now separate Win32 VR + state from the generic retained input-state bundle. - `src/platform_legacy/legacy_platform_state.*` no longer keeps the dead generic storage-path singleton for the current platform matrix. - `src/platform_legacy/legacy_platform_services.cpp` now returns only diff --git a/src/platform_windows/windows_platform_services.cpp b/src/platform_windows/windows_platform_services.cpp index 73f51761..f1baa2ca 100644 --- a/src/platform_windows/windows_platform_services.cpp +++ b/src/platform_windows/windows_platform_services.cpp @@ -106,7 +106,7 @@ namespace pp::platform::windows { VrShellState& platform_vr_state() noexcept { - return retained_state().vr; + return retained_vr_shell_state(); } } diff --git a/src/platform_windows/windows_runtime_shell.cpp b/src/platform_windows/windows_runtime_shell.cpp index 8b723732..76b34908 100644 --- a/src/platform_windows/windows_runtime_shell.cpp +++ b/src/platform_windows/windows_runtime_shell.cpp @@ -24,7 +24,6 @@ struct RetainedMainWindowSessionState final { struct RetainedWindowsRuntimeState final { std::unique_ptr owned_app; - App* app = nullptr; WacomTablet tablet; }; @@ -131,20 +130,18 @@ void shutdown_main_window_runtime(const MainWindowStartupState& startup, HINSTAN void bind_app(App* app) noexcept { - retained_runtime_state().app = app; App::I = app; } App* bound_app() noexcept { - return retained_runtime_state().app; + return App::I; } void release_bound_app() noexcept { - auto& state = retained_runtime_state(); bind_app(nullptr); - state.owned_app.reset(); + retained_runtime_state().owned_app.reset(); } WacomTablet* bound_wacom_tablet() noexcept diff --git a/src/platform_windows/windows_window_shell.cpp b/src/platform_windows/windows_window_shell.cpp index ef6e3a4c..e0c74850 100644 --- a/src/platform_windows/windows_window_shell.cpp +++ b/src/platform_windows/windows_window_shell.cpp @@ -39,11 +39,6 @@ namespace { return retained_state().vkey_map; } -[[nodiscard]] pp::platform::windows::VrShellState& retained_vr_shell_state() -{ - return retained_state().vr; -} - void synchronize_app_key_state_from_keyboard(App& app) { static BYTE keys[256]; @@ -98,6 +93,12 @@ RetainedState& retained_state() return state; } +pp::platform::windows::VrShellState& pp::platform::windows::retained_vr_shell_state() noexcept +{ + static pp::platform::windows::VrShellState state; + return state; +} + LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { auto* app = bound_app(); diff --git a/src/platform_windows/windows_window_shell.h b/src/platform_windows/windows_window_shell.h index e1849251..d704d07f 100644 --- a/src/platform_windows/windows_window_shell.h +++ b/src/platform_windows/windows_window_shell.h @@ -10,13 +10,13 @@ struct RetainedState { bool keys[256]{}; std::map vkey_map; - pp::platform::windows::VrShellState vr; }; namespace pp::platform::windows { void initialize_retained_input_state(); RetainedState& retained_state(); +pp::platform::windows::VrShellState& retained_vr_shell_state() noexcept; LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp); }