Move Win32 bindings into runtime state
This commit is contained in:
@@ -11,6 +11,7 @@ namespace {
|
||||
|
||||
struct RetainedWindowsRuntimeState final {
|
||||
std::unique_ptr<App> owned_app;
|
||||
App* app = nullptr;
|
||||
AppRuntime* runtime = nullptr;
|
||||
WacomTablet tablet;
|
||||
};
|
||||
@@ -23,6 +24,30 @@ struct RetainedWindowsRuntimeState final {
|
||||
|
||||
}
|
||||
|
||||
void bind_app(App* app) noexcept
|
||||
{
|
||||
auto& state = retained_runtime_state();
|
||||
state.app = app;
|
||||
App::I = app;
|
||||
}
|
||||
|
||||
App* bound_app() noexcept
|
||||
{
|
||||
return retained_runtime_state().app;
|
||||
}
|
||||
|
||||
void release_bound_app() noexcept
|
||||
{
|
||||
bind_app(nullptr);
|
||||
bind_runtime(nullptr);
|
||||
retained_owned_app().reset();
|
||||
}
|
||||
|
||||
WacomTablet* bound_wacom_tablet() noexcept
|
||||
{
|
||||
return &retained_wacom_tablet();
|
||||
}
|
||||
|
||||
std::unique_ptr<App>& retained_owned_app() noexcept
|
||||
{
|
||||
return retained_runtime_state().owned_app;
|
||||
|
||||
Reference in New Issue
Block a user