Drop dead Win32 retained key state

This commit is contained in:
2026-06-17 10:49:49 +02:00
parent 00f97c71b5
commit 59a9074109
4 changed files with 6 additions and 17 deletions

View File

@@ -70,6 +70,9 @@ What is already real:
- `pp_app_core` - `pp_app_core`
Latest slice: 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 - `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 the Linux entrypoint-owned shell; `App::set_platform_services()` no longer
installs Linux-specific GLFW title behavior. installs Linux-specific GLFW title behavior.

View File

@@ -78,6 +78,8 @@ Completed, blocked, and superseded task history moved to
the queue is now ordered by code movement instead. the queue is now ordered by code movement instead.
Current slice: 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 - `linux/src/main.cpp` now owns the Linux FPS-title callback lifecycle
directly, and `src/app_events.cpp` no longer installs Linux-specific title directly, and `src/app_events.cpp` no longer installs Linux-specific title
behavior from `App::set_platform_services()`. behavior from `App::set_platform_services()`.

View File

@@ -14,11 +14,6 @@ void destroy_window();
namespace pp::platform::windows { namespace pp::platform::windows {
struct RetainedState final
{
bool keys[256]{};
};
namespace { namespace {
[[nodiscard]] WacomTablet& active_wacom_tablet() [[nodiscard]] WacomTablet& active_wacom_tablet()
@@ -47,7 +42,7 @@ namespace {
void synchronize_app_key_state_from_keyboard(App& app) void synchronize_app_key_state_from_keyboard(App& app)
{ {
static BYTE keys[256]; BYTE keys[256];
if (!GetKeyboardState(keys)) if (!GetKeyboardState(keys))
return; return;
@@ -69,9 +64,7 @@ void synchronize_app_key_state_from_keyboard(App& app)
void initialize_retained_input_state() void initialize_retained_input_state()
{ {
auto& state = retained_state();
auto& vkey_map = retained_virtual_key_map(); 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 k = 1; k < 256; ++k) // ignore kKey::Unknown = 0
{ {
for (int vk = 0; vk < 256; ++vk) 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 pp::platform::windows::VrShellState& pp::platform::windows::retained_vr_shell_state() noexcept
{ {
static pp::platform::windows::VrShellState state; static pp::platform::windows::VrShellState state;

View File

@@ -7,10 +7,7 @@
namespace pp::platform::windows { namespace pp::platform::windows {
struct RetainedState;
void initialize_retained_input_state(); void initialize_retained_input_state();
RetainedState& retained_state();
pp::platform::windows::VrShellState& retained_vr_shell_state() noexcept; pp::platform::windows::VrShellState& retained_vr_shell_state() noexcept;
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp); LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);