diff --git a/cef/application.go b/cef/application.go index 875f2697..b6df24fd 100644 --- a/cef/application.go +++ b/cef/application.go @@ -34,6 +34,8 @@ type TCEFApplication struct { onWebKitInitialized GlobalCEFAppEventOnWebKitInitialized onRegCustomSchemes GlobalCEFAppEventOnRegCustomSchemes onRenderLoadStart GlobalCEFAppEventOnRenderLoadStart + externalMessagePump bool + multiThreadedMessageLoop bool } // NewApplication 创建CEF应用 @@ -54,7 +56,7 @@ func NewApplication(disableRegisDefaultEvent ...bool) *TCEFApplication { // SetApplication // -// 设置全局 Application +// 设置全局 Application func SetApplication(app *TCEFApplication) { if application == nil { application = app diff --git a/cef/application_config.go b/cef/application_config.go index 2a1f5732..d9080ff8 100644 --- a/cef/application_config.go +++ b/cef/application_config.go @@ -191,15 +191,16 @@ func (m *TCEFApplication) MultiThreadedMessageLoop() bool { // IsMessageLoop // -// 消息轮询方式使用不同的窗口组件 -// return true: 使用VF(views framework)窗口组件, false: 使用LCL窗口组件 +// 不同的窗口组件使用不同的消息轮询 +// return +// true : VF(views framework)窗口组件 +// false: LCL窗口组件 func (m *TCEFApplication) IsMessageLoop() bool { - emp := m.ExternalMessagePump() - mtml := m.MultiThreadedMessageLoop() - return !emp && !mtml + return !m.externalMessagePump && !m.multiThreadedMessageLoop } func (m *TCEFApplication) SetMultiThreadedMessageLoop(value bool) { + m.multiThreadedMessageLoop = value imports.Proc(def.CEFAppConfig_SetMultiThreadedMessageLoop).Call(api.PascalBool(value)) } @@ -223,6 +224,7 @@ func (m *TCEFApplication) ExternalMessagePump() bool { func (m *TCEFApplication) SetExternalMessagePump(value bool) { if !m.IsSpecVer49() { + m.externalMessagePump = value imports.Proc(def.CEFAppConfig_SetExternalMessagePump).Call(api.PascalBool(value)) } }