Own Windows tablet path and thin legacy web fallback

This commit is contained in:
2026-06-17 09:55:13 +02:00
parent 4c91701e11
commit ea1845d924
7 changed files with 65 additions and 27 deletions

View File

@@ -259,9 +259,9 @@ public:
void publish_exported_image(std::string_view path) override
{
const auto family = pp::platform::current_platform_family();
if (family == pp::platform::PlatformFamily::webgl)
if (pp::platform::legacy::handles_legacy_web_platform_family(family))
{
pp::platform::legacy::active_legacy_web_platform_services().publish_exported_image(path);
pp::platform::legacy::publish_legacy_web_exported_image(path);
return;
}
if (!pp::platform::platform_publishes_exported_images(family))
@@ -279,9 +279,9 @@ public:
void flush_persistent_storage() override
{
const auto family = pp::platform::current_platform_family();
if (family == pp::platform::PlatformFamily::webgl)
if (pp::platform::legacy::handles_legacy_web_platform_family(family))
{
pp::platform::legacy::active_legacy_web_platform_services().flush_persistent_storage();
pp::platform::legacy::flush_legacy_web_persistent_storage();
return;
}
if (!pp::platform::platform_flushes_persistent_storage(family))
@@ -449,8 +449,8 @@ public:
[[nodiscard]] int default_canvas_resolution() override
{
const auto family = pp::platform::current_platform_family();
if (family == pp::platform::PlatformFamily::webgl)
return pp::platform::legacy::active_legacy_web_platform_services().default_canvas_resolution();
if (pp::platform::legacy::handles_legacy_web_platform_family(family))
return pp::platform::legacy::default_legacy_web_canvas_resolution();
return pp::platform::platform_default_canvas_resolution(family);
}
@@ -527,12 +527,9 @@ public:
pp::platform::PreparedFileCallback callback) override
{
const auto family = pp::platform::current_platform_family();
if (family == pp::platform::PlatformFamily::webgl)
if (pp::platform::legacy::handles_legacy_web_platform_family(family))
{
pp::platform::legacy::active_legacy_web_platform_services().save_prepared_file(
path,
suggested_name,
std::move(callback));
pp::platform::legacy::save_legacy_web_prepared_file(path, suggested_name, std::move(callback));
return;
}

View File

@@ -98,6 +98,37 @@ void request_legacy_glfw_app_close()
return pp::platform::resolve_web_platform_services(services);
}
[[nodiscard]] bool handles_legacy_web_platform_family(pp::platform::PlatformFamily family) noexcept
{
return family == pp::platform::PlatformFamily::webgl;
}
void publish_legacy_web_exported_image(std::string_view path)
{
active_legacy_web_platform_services().publish_exported_image(path);
}
void flush_legacy_web_persistent_storage()
{
active_legacy_web_platform_services().flush_persistent_storage();
}
[[nodiscard]] int default_legacy_web_canvas_resolution() noexcept
{
return active_legacy_web_platform_services().default_canvas_resolution();
}
void save_legacy_web_prepared_file(
std::string_view path,
std::string_view suggested_name,
pp::platform::PreparedFileCallback callback)
{
active_legacy_web_platform_services().save_prepared_file(
path,
suggested_name,
std::move(callback));
}
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_storage_paths()
{
return retained_legacy_storage_paths().storage_paths;

View File

@@ -1,5 +1,6 @@
#pragma once
#include "platform_api/platform_policy.h"
#include "platform_api/platform_services.h"
#if __LINUX__ || __WEB__
@@ -21,6 +22,14 @@ void request_legacy_glfw_app_close();
#endif
[[nodiscard]] pp::platform::WebPlatformServices& active_legacy_web_platform_services();
[[nodiscard]] bool handles_legacy_web_platform_family(pp::platform::PlatformFamily family) noexcept;
void publish_legacy_web_exported_image(std::string_view path);
void flush_legacy_web_persistent_storage();
[[nodiscard]] int default_legacy_web_canvas_resolution() noexcept;
void save_legacy_web_prepared_file(
std::string_view path,
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);