From 00f97c71b50e71e0afd805853e8930fc7e2e3582 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Wed, 17 Jun 2026 10:46:02 +0200 Subject: [PATCH] Own Linux title callback and trim Win32 key state --- docs/modernization/roadmap.md | 5 +++++ docs/modernization/tasks.md | 5 +++++ linux/src/main.cpp | 4 ++++ src/app_events.cpp | 12 ------------ src/platform_windows/windows_window_shell.cpp | 8 +++++++- src/platform_windows/windows_window_shell.h | 9 ++------- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index acf852ea..ca4ba4af 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -70,6 +70,11 @@ What is already real: - `pp_app_core` Latest slice: +- `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. +- `src/platform_windows/windows_window_shell.*` now keeps the Win32 virtual-key + map outside the retained input-state struct, shrinking that shared pocket. - `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. diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index 4e20f32b..4bd4c264 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: +- `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()`. +- `src/platform_windows/windows_window_shell.*` now stores the Win32 virtual-key + map separately from the retained input-state struct. - `src/platform_windows/windows_runtime_shell.cpp` no longer stores a second retained `App*` alongside `App::I`. - `src/platform_windows/windows_window_shell.*` plus diff --git a/linux/src/main.cpp b/linux/src/main.cpp index 5a5ea828..2f172da6 100644 --- a/linux/src/main.cpp +++ b/linux/src/main.cpp @@ -66,6 +66,9 @@ int main(int argc, char** args) return 1; } pp::platform::legacy::set_legacy_glfw_window(wnd); + pp::platform::linux_desktop::set_fps_title_callback([wnd](std::string title) { + glfwSetWindowTitle(wnd, title.c_str()); + }); glfwSetCursorPosCallback(wnd, [](GLFWwindow* wnd, double x, double y){ g_cursor_pos = glm::vec2(x, y); @@ -129,6 +132,7 @@ int main(int argc, char** args) app.ui_thread_stop(); app.render_thread_stop(); app.terminate(); + pp::platform::linux_desktop::set_fps_title_callback({}); return 0; } diff --git a/src/app_events.cpp b/src/app_events.cpp index 95a3e841..71283bb9 100644 --- a/src/app_events.cpp +++ b/src/app_events.cpp @@ -58,18 +58,6 @@ namespace { void App::set_platform_services(pp::platform::PlatformServices* services) noexcept { platform_services_ = services; -#ifdef __LINUX__ - if (services) - { - pp::platform::linux_desktop::set_fps_title_callback([](std::string title) { - pp::platform::legacy::set_legacy_glfw_window_title(title); - }); - } - else - { - pp::platform::linux_desktop::set_fps_title_callback({}); - } -#endif } pp::platform::PlatformServices* App::platform_services() const noexcept diff --git a/src/platform_windows/windows_window_shell.cpp b/src/platform_windows/windows_window_shell.cpp index e0c74850..bf370f00 100644 --- a/src/platform_windows/windows_window_shell.cpp +++ b/src/platform_windows/windows_window_shell.cpp @@ -14,6 +14,11 @@ void destroy_window(); namespace pp::platform::windows { +struct RetainedState final +{ + bool keys[256]{}; +}; + namespace { [[nodiscard]] WacomTablet& active_wacom_tablet() @@ -36,7 +41,8 @@ namespace { [[nodiscard]] std::map& retained_virtual_key_map() { - return retained_state().vkey_map; + static std::map vkey_map; + return vkey_map; } void synchronize_app_key_state_from_keyboard(App& app) diff --git a/src/platform_windows/windows_window_shell.h b/src/platform_windows/windows_window_shell.h index d704d07f..d9c9b4d4 100644 --- a/src/platform_windows/windows_window_shell.h +++ b/src/platform_windows/windows_window_shell.h @@ -1,19 +1,14 @@ #pragma once #include -#include #include "event.h" #include "platform_windows/windows_vr_shell.h" -struct RetainedState -{ - bool keys[256]{}; - std::map vkey_map; -}; - namespace pp::platform::windows { +struct RetainedState; + void initialize_retained_input_state(); RetainedState& retained_state(); pp::platform::windows::VrShellState& retained_vr_shell_state() noexcept;