Trim Win32 runtime and VR retained state

This commit is contained in:
2026-06-17 10:40:24 +02:00
parent f45fc8226c
commit 3941c54d90
6 changed files with 21 additions and 12 deletions

View File

@@ -106,7 +106,7 @@ namespace pp::platform::windows {
VrShellState& platform_vr_state() noexcept
{
return retained_state().vr;
return retained_vr_shell_state();
}
}

View File

@@ -24,7 +24,6 @@ struct RetainedMainWindowSessionState final {
struct RetainedWindowsRuntimeState final {
std::unique_ptr<App> 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

View File

@@ -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();

View File

@@ -10,13 +10,13 @@ struct RetainedState
{
bool keys[256]{};
std::map<kKey, int> 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);
}