From 7a6bb8acd7001e743a2406b1689636ddbc54323d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BA=A2=E5=B2=A9?= Date: Thu, 14 Dec 2023 19:49:01 +0800 Subject: [PATCH] =?UTF-8?q?U:=20=E7=A6=81=E7=94=A8=E4=B8=BB=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E9=85=8D=E7=BD=AE,=20=E7=B3=BB=E7=BB=9F=E6=89=98?= =?UTF-8?q?=E7=9B=98=E5=88=9B=E5=BB=BA=E7=9A=84=E7=88=B6=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cef/browser_window_lcl.go | 7 ++++--- cef/component.go | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cef/browser_window_lcl.go b/cef/browser_window_lcl.go index dd14d39a..e0fae3f1 100644 --- a/cef/browser_window_lcl.go +++ b/cef/browser_window_lcl.go @@ -1112,9 +1112,10 @@ func (m *LCLBrowserWindow) closeQuery(sender lcl.IObject, close *bool) { ret = m.onCloseQuery(sender, close) } if !ret { - if m.tray != nil { - m.tray.close() - } + // TODO 标记,可能需要移除 + //if m.tray != nil { + // m.tray.close() + //} logger.Debug("window.onCloseQuery windowType:", m.WindowType()) if IsDarwin() { //main window close diff --git a/cef/component.go b/cef/component.go index f584fa73..f9512b19 100644 --- a/cef/component.go +++ b/cef/component.go @@ -8,14 +8,19 @@ // //---------------------------------------- -// CEF 扩展组件 +// 扩展组件 package cef // NewTray 适用于 windows linux macos 系统托盘 func (m *LCLBrowserWindow) NewTray() ITray { 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 }