Fix VS 2026 Windows build

This commit is contained in:
2026-06-16 09:34:17 +02:00
parent ad76aeb751
commit 52d633c6e1
9 changed files with 40 additions and 24 deletions

View File

@@ -584,6 +584,7 @@ if(PP_BUILD_APP)
target_link_libraries(pp_panopainter_ui target_link_libraries(pp_panopainter_ui
PUBLIC PUBLIC
pp_legacy_app pp_legacy_app
pp_ui_core
pp_project_options pp_project_options
PRIVATE PRIVATE
pp_assets pp_assets

View File

@@ -658,7 +658,7 @@ void App::render_thread_tick()
void App::render_thread_main() void App::render_thread_main()
{ {
runtime_.render_thread_main(*this); runtime_.render_thread_main(*this, {});
} }
void App::ui_thread_tick() void App::ui_thread_tick()
@@ -668,7 +668,7 @@ void App::ui_thread_tick()
void App::ui_thread_main() void App::ui_thread_main()
{ {
runtime_.ui_thread_main(*this); runtime_.ui_thread_main(*this, {});
} }
void App::render_thread_start() void App::render_thread_start()

View File

@@ -877,8 +877,7 @@ static void execute_canvas_draw_merge_plane_dispatch(
brush, brush,
ortho, ortho,
use_blend, use_blend,
copy_blend_destination, copy_blend_destination);
draw_checkerboard);
} }
execute_canvas_draw_merge_plane_final_composite(canvas, ortho, draw_checkerboard, use_blend); execute_canvas_draw_merge_plane_final_composite(canvas, ortho, draw_checkerboard, use_blend);

View File

@@ -231,7 +231,7 @@ private:
std::shared_ptr<NodeDialogSave> dialog_; std::shared_ptr<NodeDialogSave> dialog_;
}; };
void save_document_version(App& app, const pp::app::DocumentVersionTarget& target); void save_legacy_document_version(App& app, const pp::app::DocumentVersionTarget& target);
class LegacyDocumentVersionSaveServices final : public pp::app::DocumentVersionSaveServices { class LegacyDocumentVersionSaveServices final : public pp::app::DocumentVersionSaveServices {
public: public:
@@ -242,14 +242,14 @@ public:
void save_document_version(const pp::app::DocumentVersionTarget& target) override void save_document_version(const pp::app::DocumentVersionTarget& target) override
{ {
save_document_version(app_, target); save_legacy_document_version(app_, target);
} }
private: private:
App& app_; App& app_;
}; };
void save_document_version(App& app, const pp::app::DocumentVersionTarget& target) void save_legacy_document_version(App& app, const pp::app::DocumentVersionTarget& target)
{ {
const auto history_status = pp::panopainter::execute_legacy_history_plan( const auto history_status = pp::panopainter::execute_legacy_history_plan(
pp::app::plan_document_version_save_history(target)); pp::app::plan_document_version_save_history(target));

View File

@@ -30,7 +30,7 @@ void encode_recording_frame(
const pp::app::RecordingWorkerIterationPlan& plan, const pp::app::RecordingWorkerIterationPlan& plan,
Canvas* legacy_canvas, Canvas* legacy_canvas,
Canvas* canvas_document, Canvas* canvas_document,
CanvasEncoder* encoder) MP4Encoder* encoder)
{ {
if (plan.clear_dirty_stroke) if (plan.clear_dirty_stroke)
canvas_document->m_dirty_stroke = false; canvas_document->m_dirty_stroke = false;

View File

@@ -92,6 +92,13 @@ void enqueue_main_task(Callable&& task)
queue.tasklist.emplace_back(std::forward<Callable>(task)); queue.tasklist.emplace_back(std::forward<Callable>(task));
} }
void enqueue_main_task_bridge(std::packaged_task<void()> task)
{
auto& queue = retained_main_task_queue();
std::lock_guard<std::mutex> lock(queue.task_mutex);
queue.tasklist.emplace_back(std::move(task));
}
void drain_main_tasks() void drain_main_tasks()
{ {
std::deque<std::packaged_task<void()>> working_list; std::deque<std::packaged_task<void()>> working_list;
@@ -110,6 +117,16 @@ void drain_main_tasks()
} }
HWND pp_windows_main_window_handle()
{
return retained_state().hWnd;
}
void pp_windows_enqueue_main_task(std::packaged_task<void()> task)
{
enqueue_main_task_bridge(std::move(task));
}
std::atomic<int> vr_frames{0}; std::atomic<int> vr_frames{0};
std::atomic<int> running{-1}; std::atomic<int> running{-1};
std::atomic_bool vr_running{false}; std::atomic_bool vr_running{false};
@@ -1096,7 +1113,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
case WM_ACTIVATE: case WM_ACTIVATE:
{ {
pp::platform::windows::platform_services().set_cursor_visible(true); pp::platform::windows::platform_services().set_cursor_visible(true);
App::I->ui_task_async([=] { App::I->ui_task_async([&state, wp, lp] {
int active = GET_WM_ACTIVATE_STATE(wp, lp); int active = GET_WM_ACTIVATE_STATE(wp, lp);
WacomTablet::I.set_focus(active); WacomTablet::I.set_focus(active);
static BYTE keys[256]; static BYTE keys[256];

View File

@@ -726,7 +726,7 @@ void NodeCanvas::draw()
proj, proj,
camera, camera,
m_canvas->m_layers.size() + 500.f, m_canvas->m_layers.size() + 500.f,
m_canvas->m_plane_transform, std::to_array(m_canvas->m_plane_transform),
{ {
.set_active_texture_unit = [&] { .set_active_texture_unit = [&] {
set_active_texture_unit(0); set_active_texture_unit(0);
@@ -750,7 +750,7 @@ void NodeCanvas::draw()
ortho_proj, ortho_proj,
proj, proj,
camera), camera),
.draw_heightmap = pp::panopainter::make_legacy_canvas_draw_merge_heightmap_draw(App::I->grid, proj, camera), .draw_heightmap = pp::panopainter::make_legacy_canvas_draw_merge_heightmap_draw(App::I->grid.get(), proj, camera),
.draw_current_modes = pp::panopainter::make_legacy_canvas_draw_merge_current_modes_draw( .draw_current_modes = pp::panopainter::make_legacy_canvas_draw_merge_current_modes_draw(
m_canvas->m_mode, m_canvas->m_mode,
ortho_proj, ortho_proj,

View File

@@ -68,7 +68,9 @@ void NodeDialogCloud::init_controls()
btn_cancel = find<NodeButton>("btn-cancel"); btn_cancel = find<NodeButton>("btn-cancel");
pp::panopainter::bind_legacy_click_destroys_node(*btn_cancel, *this); pp::panopainter::bind_legacy_click_destroys_node(*btn_cancel, *this);
container = find<Node>("files-list"); container = find<Node>("files-list");
load_thumbs_worker_ = std::jthread(&NodeDialogCloud::load_thumbs_thread, this); load_thumbs_worker_ = std::jthread([this](std::stop_token stop) {
load_thumbs_thread(stop);
});
} }
void NodeDialogCloud::loaded() void NodeDialogCloud::loaded()

View File

@@ -11,10 +11,6 @@
#include <deque> #include <deque>
#include <map> #include <map>
extern HWND hWnd;
extern std::deque<std::packaged_task<void()>> main_tasklist;
extern std::mutex main_task_mutex;
void destroy_window(); void destroy_window();
void async_lock(); void async_lock();
void async_unlock(); void async_unlock();
@@ -27,6 +23,8 @@ void win32_save_window_state();
bool win32_vr_start(); bool win32_vr_start();
void win32_vr_stop(); void win32_vr_stop();
std::string GetLastErrorAsString(); std::string GetLastErrorAsString();
HWND pp_windows_main_window_handle();
void pp_windows_enqueue_main_task(std::packaged_task<void()> task);
namespace pp::platform::windows { namespace pp::platform::windows {
@@ -166,19 +164,18 @@ void handle_gl_callback(
void show_cursor(bool visible) void show_cursor(bool visible)
{ {
std::lock_guard<std::mutex> lock(main_task_mutex); pp_windows_enqueue_main_task(std::packaged_task<void()>([=] {
main_tasklist.emplace_back([=] {
if (visible) if (visible)
while (ShowCursor(true) < 0); while (ShowCursor(true) < 0);
else else
while (ShowCursor(false) >= 0); while (ShowCursor(false) >= 0);
}); }));
} }
std::string clipboard_text() std::string clipboard_text()
{ {
std::string ret; std::string ret;
if (OpenClipboard(hWnd)) if (OpenClipboard(pp_windows_main_window_handle()))
{ {
if (HANDLE h = GetClipboardData(CF_TEXT)) if (HANDLE h = GetClipboardData(CF_TEXT))
{ {
@@ -196,7 +193,7 @@ std::string clipboard_text()
bool set_clipboard_text(const std::string& s) bool set_clipboard_text(const std::string& s)
{ {
bool success = false; bool success = false;
if (OpenClipboard(hWnd)) if (OpenClipboard(pp_windows_main_window_handle()))
{ {
// owned by SetClipboardData // owned by SetClipboardData
if (HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, s.size() + 1)) if (HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, s.size() + 1))
@@ -222,7 +219,7 @@ std::string open_file(const char* filter)
char fileName[MAX_PATH] = ""; char fileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn)); ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME); ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWnd; ofn.hwndOwner = pp_windows_main_window_handle();
ofn.lpstrFilter = filter; ofn.lpstrFilter = filter;
ofn.lpstrFile = fileName; ofn.lpstrFile = fileName;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
@@ -240,7 +237,7 @@ std::string save_file(const char* filter)
char fileName[MAX_PATH] = ""; char fileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn)); ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME); ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWnd; ofn.hwndOwner = pp_windows_main_window_handle();
ofn.lpstrFilter = filter; ofn.lpstrFilter = filter;
ofn.lpstrFile = fileName; ofn.lpstrFile = fileName;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
@@ -258,7 +255,7 @@ std::string open_directory()
char Buffer[MAX_PATH]; char Buffer[MAX_PATH];
ZeroMemory(Buffer, MAX_PATH); ZeroMemory(Buffer, MAX_PATH);
ZeroMemory(&bi, sizeof(bi)); ZeroMemory(&bi, sizeof(bi));
bi.hwndOwner = hWnd; bi.hwndOwner = pp_windows_main_window_handle();
bi.pszDisplayName = Buffer; bi.pszDisplayName = Buffer;
bi.lpszTitle = "Title"; bi.lpszTitle = "Title";
bi.ulFlags = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS | BIF_SHAREABLE; bi.ulFlags = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS | BIF_SHAREABLE;