5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 13:51:10 +08:00

Bugfix: Windows start maximised

Fixes #1462
This commit is contained in:
Lea Anthony 2022-06-18 16:21:32 +10:00
parent 9bd765d2c8
commit e4f2bfe699
3 changed files with 12 additions and 2 deletions

View File

@ -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())
})

View File

@ -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(

View File

@ -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())
}