Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
energye
energy
提交
6322108b
energy
项目概览
energye
/
energy
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
energy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6322108b
编写于
12月 11, 2022
作者:
yanghye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
upgrade: beta fix: macosx close bug
上级
7cd1173b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
19 deletion
+25
-19
cef/cef-base-browser-window.go
cef/cef-base-browser-window.go
+25
-19
未找到文件。
cef/cef-base-browser-window.go
浏览文件 @
6322108b
...
@@ -417,7 +417,6 @@ func (m *BaseWindow) registerDefaultEvent() {
...
@@ -417,7 +417,6 @@ func (m *BaseWindow) registerDefaultEvent() {
})
})
}
}
func
(
m
*
BaseWindow
)
close
(
sender
lcl
.
IObject
,
action
*
types
.
TCloseAction
)
{
func
(
m
*
BaseWindow
)
close
(
sender
lcl
.
IObject
,
action
*
types
.
TCloseAction
)
{
logger
.
Debug
(
"close"
)
var
ret
bool
var
ret
bool
if
m
.
onClose
!=
nil
{
if
m
.
onClose
!=
nil
{
for
_
,
fn
:=
range
m
.
onClose
{
for
_
,
fn
:=
range
m
.
onClose
{
...
@@ -427,6 +426,7 @@ func (m *BaseWindow) close(sender lcl.IObject, action *types.TCloseAction) {
...
@@ -427,6 +426,7 @@ func (m *BaseWindow) close(sender lcl.IObject, action *types.TCloseAction) {
}
}
}
}
if
!
ret
{
if
!
ret
{
logger
.
Debug
(
"window.onClose"
)
*
action
=
types
.
CaFree
*
action
=
types
.
CaFree
}
}
}
}
...
@@ -441,13 +441,13 @@ func (m *BaseWindow) closeQuery(sender lcl.IObject, close *bool) {
...
@@ -441,13 +441,13 @@ func (m *BaseWindow) closeQuery(sender lcl.IObject, close *bool) {
}
}
}
}
if
!
ret
{
if
!
ret
{
logger
.
Debug
(
"
c
loseQuery windowType:"
,
m
.
WindowType
())
logger
.
Debug
(
"
window.onC
loseQuery windowType:"
,
m
.
WindowType
())
if
IsDarwin
()
{
if
IsDarwin
()
{
//main window close
//main window close
if
m
.
WindowType
()
==
WT_MAIN_BROWSER
{
if
m
.
WindowType
()
==
WT_MAIN_BROWSER
{
*
close
=
true
*
close
=
true
desChildWind
:=
m
.
windowParent
.
DestroyChildWindow
()
desChildWind
:=
m
.
windowParent
.
DestroyChildWindow
()
logger
.
Debug
(
"
closeQuery windowParent
DestroyChildWindow:"
,
desChildWind
)
logger
.
Debug
(
"
window.onCloseQuery => windowParent.
DestroyChildWindow:"
,
desChildWind
)
}
else
{
}
else
{
//sub window close
//sub window close
*
close
=
m
.
canClose
*
close
=
m
.
canClose
...
@@ -472,33 +472,39 @@ func (m *BaseWindow) closeQuery(sender lcl.IObject, close *bool) {
...
@@ -472,33 +472,39 @@ func (m *BaseWindow) closeQuery(sender lcl.IObject, close *bool) {
func
(
m
*
BaseWindow
)
registerDefaultChromiumCloseEvent
()
{
func
(
m
*
BaseWindow
)
registerDefaultChromiumCloseEvent
()
{
var
bwEvent
=
BrowserWindow
.
browserEvent
var
bwEvent
=
BrowserWindow
.
browserEvent
m
.
chromium
.
SetOnClose
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
aAction
*
TCefCloseBrowsesAction
)
{
m
.
chromium
.
SetOnClose
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
aAction
*
TCefCloseBrowsesAction
)
{
logger
.
Debug
(
"chromium
c
lose"
)
logger
.
Debug
(
"chromium
.onC
lose"
)
if
IsDarwin
()
{
//MacOSX
if
IsDarwin
()
{
//MacOSX
logger
.
Debug
(
"chromium close windowParent DestroyChildWindow:"
,
m
.
windowParent
.
DestroyChildWindow
())
desChildWind
:=
m
.
windowParent
.
DestroyChildWindow
()
logger
.
Debug
(
"chromium.onClose => windowParent.DestroyChildWindow:"
,
desChildWind
)
}
else
{
// Window and Linux
}
else
{
// Window and Linux
QueueAsyncCall
(
func
(
id
int
)
{
//main thread run
//QueueAsyncCall(func(id int) { //main thread run
m
.
windowParent
.
Free
()
// m.windowParent.Free()
logger
.
Debug
(
"chromium close windowParent Free"
)
// logger.Debug("chromium.onClose => windowParent.Free")
})
//})
}
}
if
IsLinux
()
{
QueueAsyncCall
(
func
(
id
int
)
{
//main thread run
//继续关闭 -> OnBeforeClose
m
.
windowParent
.
Free
()
*
aAction
=
CbaClose
logger
.
Debug
(
"chromium.onClose => windowParent.Free"
)
}
else
{
})
//暂时停止关闭 -> OnBeforeClose
*
aAction
=
CbaClose
*
aAction
=
CbaDelay
//if IsLinux() {
}
// //继续关闭 -> OnBeforeClose
// *aAction = CbaClose
//} else {
// //暂时停止关闭 -> OnBeforeClose
// *aAction = CbaDelay
//}
if
bwEvent
.
onClose
!=
nil
{
if
bwEvent
.
onClose
!=
nil
{
bwEvent
.
onClose
(
sender
,
browser
,
aAction
)
bwEvent
.
onClose
(
sender
,
browser
,
aAction
)
}
}
})
})
m
.
chromium
.
SetOnBeforeClose
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
)
{
m
.
chromium
.
SetOnBeforeClose
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
)
{
logger
.
Debug
(
"chromium
b
eforeClose"
)
logger
.
Debug
(
"chromium
.onB
eforeClose"
)
m
.
canClose
=
true
m
.
canClose
=
true
var
tempClose
=
func
()
{
var
tempClose
=
func
()
{
defer
func
()
{
defer
func
()
{
if
err
:=
recover
();
err
!=
nil
{
if
err
:=
recover
();
err
!=
nil
{
logger
.
Error
(
"OnBeforeClose Error:"
,
err
)
logger
.
Error
(
"
chromium.
OnBeforeClose Error:"
,
err
)
}
}
}()
}()
if
m
.
windowInfo
.
auxTools
.
viewSourceWindow
!=
nil
{
if
m
.
windowInfo
.
auxTools
.
viewSourceWindow
!=
nil
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录