From 59a9074109b3913b6a0fc0fe905a0236d411b551 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Wed, 17 Jun 2026 10:49:49 +0200 Subject: [PATCH] Drop dead Win32 retained key state --- docs/modernization/roadmap.md | 3 +++ docs/modernization/tasks.md | 2 ++ src/platform_windows/windows_window_shell.cpp | 15 +-------------- src/platform_windows/windows_window_shell.h | 3 --- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index ca4ba4af..8c9a1663 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -70,6 +70,9 @@ What is already real: - `pp_app_core` Latest slice: +- `src/platform_windows/windows_window_shell.*` no longer carries the dead + retained raw key-state array or its accessor; Win32 key synchronization now + relies only on the virtual-key map plus `App` key state. - `linux/src/main.cpp` now binds and clears the FPS-title callback directly in the Linux entrypoint-owned shell; `App::set_platform_services()` no longer installs Linux-specific GLFW title behavior. diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index 4bd4c264..415e36d8 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -78,6 +78,8 @@ Completed, blocked, and superseded task history moved to the queue is now ordered by code movement instead. Current slice: +- `src/platform_windows/windows_window_shell.*` no longer keeps the dead + retained raw key-state array. - `linux/src/main.cpp` now owns the Linux FPS-title callback lifecycle directly, and `src/app_events.cpp` no longer installs Linux-specific title behavior from `App::set_platform_services()`. diff --git a/src/platform_windows/windows_window_shell.cpp b/src/platform_windows/windows_window_shell.cpp index bf370f00..460cf0c4 100644 --- a/src/platform_windows/windows_window_shell.cpp +++ b/src/platform_windows/windows_window_shell.cpp @@ -14,11 +14,6 @@ void destroy_window(); namespace pp::platform::windows { -struct RetainedState final -{ - bool keys[256]{}; -}; - namespace { [[nodiscard]] WacomTablet& active_wacom_tablet() @@ -47,7 +42,7 @@ namespace { void synchronize_app_key_state_from_keyboard(App& app) { - static BYTE keys[256]; + BYTE keys[256]; if (!GetKeyboardState(keys)) return; @@ -69,9 +64,7 @@ void synchronize_app_key_state_from_keyboard(App& app) void initialize_retained_input_state() { - auto& state = retained_state(); auto& vkey_map = retained_virtual_key_map(); - memset(&state.keys, 0, sizeof(state.keys)); for (int k = 1; k < 256; ++k) // ignore kKey::Unknown = 0 { for (int vk = 0; vk < 256; ++vk) @@ -93,12 +86,6 @@ void initialize_retained_input_state() } } -RetainedState& retained_state() -{ - static RetainedState state; - return state; -} - pp::platform::windows::VrShellState& pp::platform::windows::retained_vr_shell_state() noexcept { static pp::platform::windows::VrShellState state; diff --git a/src/platform_windows/windows_window_shell.h b/src/platform_windows/windows_window_shell.h index d9c9b4d4..0c6db7de 100644 --- a/src/platform_windows/windows_window_shell.h +++ b/src/platform_windows/windows_window_shell.h @@ -7,10 +7,7 @@ namespace pp::platform::windows { -struct RetainedState; - 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);