Fix bug in runtime.Show(). Tidy up debug.

This commit is contained in:
Lea Anthony 2022-10-11 21:17:55 +11:00
commit 7ef6f7d2b9
No known key found for this signature in database
GPG key ID: 33DAF7BB90A58405
5 changed files with 20 additions and 13 deletions

View file

@ -374,11 +374,11 @@ func (f *Frontend) ScreenGetAll() ([]Screen, error) {
}
func (f *Frontend) Show() {
f.mainWindow.Show()
f.WindowShow()
}
func (f *Frontend) Hide() {
f.mainWindow.Hide()
f.WindowHide()
}
func (f *Frontend) WindowIsMaximised() bool {

View file

@ -13,20 +13,21 @@ type HANDLE uintptr
type HMONITOR HANDLE
var (
moduser32 = syscall.NewLazyDLL("user32.dll")
procSystemParametersInfo = moduser32.NewProc("SystemParametersInfoW")
procGetWindowLong = moduser32.NewProc("GetWindowLongW")
procSetClassLong = moduser32.NewProc("SetClassLongW")
procSetClassLongPtr = moduser32.NewProc("SetClassLongPtrW")
procShowWindow = moduser32.NewProc("ShowWindow")
procIsWindowVisible = moduser32.NewProc("IsWindowVisible")
procGetWindowRect = moduser32.NewProc("GetWindowRect")
procGetMonitorInfo = moduser32.NewProc("GetMonitorInfoW")
procMonitorFromWindow = moduser32.NewProc("MonitorFromWindow")
moduser32 = syscall.NewLazyDLL("user32.dll")
procSystemParametersInfo = moduser32.NewProc("SystemParametersInfoW")
procGetWindowLong = moduser32.NewProc("GetWindowLongW")
procSetClassLong = moduser32.NewProc("SetClassLongW")
procSetClassLongPtr = moduser32.NewProc("SetClassLongPtrW")
procShowWindow = moduser32.NewProc("ShowWindow")
procIsWindowVisible = moduser32.NewProc("IsWindowVisible")
procGetWindowRect = moduser32.NewProc("GetWindowRect")
procGetMonitorInfo = moduser32.NewProc("GetMonitorInfoW")
procMonitorFromWindow = moduser32.NewProc("MonitorFromWindow")
procLookupIconIdFromDirectoryEx = moduser32.NewProc("LookupIconIdFromDirectoryEx")
procCreateIconFromResourceEx = moduser32.NewProc("CreateIconFromResourceEx")
procCreateIconIndirect = moduser32.NewProc("CreateIconIndirect")
procLoadImageW = moduser32.NewProc("LoadImageW")
procBringWindowToTop = moduser32.NewProc("BringWindowToTop")
)
var (

View file

@ -218,3 +218,10 @@ func GetMonitorInfo(hMonitor HMONITOR, lmpi *MONITORINFO) bool {
)
return ret != 0
}
func BringWindowToTop(hwnd uintptr) bool {
ret, _, _ := procBringWindowToTop.Call(
hwnd,
)
return ret != 0
}

View file

@ -314,7 +314,6 @@ func (p *Systray) Run() error {
rt := win32.GetMessage(&msg)
switch int(rt) {
case 0:
println("Quitting Run()")
return nil
case -1:
return errors.New("run failed")