Own Linux title callback and trim Win32 key state

This commit is contained in:
2026-06-17 10:46:02 +02:00
parent 3941c54d90
commit 00f97c71b5
6 changed files with 23 additions and 20 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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<kKey, int>& retained_virtual_key_map()
{
return retained_state().vkey_map;
static std::map<kKey, int> vkey_map;
return vkey_map;
}
void synchronize_app_key_state_from_keyboard(App& app)

View File

@@ -1,19 +1,14 @@
#pragma once
#include <Windows.h>
#include <map>
#include "event.h"
#include "platform_windows/windows_vr_shell.h"
struct RetainedState
{
bool keys[256]{};
std::map<kKey, int> 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;