Fix VS 2026 Windows build
This commit is contained in:
@@ -584,6 +584,7 @@ if(PP_BUILD_APP)
|
||||
target_link_libraries(pp_panopainter_ui
|
||||
PUBLIC
|
||||
pp_legacy_app
|
||||
pp_ui_core
|
||||
pp_project_options
|
||||
PRIVATE
|
||||
pp_assets
|
||||
|
||||
@@ -658,7 +658,7 @@ void App::render_thread_tick()
|
||||
|
||||
void App::render_thread_main()
|
||||
{
|
||||
runtime_.render_thread_main(*this);
|
||||
runtime_.render_thread_main(*this, {});
|
||||
}
|
||||
|
||||
void App::ui_thread_tick()
|
||||
@@ -668,7 +668,7 @@ void App::ui_thread_tick()
|
||||
|
||||
void App::ui_thread_main()
|
||||
{
|
||||
runtime_.ui_thread_main(*this);
|
||||
runtime_.ui_thread_main(*this, {});
|
||||
}
|
||||
|
||||
void App::render_thread_start()
|
||||
|
||||
@@ -877,8 +877,7 @@ static void execute_canvas_draw_merge_plane_dispatch(
|
||||
brush,
|
||||
ortho,
|
||||
use_blend,
|
||||
copy_blend_destination,
|
||||
draw_checkerboard);
|
||||
copy_blend_destination);
|
||||
}
|
||||
|
||||
execute_canvas_draw_merge_plane_final_composite(canvas, ortho, draw_checkerboard, use_blend);
|
||||
|
||||
@@ -231,7 +231,7 @@ private:
|
||||
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 {
|
||||
public:
|
||||
@@ -242,14 +242,14 @@ public:
|
||||
|
||||
void save_document_version(const pp::app::DocumentVersionTarget& target) override
|
||||
{
|
||||
save_document_version(app_, target);
|
||||
save_legacy_document_version(app_, target);
|
||||
}
|
||||
|
||||
private:
|
||||
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(
|
||||
pp::app::plan_document_version_save_history(target));
|
||||
|
||||
@@ -30,7 +30,7 @@ void encode_recording_frame(
|
||||
const pp::app::RecordingWorkerIterationPlan& plan,
|
||||
Canvas* legacy_canvas,
|
||||
Canvas* canvas_document,
|
||||
CanvasEncoder* encoder)
|
||||
MP4Encoder* encoder)
|
||||
{
|
||||
if (plan.clear_dirty_stroke)
|
||||
canvas_document->m_dirty_stroke = false;
|
||||
|
||||
19
src/main.cpp
19
src/main.cpp
@@ -92,6 +92,13 @@ void enqueue_main_task(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()
|
||||
{
|
||||
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> running{-1};
|
||||
std::atomic_bool vr_running{false};
|
||||
@@ -1096,7 +1113,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
case WM_ACTIVATE:
|
||||
{
|
||||
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);
|
||||
WacomTablet::I.set_focus(active);
|
||||
static BYTE keys[256];
|
||||
|
||||
@@ -726,7 +726,7 @@ void NodeCanvas::draw()
|
||||
proj,
|
||||
camera,
|
||||
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(0);
|
||||
@@ -750,7 +750,7 @@ void NodeCanvas::draw()
|
||||
ortho_proj,
|
||||
proj,
|
||||
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(
|
||||
m_canvas->m_mode,
|
||||
ortho_proj,
|
||||
|
||||
@@ -68,7 +68,9 @@ void NodeDialogCloud::init_controls()
|
||||
btn_cancel = find<NodeButton>("btn-cancel");
|
||||
pp::panopainter::bind_legacy_click_destroys_node(*btn_cancel, *this);
|
||||
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()
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
#include <deque>
|
||||
#include <map>
|
||||
|
||||
extern HWND hWnd;
|
||||
extern std::deque<std::packaged_task<void()>> main_tasklist;
|
||||
extern std::mutex main_task_mutex;
|
||||
|
||||
void destroy_window();
|
||||
void async_lock();
|
||||
void async_unlock();
|
||||
@@ -27,6 +23,8 @@ void win32_save_window_state();
|
||||
bool win32_vr_start();
|
||||
void win32_vr_stop();
|
||||
std::string GetLastErrorAsString();
|
||||
HWND pp_windows_main_window_handle();
|
||||
void pp_windows_enqueue_main_task(std::packaged_task<void()> task);
|
||||
|
||||
namespace pp::platform::windows {
|
||||
|
||||
@@ -166,19 +164,18 @@ void handle_gl_callback(
|
||||
|
||||
void show_cursor(bool visible)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(main_task_mutex);
|
||||
main_tasklist.emplace_back([=] {
|
||||
pp_windows_enqueue_main_task(std::packaged_task<void()>([=] {
|
||||
if (visible)
|
||||
while (ShowCursor(true) < 0);
|
||||
else
|
||||
while (ShowCursor(false) >= 0);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
std::string clipboard_text()
|
||||
{
|
||||
std::string ret;
|
||||
if (OpenClipboard(hWnd))
|
||||
if (OpenClipboard(pp_windows_main_window_handle()))
|
||||
{
|
||||
if (HANDLE h = GetClipboardData(CF_TEXT))
|
||||
{
|
||||
@@ -196,7 +193,7 @@ std::string clipboard_text()
|
||||
bool set_clipboard_text(const std::string& s)
|
||||
{
|
||||
bool success = false;
|
||||
if (OpenClipboard(hWnd))
|
||||
if (OpenClipboard(pp_windows_main_window_handle()))
|
||||
{
|
||||
// owned by SetClipboardData
|
||||
if (HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, s.size() + 1))
|
||||
@@ -222,7 +219,7 @@ std::string open_file(const char* filter)
|
||||
char fileName[MAX_PATH] = "";
|
||||
ZeroMemory(&ofn, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = hWnd;
|
||||
ofn.hwndOwner = pp_windows_main_window_handle();
|
||||
ofn.lpstrFilter = filter;
|
||||
ofn.lpstrFile = fileName;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
@@ -240,7 +237,7 @@ std::string save_file(const char* filter)
|
||||
char fileName[MAX_PATH] = "";
|
||||
ZeroMemory(&ofn, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = hWnd;
|
||||
ofn.hwndOwner = pp_windows_main_window_handle();
|
||||
ofn.lpstrFilter = filter;
|
||||
ofn.lpstrFile = fileName;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
@@ -258,7 +255,7 @@ std::string open_directory()
|
||||
char Buffer[MAX_PATH];
|
||||
ZeroMemory(Buffer, MAX_PATH);
|
||||
ZeroMemory(&bi, sizeof(bi));
|
||||
bi.hwndOwner = hWnd;
|
||||
bi.hwndOwner = pp_windows_main_window_handle();
|
||||
bi.pszDisplayName = Buffer;
|
||||
bi.lpszTitle = "Title";
|
||||
bi.ulFlags = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS | BIF_SHAREABLE;
|
||||
|
||||
Reference in New Issue
Block a user