Thin Windows shell access and bundle quiet validation
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include "platform_windows/windows_bootstrap_helpers.h"
|
||||
#include "platform_windows/windows_runtime_shell.h"
|
||||
#include "platform_windows/windows_window_shell.h"
|
||||
|
||||
#include "app.h"
|
||||
#include "canvas.h"
|
||||
#include "legacy_gl_runtime_dispatch.h"
|
||||
#include "legacy_preference_storage.h"
|
||||
#include "log.h"
|
||||
@@ -162,7 +162,8 @@ void setup_exception_handler(const App& app)
|
||||
|
||||
BT_SetPreErrHandler([](INT_PTR nErrHandlerParam){
|
||||
const auto* app = reinterpret_cast<const App*>(nErrHandlerParam);
|
||||
if (Canvas::I && Canvas::I->m_unsaved)
|
||||
auto* canvas_document = app && app->canvas ? app->canvas->m_canvas.get() : nullptr;
|
||||
if (canvas_document && canvas_document->m_unsaved)
|
||||
{
|
||||
auto t = std::time(nullptr);
|
||||
auto tm = *std::localtime(&t);
|
||||
@@ -170,12 +171,12 @@ void setup_exception_handler(const App& app)
|
||||
oss << std::put_time(&tm, "%d-%m-%Y %H-%M-%S");
|
||||
|
||||
auto path = app->data_path + "/" + app->doc_name + "-recovery (" + oss.str() + ").ppi";
|
||||
Canvas::I->project_save_thread(path, false);
|
||||
canvas_document->project_save_thread(path, false);
|
||||
static char abspath[MAX_PATH];
|
||||
GetFullPathNameA(path.c_str(), MAX_PATH, abspath, NULL);
|
||||
static char message[4096];
|
||||
snprintf(message, sizeof(message), "File recovered in: %s", abspath);
|
||||
MessageBoxA(retained_state().hWnd, message, "File Recovery", MB_OK | MB_ICONWARNING);
|
||||
MessageBoxA(main_window_handle(), message, "File Recovery", MB_OK | MB_ICONWARNING);
|
||||
}
|
||||
LogRemote::I.file_close();
|
||||
}, reinterpret_cast<INT_PTR>(&app));
|
||||
@@ -337,7 +338,7 @@ int read_WMI_info()
|
||||
if (get_int(clsObj, L"CodeIntegrityPolicyEnforcementStatus") > 0)
|
||||
{
|
||||
LOG("SANDBOX DETECTED");
|
||||
retained_state().sandboxed = true;
|
||||
set_main_window_sandboxed(true);
|
||||
}
|
||||
|
||||
SAFEARRAY *psaNames = NULL;
|
||||
|
||||
@@ -23,7 +23,7 @@ void lock_async_render_context();
|
||||
bool try_lock_async_render_context();
|
||||
void unlock_async_render_context();
|
||||
void swap_async_render_context();
|
||||
RetainedState& retained_state();
|
||||
[[nodiscard]] VrShellState& platform_vr_state() noexcept;
|
||||
}
|
||||
|
||||
void destroy_window();
|
||||
@@ -39,12 +39,12 @@ HWND pp_windows_main_window_handle();
|
||||
|
||||
HWND pp_windows_main_window_handle()
|
||||
{
|
||||
return pp::platform::windows::retained_state().hWnd;
|
||||
return pp::platform::windows::main_window_handle();
|
||||
}
|
||||
|
||||
void destroy_window()
|
||||
{
|
||||
pp::platform::windows::enqueue_main_thread_task(std::packaged_task<void()>([hWnd = pp::platform::windows::retained_state().hWnd] {
|
||||
pp::platform::windows::enqueue_main_thread_task(std::packaged_task<void()>([hWnd = pp::platform::windows::main_window_handle()] {
|
||||
pp::platform::windows::request_window_close(hWnd);
|
||||
}));
|
||||
}
|
||||
@@ -76,26 +76,39 @@ void win32_update_stylus(float dt)
|
||||
|
||||
void win32_update_fps(int frames)
|
||||
{
|
||||
auto& state = pp::platform::windows::retained_state();
|
||||
pp::platform::windows::enqueue_main_thread_task(std::packaged_task<void()>([hWnd = state.hWnd, window_title = state.window_title, &vr = state.vr, frames] {
|
||||
pp::platform::windows::update_window_fps(hWnd, window_title, vr, frames);
|
||||
pp::platform::windows::enqueue_main_thread_task(std::packaged_task<void()>([
|
||||
hWnd = pp::platform::windows::main_window_handle(),
|
||||
window_title = pp::platform::windows::main_window_title(),
|
||||
vr = &pp::platform::windows::platform_vr_state(),
|
||||
frames] {
|
||||
pp::platform::windows::update_window_fps(hWnd, window_title, *vr, frames);
|
||||
}));
|
||||
}
|
||||
|
||||
bool win32_vr_start()
|
||||
{
|
||||
auto& state = pp::platform::windows::retained_state();
|
||||
return pp::platform::windows::start_window_vr(state.vr, state.sandboxed);
|
||||
return pp::platform::windows::start_window_vr(
|
||||
pp::platform::windows::platform_vr_state(),
|
||||
pp::platform::windows::main_window_sandboxed());
|
||||
}
|
||||
|
||||
void win32_vr_stop()
|
||||
{
|
||||
pp::platform::windows::stop_window_vr(pp::platform::windows::retained_state().vr);
|
||||
pp::platform::windows::stop_window_vr(pp::platform::windows::platform_vr_state());
|
||||
}
|
||||
|
||||
void win32_save_window_state()
|
||||
{
|
||||
pp::platform::windows::save_window_preferences(pp::platform::windows::retained_state().hWnd);
|
||||
pp::platform::windows::save_window_preferences(pp::platform::windows::main_window_handle());
|
||||
}
|
||||
|
||||
namespace pp::platform::windows {
|
||||
|
||||
VrShellState& platform_vr_state() noexcept
|
||||
{
|
||||
return retained_state().vr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace pp::platform::windows {
|
||||
@@ -781,7 +794,7 @@ PlatformServices& platform_services()
|
||||
|
||||
VrSessionSnapshot read_platform_vr_session_snapshot() noexcept
|
||||
{
|
||||
return read_vr_session_snapshot(retained_state().vr);
|
||||
return read_vr_session_snapshot(platform_vr_state());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -152,6 +152,26 @@ WacomTablet* bound_wacom_tablet() noexcept
|
||||
return retained_runtime_state().tablet;
|
||||
}
|
||||
|
||||
HWND main_window_handle() noexcept
|
||||
{
|
||||
return retained_state().hWnd;
|
||||
}
|
||||
|
||||
const wchar_t* main_window_title() noexcept
|
||||
{
|
||||
return retained_state().window_title;
|
||||
}
|
||||
|
||||
bool main_window_sandboxed() noexcept
|
||||
{
|
||||
return retained_state().sandboxed;
|
||||
}
|
||||
|
||||
void set_main_window_sandboxed(bool sandboxed) noexcept
|
||||
{
|
||||
retained_state().sandboxed = sandboxed;
|
||||
}
|
||||
|
||||
int run_main_application(int argc, char** argv)
|
||||
{
|
||||
auto& state = retained_state();
|
||||
|
||||
@@ -17,5 +17,9 @@ 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;
|
||||
[[nodiscard]] const wchar_t* main_window_title() noexcept;
|
||||
[[nodiscard]] bool main_window_sandboxed() noexcept;
|
||||
void set_main_window_sandboxed(bool sandboxed) noexcept;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user