Retain Win32 entry state and trim canvas/platform seams
This commit is contained in:
@@ -101,26 +101,55 @@ struct RetainedLegacyGlfwWindowHooks final {
|
||||
std::function<void()> request_app_close;
|
||||
};
|
||||
|
||||
[[nodiscard]] RetainedLegacyGlfwWindowHooks& active_legacy_glfw_window_hooks()
|
||||
struct RetainedLegacyGlfwWindowState final {
|
||||
decltype(App::I->glfw_window) window = nullptr;
|
||||
RetainedLegacyGlfwWindowHooks hooks;
|
||||
};
|
||||
|
||||
[[nodiscard]] RetainedLegacyGlfwWindowState& active_legacy_glfw_window_state()
|
||||
{
|
||||
static RetainedLegacyGlfwWindowHooks hooks = [] {
|
||||
RetainedLegacyGlfwWindowHooks retained;
|
||||
GLFWwindow* const window = App::I->glfw_window;
|
||||
retained.acquire_render_context = [window] {
|
||||
static RetainedLegacyGlfwWindowState state = [] {
|
||||
RetainedLegacyGlfwWindowState retained;
|
||||
retained.window = App::I->glfw_window;
|
||||
retained.hooks.acquire_render_context = [window = retained.window] {
|
||||
glfwMakeContextCurrent(window);
|
||||
};
|
||||
retained.present_render_context = [window] {
|
||||
retained.hooks.present_render_context = [window = retained.window] {
|
||||
glfwSwapBuffers(window);
|
||||
};
|
||||
retained.request_app_close = [window] {
|
||||
retained.hooks.request_app_close = [window = retained.window] {
|
||||
glfwSetWindowShouldClose(window, GLFW_TRUE);
|
||||
};
|
||||
return retained;
|
||||
}();
|
||||
return hooks;
|
||||
return state;
|
||||
}
|
||||
|
||||
[[nodiscard]] RetainedLegacyGlfwWindowHooks& active_legacy_glfw_window_hooks()
|
||||
{
|
||||
return active_legacy_glfw_window_state().hooks;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct RetainedLegacyStoragePaths final {
|
||||
pp::platform::PlatformStoragePaths storage_paths;
|
||||
};
|
||||
|
||||
[[nodiscard]] RetainedLegacyStoragePaths& active_legacy_storage_paths()
|
||||
{
|
||||
static RetainedLegacyStoragePaths state = [] {
|
||||
RetainedLegacyStoragePaths retained;
|
||||
retained.storage_paths = {
|
||||
App::I->data_path,
|
||||
App::I->work_path,
|
||||
App::I->rec_path,
|
||||
App::I->tmp_path,
|
||||
};
|
||||
return retained;
|
||||
}();
|
||||
return state;
|
||||
}
|
||||
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
[[nodiscard]] NSMutableArray<NSString*>* apple_file_types_array(const std::vector<std::string>& file_types)
|
||||
{
|
||||
@@ -377,12 +406,7 @@ public:
|
||||
{},
|
||||
};
|
||||
#else
|
||||
return {
|
||||
App::I->data_path,
|
||||
App::I->work_path,
|
||||
App::I->rec_path,
|
||||
App::I->tmp_path,
|
||||
};
|
||||
return active_legacy_storage_paths().storage_paths;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user