Remove dead legacy storage fallback and hide GLFW state

This commit is contained in:
2026-06-17 10:34:26 +02:00
parent 5491ed4bf5
commit f45fc8226c
8 changed files with 43 additions and 51 deletions

View File

@@ -70,6 +70,13 @@ What is already real:
- `pp_app_core`
Latest slice:
- `src/platform_legacy/legacy_platform_state.*` no longer carries the dead
generic storage-path singleton for the current runtime matrix.
- `src/platform_legacy/legacy_platform_services.cpp` now drops the dead generic
storage-path fallback read; only the platform-specific storage-path branches
remain live.
- `src/legacy_app_startup_services.cpp` no longer seeds the dead generic
storage-path fallback state on non-Android startup.
- `src/platform_legacy/legacy_platform_services.cpp` now reads Android storage
paths from Android-owned retained state instead of the shared legacy
storage-path singleton.
@@ -80,6 +87,9 @@ Latest slice:
`src/platform_legacy/legacy_platform_state.*` now route the Linux FPS-title
callback through a narrow legacy GLFW title helper instead of reaching into
retained GLFW window state from `App::set_platform_services(...)`.
- `src/platform_legacy/legacy_platform_state.h` no longer exports the raw
retained GLFW window-state accessor; callers now go through narrow GLFW
helpers only.
- `src/platform_apple/apple_platform_state.cpp` no longer reads Apple storage
paths from `pp::platform::legacy::active_legacy_storage_paths()`;
Apple-owned retained state now carries that path bundle.

View File

@@ -78,6 +78,13 @@ Completed, blocked, and superseded task history moved to
the queue is now ordered by code movement instead.
Current slice:
- `src/platform_legacy/legacy_platform_state.*` no longer keeps the dead
generic storage-path singleton for the current platform matrix.
- `src/platform_legacy/legacy_platform_services.cpp` now returns only
platform-specific storage-path branches; the dead generic fallback read is
gone.
- `src/legacy_app_startup_services.cpp` no longer writes the dead generic
storage-path fallback state on non-Android startup.
- `src/platform_legacy/legacy_platform_services.cpp` plus
`src/platform_legacy/legacy_platform_state.*` now give Android its own
retained storage-path surface instead of reading the shared legacy singleton.
@@ -87,6 +94,8 @@ Current slice:
`src/platform_legacy/legacy_platform_state.*` now use a narrow GLFW title
helper for Linux FPS-title updates instead of direct retained-window access
in the app event layer.
- `src/platform_legacy/legacy_platform_state.h` no longer exports the raw
retained GLFW window accessor.
- `src/platform_apple/apple_platform_state.cpp` now reads Apple storage paths
from Apple-owned retained state rather than the shared legacy storage-path
singleton.

View File

@@ -65,6 +65,7 @@ int main(int argc, char** args)
printf("could not create window\n");
return 1;
}
pp::platform::legacy::set_legacy_glfw_window(wnd);
glfwSetCursorPosCallback(wnd, [](GLFWwindow* wnd, double x, double y){
g_cursor_pos = glm::vec2(x, y);
@@ -97,7 +98,7 @@ int main(int argc, char** args)
}, true);
});
glfwMakeContextCurrent(wnd);
pp::platform::legacy::acquire_legacy_glfw_render_context();
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
printf("Failed to initialize OpenGL context\n");
@@ -112,7 +113,6 @@ int main(int argc, char** args)
umask(0);
App::I = &app;
pp::platform::legacy::set_legacy_glfw_window(wnd);
app.set_platform_services(platform_services.get());
app.initLog();
app.create();

View File

@@ -142,13 +142,6 @@ void execute_legacy_app_init_log(App& app)
app.rec_path,
app.tmp_path,
});
#else
pp::platform::legacy::set_legacy_storage_paths({
app.data_path,
app.work_path,
app.rec_path,
app.tmp_path,
});
#endif
//LogRemote::I.start();

View File

@@ -86,7 +86,7 @@ public:
#elif defined(__ANDROID__)
return pp::platform::legacy::active_legacy_android_storage_paths();
#else
return pp::platform::legacy::active_legacy_storage_paths();
return {};
#endif
}

View File

@@ -15,26 +15,22 @@ void webgl_sync();
namespace pp::platform::legacy {
namespace {
struct RetainedLegacyStoragePaths final {
pp::platform::PlatformStoragePaths storage_paths;
};
#ifdef __ANDROID__
struct RetainedLegacyAndroidStoragePaths final {
pp::platform::PlatformStoragePaths storage_paths;
};
#endif
#if defined(__LINUX__) || defined(__WEB__)
struct RetainedLegacyGlfwPlatformState final {
GLFWwindow* window = nullptr;
};
#endif
struct RetainedLegacyWebPlatformServicesBinding final {
pp::platform::WebPlatformServices* services = nullptr;
};
[[nodiscard]] RetainedLegacyStoragePaths& retained_legacy_storage_paths()
{
static RetainedLegacyStoragePaths state;
return state;
}
#ifdef __ANDROID__
[[nodiscard]] RetainedLegacyAndroidStoragePaths& retained_legacy_android_storage_paths()
{
@@ -43,6 +39,14 @@ struct RetainedLegacyWebPlatformServicesBinding final {
}
#endif
#if defined(__LINUX__) || defined(__WEB__)
[[nodiscard]] RetainedLegacyGlfwPlatformState& retained_legacy_glfw_platform_state()
{
static RetainedLegacyGlfwPlatformState state;
return state;
}
#endif
[[nodiscard]] RetainedLegacyWebPlatformServicesBinding& retained_legacy_web_platform_services_binding()
{
static RetainedLegacyWebPlatformServicesBinding state;
@@ -89,20 +93,14 @@ public:
}
#if defined(__LINUX__) || defined(__WEB__)
[[nodiscard]] RetainedLegacyGlfwWindowState& active_legacy_glfw_window_state()
{
static RetainedLegacyGlfwWindowState state;
return state;
}
void set_legacy_glfw_window(GLFWwindow* window)
{
active_legacy_glfw_window_state().window = window;
retained_legacy_glfw_platform_state().window = window;
}
void set_legacy_glfw_window_title(std::string_view title)
{
auto* const window = active_legacy_glfw_window_state().window;
auto* const window = retained_legacy_glfw_platform_state().window;
if (!window)
return;
@@ -112,17 +110,17 @@ void set_legacy_glfw_window_title(std::string_view title)
void acquire_legacy_glfw_render_context()
{
glfwMakeContextCurrent(active_legacy_glfw_window_state().window);
glfwMakeContextCurrent(retained_legacy_glfw_platform_state().window);
}
void present_legacy_glfw_render_context()
{
glfwSwapBuffers(active_legacy_glfw_window_state().window);
glfwSwapBuffers(retained_legacy_glfw_platform_state().window);
}
void request_legacy_glfw_app_close()
{
glfwSetWindowShouldClose(active_legacy_glfw_window_state().window, GLFW_TRUE);
glfwSetWindowShouldClose(retained_legacy_glfw_platform_state().window, GLFW_TRUE);
}
#endif
@@ -220,16 +218,6 @@ void save_legacy_web_prepared_file(
return true;
}
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_storage_paths()
{
return retained_legacy_storage_paths().storage_paths;
}
void set_legacy_storage_paths(pp::platform::PlatformStoragePaths paths)
{
retained_legacy_storage_paths().storage_paths = std::move(paths);
}
#ifdef __ANDROID__
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_android_storage_paths()
{

View File

@@ -12,11 +12,6 @@ struct GLFWwindow;
namespace pp::platform::legacy {
#if defined(__LINUX__) || defined(__WEB__)
struct RetainedLegacyGlfwWindowState final {
GLFWwindow* window = nullptr;
};
[[nodiscard]] RetainedLegacyGlfwWindowState& active_legacy_glfw_window_state();
void set_legacy_glfw_window(GLFWwindow* window);
void set_legacy_glfw_window_title(std::string_view title);
void acquire_legacy_glfw_render_context();
@@ -49,9 +44,6 @@ void save_legacy_web_prepared_file(
std::string_view suggested_name,
pp::platform::PreparedFileCallback callback);
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_storage_paths();
void set_legacy_storage_paths(pp::platform::PlatformStoragePaths paths);
#ifdef __ANDROID__
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_android_storage_paths();
void set_legacy_android_storage_paths(pp::platform::PlatformStoragePaths paths);

View File

@@ -121,7 +121,6 @@ void CanvasOnWheel(float y)
void StartApp()
{
App::I = &app;
pp::platform::legacy::set_legacy_glfw_window(wnd);
pp::platform::legacy::set_legacy_web_platform_services(g_web_platform_services.get());
app.set_platform_services(g_platform_services.get());
app.initLog();
@@ -206,7 +205,8 @@ int main()
if (glfwInit() != GL_TRUE)
printf("Failed to init GLFW");
wnd = glfwCreateWindow(1024, 768, "PanoPainter", nullptr, nullptr);
glfwMakeContextCurrent(wnd);
pp::platform::legacy::set_legacy_glfw_window(wnd);
pp::platform::legacy::acquire_legacy_glfw_render_context();
/*
glfwSetCursorPosCallback(wnd, [](GLFWwindow* wnd, double x, double y){