5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 17:22:01 +08:00

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
This commit is contained in:
stffabi 2022-04-10 10:45:09 +02:00 committed by GitHub
parent 5f596c7679
commit c70d93b482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,6 +143,17 @@ func (f *Frontend) Run(ctx context.Context) error {
f.mainWindow.notifyParentWindowPositionChanged = f.chromium.NotifyParentWindowPositionChanged f.mainWindow.notifyParentWindowPositionChanged = f.chromium.NotifyParentWindowPositionChanged
mainWindow.OnSize().Bind(func(arg *winc.Event) { 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() f.chromium.Resize()
}) })