diff --git a/deps/+wxWidgets/webview.patch b/deps/+wxWidgets/webview.patch new file mode 100644 index 0000000000..1c241c57b6 --- /dev/null +++ b/deps/+wxWidgets/webview.patch @@ -0,0 +1,15 @@ +diff -ur build.orig/cmake/lib/webview/CMakeLists.txt build/cmake/lib/webview/CMakeLists.txt +--- wxWidgets.orig/build/cmake/lib/webview/CMakeLists.txt 2024-06-14 19:02:36.000000000 +0200 ++++ wxWidgets/build/cmake/lib/webview/CMakeLists.txt 2024-07-01 16:21:52.922737200 +0200 +@@ -46,9 +46,9 @@ + elseif(WXMSW) + if(wxUSE_WEBVIEW_EDGE) + # Update the following variables if updating WebView2 SDK +- set(WEBVIEW2_VERSION "1.0.705.50") ++ set(WEBVIEW2_VERSION "1.0.2592.51") + set(WEBVIEW2_URL "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/${WEBVIEW2_VERSION}") +- set(WEBVIEW2_SHA256 "6a34bb553e18cfac7297b4031f3eac2558e439f8d16a45945c22945ac404105d") ++ set(WEBVIEW2_SHA256 "805c79e05184fab18c9fe7b8ba820c598399b97adc1fbf5b0ea490efad91d5b8") + + set(WEBVIEW2_DEFAULT_PACKAGE_DIR "${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2.${WEBVIEW2_VERSION}") + diff --git a/deps/+wxWidgets/wxWidgets.cmake b/deps/+wxWidgets/wxWidgets.cmake index 77c12ee72f..e09f3d9874 100644 --- a/deps/+wxWidgets/wxWidgets.cmake +++ b/deps/+wxWidgets/wxWidgets.cmake @@ -30,6 +30,7 @@ endif () add_cmake_project(wxWidgets URL https://github.com/prusa3d/wxWidgets/archive/323a465e577e03f330e2e6a4c78e564d125340cb.zip URL_HASH SHA256=B538E4AD3CC93117932F4DED70C476D6650F9C70A9D4055A08F3693864C47465 + PATCH_COMMAND COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/webview.patch CMAKE_ARGS "-DCMAKE_DEBUG_POSTFIX:STRING=" -DwxBUILD_PRECOMP=ON diff --git a/src/slic3r/GUI/WebViewPlatformUtilsWin32.cpp b/src/slic3r/GUI/WebViewPlatformUtilsWin32.cpp index 33da42d82f..dd6348be16 100644 --- a/src/slic3r/GUI/WebViewPlatformUtilsWin32.cpp +++ b/src/slic3r/GUI/WebViewPlatformUtilsWin32.cpp @@ -4,6 +4,7 @@ #include "WebView2.h" #include #include +#include #include "wx/msw/private/comptr.h" @@ -15,59 +16,39 @@ namespace Slic3r::GUI { void setup_webview_with_credentials(wxWebView* webview, const std::string& username, const std::string& password) { - ICoreWebView2 *webView2 = (ICoreWebView2 *) webview->GetNativeBackend(); + ICoreWebView2 *webView2 = static_cast(webview->GetNativeBackend()); - - wxCOMPtr webview2Com; - wxCOMPtr environment; - if(FAILED(webView2->QueryInterface(IID_PPV_ARGS(&webview2Com)))) - { - return; - } - if (FAILED(webview2Com->get_Environment(&environment))) { - return; - } - LPWSTR wideString; - if (SUCCEEDED(environment->get_BrowserVersionString(&wideString))) { - std::wcout << L"WebView2 runtime version: " << wideString << std::endl; - } - - wxCOMPtr wv2_10; - //if (!SUCCEEDED(webView2->QueryInterface(IID_PPV_ARGS(&wv2_10)))) { - //wv2_10 = wil::com_ptr(m_appWindow->GetWebView()).query(); - // auto webView10 = webView2->query() HRESULT hr = webView2->QueryInterface(IID_PPV_ARGS(&wv2_10)); if (FAILED(hr)) { return; } + // should it be stored? EventRegistrationToken basicAuthenticationRequestedToken = {}; - if (!SUCCEEDED(wv2_10->add_BasicAuthenticationRequested( + if (FAILED(wv2_10->add_BasicAuthenticationRequested( Microsoft::WRL::Callback( [username, password](ICoreWebView2 *sender, ICoreWebView2BasicAuthenticationRequestedEventArgs *args) { wxCOMPtr basicAuthenticationResponse; - if (!SUCCEEDED(args->get_Response(&basicAuthenticationResponse))) { + if (FAILED(args->get_Response(&basicAuthenticationResponse))) { return -1; } - if (!SUCCEEDED(basicAuthenticationResponse->put_UserName(GUI::from_u8(username).c_str()))) { + if (FAILED(basicAuthenticationResponse->put_UserName(GUI::from_u8(username).c_str()))) { return -1; } - if (!SUCCEEDED(basicAuthenticationResponse->put_Password(GUI::from_u8(password).c_str()))) { + if (FAILED(basicAuthenticationResponse->put_Password(GUI::from_u8(password).c_str()))) { return -1; } return 0; } ).Get(), &basicAuthenticationRequestedToken - ))) - { + ))) { + BOOST_LOG_TRIVIAL(error) << "WebView: Cannot register authentication request handler"; } - wv2_10->Release(); - } #endif