U: 禁用主窗口配置, 系统托盘创建的父组件修改

This commit is contained in:
杨红岩 2023-12-14 19:49:01 +08:00
parent 506fc0dfed
commit 7a6bb8acd7
2 changed files with 11 additions and 5 deletions

View File

@ -1112,9 +1112,10 @@ func (m *LCLBrowserWindow) closeQuery(sender lcl.IObject, close *bool) {
ret = m.onCloseQuery(sender, close) ret = m.onCloseQuery(sender, close)
} }
if !ret { if !ret {
if m.tray != nil { // TODO 标记,可能需要移除
m.tray.close() //if m.tray != nil {
} // m.tray.close()
//}
logger.Debug("window.onCloseQuery windowType:", m.WindowType()) logger.Debug("window.onCloseQuery windowType:", m.WindowType())
if IsDarwin() { if IsDarwin() {
//main window close //main window close

View File

@ -8,14 +8,19 @@
// //
//---------------------------------------- //----------------------------------------
// CEF 扩展组件 // 扩展组件
package cef package cef
// NewTray 适用于 windows linux macos 系统托盘 // NewTray 适用于 windows linux macos 系统托盘
func (m *LCLBrowserWindow) NewTray() ITray { func (m *LCLBrowserWindow) NewTray() ITray {
if m.tray == nil { if m.tray == nil {
m.tray = newTray(m.TForm) if BrowserWindow.Config.EnableMainWindow {
m.tray = newTray(m.TForm)
} else {
// 禁用主窗口, 这时需要使用 disabledMainWindow, 因为它才是实际的主窗口
m.tray = newTray(disabledMainWindow.TForm)
}
} }
return m.tray return m.tray
} }