diff --git a/v2/internal/frontend/desktop/windows/frontend.go b/v2/internal/frontend/desktop/windows/frontend.go index 1a3c0ced6..6dc2f9a60 100644 --- a/v2/internal/frontend/desktop/windows/frontend.go +++ b/v2/internal/frontend/desktop/windows/frontend.go @@ -611,7 +611,9 @@ func (f *Frontend) navigationCompleted(sender *edge.ICoreWebView2, args *edge.IC func (f *Frontend) ShowWindow() { f.mainWindow.Invoke(func() { - f.mainWindow.Restore() + if f.mainWindow.IsMinimised() { + f.mainWindow.Restore() + } w32.SetForegroundWindow(f.mainWindow.Handle()) w32.SetFocus(f.mainWindow.Handle()) }) diff --git a/v2/internal/frontend/desktop/windows/win32/window.go b/v2/internal/frontend/desktop/windows/win32/window.go index 48263aaf2..ebcd3e389 100644 --- a/v2/internal/frontend/desktop/windows/win32/window.go +++ b/v2/internal/frontend/desktop/windows/win32/window.go @@ -11,6 +11,7 @@ import ( const ( WS_MAXIMIZE = 0x01000000 + WS_MINIMIZE = 0x20000000 GWL_STYLE = -16 ) @@ -36,6 +37,10 @@ func IsWindowMaximised(hwnd uintptr) bool { style := uint32(getWindowLong(hwnd, GWL_STYLE)) return style&WS_MAXIMIZE != 0 } +func IsWindowMinimised(hwnd uintptr) bool { + style := uint32(getWindowLong(hwnd, GWL_STYLE)) + return style&WS_MINIMIZE != 0 +} func dwmExtendFrameIntoClientArea(hwnd uintptr, margins *MARGINS) error { ret, _, _ := procDwmExtendFrameIntoClientArea.Call( diff --git a/v2/internal/frontend/desktop/windows/window.go b/v2/internal/frontend/desktop/windows/window.go index 36dc5bf25..3b9688567 100644 --- a/v2/internal/frontend/desktop/windows/window.go +++ b/v2/internal/frontend/desktop/windows/window.go @@ -230,5 +230,8 @@ func (w *Window) WndProc(msg uint32, wparam, lparam uintptr) uintptr { func (w *Window) IsMaximised() bool { return win32.IsWindowMaximised(w.Handle()) - +} + +func (w *Window) IsMinimised() bool { + return win32.IsWindowMinimised(w.Handle()) }