5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 09:53:03 +08:00

[windows] Workaround webview2 bug being blank. Reduced flashing at start.

This commit is contained in:
Lea Anthony 2021-06-21 15:48:24 +10:00
parent 909da72eb2
commit 09cf223aa2

View File

@ -263,11 +263,26 @@ void completed(struct Application* app) {
delete[] app->initialCode; delete[] app->initialCode;
app->initialCode = nullptr; app->initialCode = nullptr;
// Process whether window should show by default
int startVisibility = SW_SHOWNORMAL;
if ( app->startHidden == 1 ) {
startVisibility = SW_HIDE;
}
// Fix for webview2 bug: https://github.com/MicrosoftEdge/WebView2Feedback/issues/1077 // Fix for webview2 bug: https://github.com/MicrosoftEdge/WebView2Feedback/issues/1077
// Will be fixed in next stable release // Will be fixed in next stable release
app->webviewController->put_IsVisible(false); app->webviewController->put_IsVisible(false);
app->webviewController->put_IsVisible(true); app->webviewController->put_IsVisible(true);
// Private setTitle as we're on the main thread
if( app->frame == 1) {
setTitle(app, app->title);
}
ShowWindow(app->window, startVisibility);
UpdateWindow(app->window);
SetFocus(app->window);
if( app->startupURL == nullptr ) { if( app->startupURL == nullptr ) {
messageFromWindowCallback("SS"); messageFromWindowCallback("SS");
return; return;
@ -461,28 +476,12 @@ void Run(struct Application* app, int argc, char **argv) {
SetLayeredWindowAttributes(app->window,RGB(255,255,255),0,LWA_COLORKEY); SetLayeredWindowAttributes(app->window,RGB(255,255,255),0,LWA_COLORKEY);
} }
// Private setTitle as we're on the main thread
if( app->frame == 1) {
setTitle(app, app->title);
}
// Store application pointer in window handle // Store application pointer in window handle
SetWindowLongPtr(app->window, GWLP_USERDATA, (LONG_PTR)app); SetWindowLongPtr(app->window, GWLP_USERDATA, (LONG_PTR)app);
// Process whether window should show by default
int startVisibility = SW_SHOWNORMAL;
if ( app->startHidden == 1 ) {
startVisibility = SW_HIDE;
}
// private center() as we are on main thread // private center() as we are on main thread
center(app); center(app);
ShowWindow(app->window, startVisibility);
UpdateWindow(app->window);
SetFocus(app->window);
// Add webview2 // Add webview2
initWebView2(app, debug, initialCallback); initWebView2(app, debug, initialCallback);