mirror of
https://gitee.com/energye/energy.git
synced 2024-11-30 10:47:57 +08:00
optimize: window tray
This commit is contained in:
parent
121192ab50
commit
a54e1f019d
@ -12,6 +12,7 @@
|
||||
package cef
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "github.com/energye/energy/common"
|
||||
"github.com/energye/energy/common/assetserve"
|
||||
. "github.com/energye/energy/consts"
|
||||
@ -70,6 +71,9 @@ func (m *tCefTrayForm) Hide() {
|
||||
}
|
||||
|
||||
func (m *tCefTrayForm) close() {
|
||||
if m.isClosing {
|
||||
return
|
||||
}
|
||||
m.Hide()
|
||||
m.TForm.Close()
|
||||
}
|
||||
@ -179,12 +183,14 @@ func (m *tCefTrayForm) createCefTrayWindow() {
|
||||
|
||||
m.TForm.SetOnCloseQuery(func(sender lcl.IObject, canClose *bool) {
|
||||
*canClose = m.canClose
|
||||
fmt.Println("tray close query", m.canClose)
|
||||
if m.isClosing {
|
||||
return
|
||||
}
|
||||
m.isClosing = true
|
||||
m.Hide()
|
||||
m.chromium.CloseBrowser(true)
|
||||
m.trayIcon.Free()
|
||||
})
|
||||
m.TForm.SetOnClose(func(sender lcl.IObject, action *types.TCloseAction) {
|
||||
*action = types.CaFree
|
||||
@ -216,11 +222,6 @@ func (m *tCefTrayForm) createCefTrayWindow() {
|
||||
}
|
||||
})
|
||||
m.chromium.SetOnClose(func(sender lcl.IObject, browser *ICefBrowser, aAction *TCefCloseBrowsesAction) {
|
||||
if IsDarwin() {
|
||||
*aAction = CbaDelay
|
||||
} else {
|
||||
*aAction = CbaClose
|
||||
}
|
||||
if IsDarwin() {
|
||||
m.windowParent.DestroyChildWindow()
|
||||
} else {
|
||||
@ -228,6 +229,7 @@ func (m *tCefTrayForm) createCefTrayWindow() {
|
||||
m.windowParent.Free()
|
||||
})
|
||||
}
|
||||
*aAction = CbaDelay
|
||||
})
|
||||
m.chromium.SetOnBeforeClose(func(sender lcl.IObject, browser *ICefBrowser) {
|
||||
m.canClose = true
|
||||
|
Loading…
Reference in New Issue
Block a user