Own legacy platform services on Linux

This commit is contained in:
2026-06-17 10:07:24 +02:00
parent f98e4f4889
commit c225529cbf
5 changed files with 24 additions and 1 deletions

View File

@@ -70,6 +70,12 @@ What is already real:
- `pp_app_core` - `pp_app_core`
Latest slice: Latest slice:
- `src/platform_legacy/legacy_platform_services.*` now exposes an ownable
`create_platform_services()` entrypoint alongside the legacy fallback
accessor.
- `linux/src/main.cpp` now owns a local legacy `PlatformServices` instance and
binds it into `App` explicitly instead of binding the process-global legacy
accessor directly.
- `src/app_events.cpp` no longer silently falls back to - `src/app_events.cpp` no longer silently falls back to
`pp::platform::legacy::platform_services()` when `App` has no bound platform `pp::platform::legacy::platform_services()` when `App` has no bound platform
services; the live app path now expects explicit platform-service ownership. services; the live app path now expects explicit platform-service ownership.

View File

@@ -78,6 +78,12 @@ 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_legacy/legacy_platform_services.*` now exposes an ownable
`create_platform_services()` entrypoint while keeping the fallback singleton
for non-migrated platforms.
- `linux/src/main.cpp` now binds an owned legacy `PlatformServices` instance
into `App`, making Linux the first explicit per-entrypoint owner of that
legacy service implementation.
- `src/app_events.cpp` no longer hides a fallback to - `src/app_events.cpp` no longer hides a fallback to
`pp::platform::legacy::platform_services()`; touched app platform dispatch `pp::platform::legacy::platform_services()`; touched app platform dispatch
now expects an explicitly bound platform-services pointer. now expects an explicitly bound platform-services pointer.

View File

@@ -55,6 +55,7 @@ void error_log(int code, const char * s)
int main(int argc, char** args) int main(int argc, char** args)
{ {
auto platform_services = pp::platform::legacy::create_platform_services();
GLFWwindow* wnd = nullptr; GLFWwindow* wnd = nullptr;
glfwSetErrorCallback(error_log); glfwSetErrorCallback(error_log);
if (!glfwInit()) if (!glfwInit())
@@ -121,7 +122,7 @@ int main(int argc, char** args)
App::I = &app; App::I = &app;
pp::platform::legacy::set_legacy_glfw_window(wnd); pp::platform::legacy::set_legacy_glfw_window(wnd);
app.set_platform_services(&pp::platform::legacy::platform_services()); app.set_platform_services(platform_services.get());
app.initLog(); app.initLog();
app.create(); app.create();
app.width = 800; app.width = 800;

View File

@@ -2,6 +2,8 @@
#include "platform_legacy/legacy_platform_services.h" #include "platform_legacy/legacy_platform_services.h"
#include "platform_legacy/legacy_platform_state.h" #include "platform_legacy/legacy_platform_state.h"
#include <memory>
#include "legacy_ui_gl_dispatch.h" #include "legacy_ui_gl_dispatch.h"
#include "log.h" #include "log.h"
#include "platform_apple/apple_platform_services.h" #include "platform_apple/apple_platform_services.h"
@@ -552,4 +554,9 @@ PlatformServices& platform_services()
static LegacyPlatformServices services; static LegacyPlatformServices services;
return services; return services;
} }
std::unique_ptr<PlatformServices> create_platform_services()
{
return std::make_unique<LegacyPlatformServices>();
}
} }

View File

@@ -1,9 +1,12 @@
#pragma once #pragma once
#include <memory>
#include "platform_api/platform_services.h" #include "platform_api/platform_services.h"
namespace pp::platform::legacy { namespace pp::platform::legacy {
[[nodiscard]] PlatformServices& platform_services(); [[nodiscard]] PlatformServices& platform_services();
[[nodiscard]] std::unique_ptr<PlatformServices> create_platform_services();
} }