Extract sidebar, lifecycle shell, and canvas unmerged draw

This commit is contained in:
2026-06-16 12:23:27 +02:00
parent 3407daff08
commit acd34540e0
10 changed files with 720 additions and 530 deletions

View File

@@ -0,0 +1,96 @@
#include "pch.h"
#include "platform_windows/windows_lifecycle_shell.h"
#include "app.h"
#include "legacy_preference_storage.h"
#include "platform_windows/windows_stylus_input.h"
namespace pp::platform::windows {
namespace {
[[nodiscard]] std::atomic<int>& retained_running_state() noexcept
{
static std::atomic<int> running{-1};
return running;
}
}
std::atomic<int>& lifecycle_running_state() noexcept
{
return retained_running_state();
}
void mark_lifecycle_running() noexcept
{
retained_running_state().store(1, std::memory_order_relaxed);
}
void mark_lifecycle_stopped() noexcept
{
retained_running_state().store(0, std::memory_order_relaxed);
}
bool lifecycle_is_running() noexcept
{
return retained_running_state().load(std::memory_order_relaxed) == 1;
}
void request_window_close(HWND hWnd)
{
PostMessage(hWnd, kUserCloseMessage, 0, 0);
}
void handle_window_close_message(VrShellState& vr)
{
mark_lifecycle_stopped();
request_stop_and_join_vr_thread(vr);
App::I->runtime().ui_thread_stop();
App::I->runtime().render_thread_stop();
App::I->terminate();
delete App::I;
PostQuitMessage(0);
}
void update_stylus_frame(float dt)
{
update_stylus_state(dt);
}
void update_window_fps(HWND hWnd, const wchar_t* window_title, VrShellState& vr, int frames)
{
static wchar_t title_fps[512];
const int vr_fps = current_vr_fps(vr);
if (App::I->vr_active)
swprintf_s(title_fps, L"%s - %d fps - %d vr fps", window_title, frames, vr_fps);
else
swprintf_s(title_fps, L"%s - %d fps", window_title, frames);
SetWindowText(hWnd, title_fps);
PostMessage(hWnd, kUserWakeupMessage, 0, 0);
}
void save_window_preferences(HWND hWnd)
{
WINDOWPLACEMENT placement{};
GetWindowPlacement(hWnd, &placement);
pp::panopainter::set_legacy_window_preferences(placement.showCmd, {
placement.rcNormalPosition.left,
placement.rcNormalPosition.top,
placement.rcNormalPosition.right,
placement.rcNormalPosition.bottom });
}
bool start_window_vr(VrShellState& vr, bool sandboxed)
{
return start_vr_shell(vr, sandboxed, retained_running_state());
}
void stop_window_vr(VrShellState& vr)
{
stop_vr_shell(vr);
}
}