From c70d93b482be1d1f40c110c16d7ea0db218c4250 Mon Sep 17 00:00:00 2001 From: stffabi Date: Sun, 10 Apr 2022 10:45:09 +0200 Subject: [PATCH] Suppress resizing during minimize of a frameless window (#1322) If the window is frameless and we are minimizing, then we need to suppress the Resize on the WebView2. If we don't do this, restoring does not work as expected and first restores with some wrong size during the restore animation and only fully renders when the animation is done. This highly depends on the content in the WebView. Possible fix for #1319 --- v2/internal/frontend/desktop/windows/frontend.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/v2/internal/frontend/desktop/windows/frontend.go b/v2/internal/frontend/desktop/windows/frontend.go index 680239fa3..3eb6ad97f 100644 --- a/v2/internal/frontend/desktop/windows/frontend.go +++ b/v2/internal/frontend/desktop/windows/frontend.go @@ -143,6 +143,17 @@ func (f *Frontend) Run(ctx context.Context) error { f.mainWindow.notifyParentWindowPositionChanged = f.chromium.NotifyParentWindowPositionChanged mainWindow.OnSize().Bind(func(arg *winc.Event) { + if f.frontendOptions.Frameless { + // If the window is frameless and we are minimizing, then we need to suppress the Resize on the + // WebView2. If we don't do this, restoring does not work as expected and first restores with some wrong + // size during the restore animation and only fully renders when the animation is done. This highly + // depends on the content in the WebView, see https://github.com/wailsapp/wails/issues/1319 + event, _ := arg.Data.(*winc.SizeEventData) + if event != nil && event.Type == w32.SIZE_MINIMIZED { + return + } + } + f.chromium.Resize() })