Own Windows tablet path and thin legacy web fallback
This commit is contained in:
@@ -19,7 +19,7 @@ namespace {
|
||||
struct RetainedWindowsRuntimeState final {
|
||||
std::unique_ptr<App> owned_app;
|
||||
App* app = nullptr;
|
||||
WacomTablet* tablet = nullptr;
|
||||
WacomTablet tablet;
|
||||
};
|
||||
|
||||
[[nodiscard]] RetainedWindowsRuntimeState& retained_runtime_state()
|
||||
@@ -56,7 +56,6 @@ void install_debug_gl_callbacks()
|
||||
void initialize_wintab(HWND hWnd, bool sandboxed)
|
||||
{
|
||||
auto* tablet = bound_wacom_tablet();
|
||||
assert(tablet);
|
||||
if (!sandboxed)
|
||||
{
|
||||
LOG("init WinTab");
|
||||
@@ -111,8 +110,7 @@ void run_main_message_loop()
|
||||
|
||||
void shutdown_main_window_runtime(const MainWindowStartupState& startup, HINSTANCE hInst)
|
||||
{
|
||||
if (auto* tablet = retained_runtime_state().tablet)
|
||||
tablet->terminate();
|
||||
retained_runtime_state().tablet.terminate();
|
||||
UnregisterClass(startup.window_class.lpszClassName, hInst);
|
||||
LogRemote::I.stop();
|
||||
}
|
||||
@@ -137,14 +135,9 @@ void release_bound_app() noexcept
|
||||
state.owned_app.reset();
|
||||
}
|
||||
|
||||
void bind_wacom_tablet(WacomTablet* tablet) noexcept
|
||||
{
|
||||
retained_runtime_state().tablet = tablet;
|
||||
}
|
||||
|
||||
WacomTablet* bound_wacom_tablet() noexcept
|
||||
{
|
||||
return retained_runtime_state().tablet;
|
||||
return &retained_runtime_state().tablet;
|
||||
}
|
||||
|
||||
HWND main_window_handle() noexcept
|
||||
@@ -176,7 +169,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_wacom_tablet(&WacomTablet::I);
|
||||
app->set_platform_services(&pp::platform::windows::platform_services());
|
||||
app->initLog();
|
||||
|
||||
@@ -206,11 +198,9 @@ int run_main_application(int argc, char** argv)
|
||||
break;
|
||||
case pp::platform::windows::MainStartupResult::GladLoadFailure:
|
||||
release_bound_app();
|
||||
bind_wacom_tablet(nullptr);
|
||||
return 0;
|
||||
case pp::platform::windows::MainStartupResult::MissingCoreContextSupport:
|
||||
release_bound_app();
|
||||
bind_wacom_tablet(nullptr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -225,7 +215,6 @@ int run_main_application(int argc, char** argv)
|
||||
app->initShaders();
|
||||
app->cmd_convert(argv[2], argv[3]);
|
||||
release_bound_app();
|
||||
bind_wacom_tablet(nullptr);
|
||||
return 0;
|
||||
case const_hash("-vrmode"):
|
||||
start_in_vr = true;
|
||||
@@ -237,7 +226,6 @@ int run_main_application(int argc, char** argv)
|
||||
|
||||
pp::platform::windows::run_main_window_runtime(startup, start_in_vr, splash);
|
||||
release_bound_app();
|
||||
bind_wacom_tablet(nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +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_wacom_tablet(WacomTablet* tablet) noexcept;
|
||||
[[nodiscard]] WacomTablet* bound_wacom_tablet() noexcept;
|
||||
[[nodiscard]] HWND main_window_handle() noexcept;
|
||||
[[nodiscard]] const wchar_t* main_window_title() noexcept;
|
||||
|
||||
Reference in New Issue
Block a user