Thin Windows runtime globals and legacy GLFW hooks
This commit is contained in:
@@ -47,11 +47,10 @@ void request_window_close(HWND hWnd)
|
||||
void handle_window_close_message(VrShellState& vr)
|
||||
{
|
||||
auto* app = bound_app();
|
||||
auto* runtime = bound_runtime();
|
||||
mark_lifecycle_stopped();
|
||||
request_stop_and_join_vr_thread(vr);
|
||||
runtime->ui_thread_stop();
|
||||
runtime->render_thread_stop();
|
||||
app->runtime().ui_thread_stop();
|
||||
app->runtime().render_thread_stop();
|
||||
app->terminate();
|
||||
release_bound_app();
|
||||
PostQuitMessage(0);
|
||||
|
||||
@@ -186,9 +186,9 @@ void swap_async_render_context()
|
||||
|
||||
void enqueue_main_thread_task(std::packaged_task<void()> task)
|
||||
{
|
||||
if (auto* runtime = bound_runtime())
|
||||
if (auto* app = bound_app())
|
||||
{
|
||||
runtime->main_thread_task(std::move(task));
|
||||
app->runtime().main_thread_task(std::move(task));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -200,9 +200,9 @@ void enqueue_main_thread_task(std::packaged_task<void()> task)
|
||||
|
||||
void drain_main_thread_tasks()
|
||||
{
|
||||
if (auto* runtime = bound_runtime())
|
||||
if (auto* app = bound_app())
|
||||
{
|
||||
runtime->drain_main_thread_tasks();
|
||||
app->runtime().drain_main_thread_tasks();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "platform_windows/windows_runtime_shell.h"
|
||||
|
||||
#include "app.h"
|
||||
#include "app_runtime.h"
|
||||
#include "log.h"
|
||||
#include "platform_windows/windows_bootstrap_helpers.h"
|
||||
#include "platform_windows/windows_lifecycle_shell.h"
|
||||
@@ -20,7 +19,6 @@ namespace {
|
||||
struct RetainedWindowsRuntimeState final {
|
||||
std::unique_ptr<App> owned_app;
|
||||
App* app = nullptr;
|
||||
AppRuntime* runtime = nullptr;
|
||||
WacomTablet* tablet = nullptr;
|
||||
};
|
||||
|
||||
@@ -42,10 +40,9 @@ void register_touch_window(HWND hWnd)
|
||||
void initialize_runtime_threads()
|
||||
{
|
||||
auto* app = bound_app();
|
||||
auto* runtime = bound_runtime();
|
||||
mark_lifecycle_running();
|
||||
runtime->render_thread_start(*app);
|
||||
runtime->ui_thread_start(*app);
|
||||
app->runtime().render_thread_start(*app);
|
||||
app->runtime().ui_thread_start(*app);
|
||||
}
|
||||
|
||||
void install_debug_gl_callbacks()
|
||||
@@ -136,21 +133,10 @@ App* bound_app() noexcept
|
||||
void release_bound_app() noexcept
|
||||
{
|
||||
auto& state = retained_runtime_state();
|
||||
bind_runtime(nullptr);
|
||||
bind_app(nullptr);
|
||||
state.owned_app.reset();
|
||||
}
|
||||
|
||||
void bind_runtime(AppRuntime* runtime) noexcept
|
||||
{
|
||||
retained_runtime_state().runtime = runtime;
|
||||
}
|
||||
|
||||
AppRuntime* bound_runtime() noexcept
|
||||
{
|
||||
return retained_runtime_state().runtime;
|
||||
}
|
||||
|
||||
void bind_wacom_tablet(WacomTablet* tablet) noexcept
|
||||
{
|
||||
retained_runtime_state().tablet = tablet;
|
||||
@@ -190,7 +176,6 @@ int run_main_application(int argc, char** argv)
|
||||
runtime_state.owned_app = std::make_unique<App>();
|
||||
auto* app = runtime_state.owned_app.get();
|
||||
bind_app(app);
|
||||
bind_runtime(&app->runtime());
|
||||
bind_wacom_tablet(&WacomTablet::I);
|
||||
app->set_platform_services(&pp::platform::windows::platform_services());
|
||||
app->initLog();
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "platform_windows/windows_splash.h"
|
||||
|
||||
class App;
|
||||
class AppRuntime;
|
||||
class WacomTablet;
|
||||
|
||||
namespace pp::platform::windows {
|
||||
@@ -14,8 +13,6 @@ void run_main_window_runtime(const MainWindowStartupState& startup, bool start_i
|
||||
void bind_app(App* app) noexcept;
|
||||
[[nodiscard]] App* bound_app() noexcept;
|
||||
void release_bound_app() noexcept;
|
||||
void bind_runtime(AppRuntime* runtime) noexcept;
|
||||
[[nodiscard]] AppRuntime* bound_runtime() noexcept;
|
||||
void bind_wacom_tablet(WacomTablet* tablet) noexcept;
|
||||
[[nodiscard]] WacomTablet* bound_wacom_tablet() noexcept;
|
||||
[[nodiscard]] HWND main_window_handle() noexcept;
|
||||
|
||||
Reference in New Issue
Block a user