mirror of
https://gitee.com/energye/energy.git
synced 2024-11-30 10:47:57 +08:00
v2.3.13 Fixed Chinese input and gtk3 issues for linux
This commit is contained in:
parent
be97d36f35
commit
9450c95d1d
@ -36,7 +36,7 @@ func SetOnException(exception ExceptionCallback) {
|
||||
//libs 内置到应用程序的类库
|
||||
//
|
||||
//resources 内置到应用程序的资源文件
|
||||
func GlobalCEFInit(libs *embed.FS, resources *embed.FS) {
|
||||
func GlobalInit(libs *embed.FS, resources *embed.FS) {
|
||||
macapp.MacApp.IsCEF(IsDarwin())
|
||||
inits.Init(libs, resources)
|
||||
if Args.IsRender() {
|
||||
|
@ -14,11 +14,11 @@ var resources embed.FS
|
||||
var libs embed.FS
|
||||
|
||||
func main() {
|
||||
//开发环境中 MacOSX平台必须在"GlobalCEFInit"之前设置CEF
|
||||
//开发环境中 MacOSX平台必须在"GlobalInit"之前设置CEF
|
||||
//设置使用CEF 和 CEF框架目录,生成开发执行应用程序包
|
||||
//环境变量 ENERGY_HOME="/app/cefframework" 配置框架所在目录
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(&libs, &resources)
|
||||
cef.GlobalInit(&libs, &resources)
|
||||
//可选的应用配置
|
||||
cfg := cef.NewApplicationConfig()
|
||||
//指定chromium的二进制包框架根目录,
|
||||
|
@ -19,7 +19,7 @@ var resources embed.FS
|
||||
//这个示例使用了几个事件来演示下载文件
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//主窗口的配置
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, nil)
|
||||
cef.GlobalInit(nil, nil)
|
||||
applicationConfig := cef.NewApplicationConfig()
|
||||
applicationConfig.SetRemoteDebuggingPort(8888) //远程端口方式, 需自定义端口号
|
||||
//创建应用
|
||||
|
@ -20,7 +20,7 @@ var resources embed.FS
|
||||
//并且设置event.SetOnDownloadUpdated获取下载进度信息
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//主窗口的配置
|
||||
|
@ -14,7 +14,7 @@ var resources embed.FS
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//主窗口的配置
|
||||
|
@ -13,7 +13,7 @@ var resources embed.FS
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//指定一个URL地址,或本地html文件目录
|
||||
|
@ -13,7 +13,7 @@ var resources embed.FS
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//指定一个URL地址,或本地html文件目录
|
||||
|
@ -14,7 +14,7 @@ var resources embed.FS
|
||||
func main() {
|
||||
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//主窗口的配置
|
||||
|
@ -15,7 +15,7 @@ var resources embed.FS
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//指定一个URL地址,或本地html文件目录
|
||||
|
@ -14,7 +14,7 @@ var resources embed.FS
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//指定一个URL地址,或本地html文件目录
|
||||
|
@ -13,7 +13,7 @@ var resources embed.FS
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//指定一个URL地址,或本地html文件目录
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, nil)
|
||||
cef.GlobalInit(nil, nil)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//主窗口的配置
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"github.com/energye/energy/cef"
|
||||
"github.com/energye/energy/common"
|
||||
"github.com/energye/golcl/energy/inits"
|
||||
"github.com/energye/golcl/lcl"
|
||||
)
|
||||
|
||||
@ -13,17 +12,13 @@ import (
|
||||
var resources embed.FS
|
||||
|
||||
func main() {
|
||||
inits.Init(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
fmt.Println("main", common.Args.ProcessType())
|
||||
|
||||
config := cef.NewApplicationConfig()
|
||||
config.SetMultiThreadedMessageLoop(false)
|
||||
config.SetExternalMessagePump(false)
|
||||
application := cef.NewCEFApplication(config)
|
||||
application.SetOnContextCreated(func(browser *cef.ICefBrowser, frame *cef.ICefFrame, context *cef.ICefV8Context) bool {
|
||||
fmt.Println("OnContextCreated")
|
||||
return false
|
||||
})
|
||||
application.SetOnContextInitialized(func() {
|
||||
fmt.Println("OnContextInitialized()")
|
||||
component := lcl.NewComponent(nil)
|
||||
@ -31,13 +26,7 @@ func main() {
|
||||
chromium := cef.NewChromium(component, chromiumConfig)
|
||||
browserViewComponent := cef.NewBrowserViewComponent(component)
|
||||
windowComponent := cef.NewWindowComponent(component)
|
||||
chromium.SetOnBeforeClose(func(sender lcl.IObject, browser *cef.ICefBrowser) {
|
||||
fmt.Println("OnBeforeClose")
|
||||
})
|
||||
chromium.SetOnTitleChange(func(sender lcl.IObject, browser *cef.ICefBrowser, title string) {
|
||||
fmt.Println("OnTitleChange", title)
|
||||
windowComponent.SetTitle(title)
|
||||
})
|
||||
|
||||
chromium.SetOnBeforePopup(func(sender lcl.IObject, browser *cef.ICefBrowser, frame *cef.ICefFrame, beforePopupInfo *cef.BeforePopupInfo, client *cef.ICefClient, noJavascriptAccess *bool) bool {
|
||||
fmt.Println("OnBeforePopup TargetUrl:", beforePopupInfo.TargetUrl)
|
||||
|
||||
@ -57,6 +46,7 @@ func main() {
|
||||
windowComponent.SetAlwaysOnTop(true)
|
||||
//window.SetFullscreen(true)
|
||||
window.Show()
|
||||
fmt.Println("SetOnWindowCreated end")
|
||||
})
|
||||
windowComponent.SetOnCanClose(func(sender lcl.IObject, window *cef.ICefWindow, aResult *bool) {
|
||||
fmt.Println("OnCanClose")
|
||||
@ -66,13 +56,18 @@ func main() {
|
||||
|
||||
windowComponent.CreateTopLevelWindow()
|
||||
})
|
||||
application.SetOnGetDefaultClient(func(client *cef.ICefClient) {
|
||||
fmt.Println("OnGetDefaultClient")
|
||||
})
|
||||
process := application.StartMainProcess()
|
||||
//application.SetOnGetDefaultClient(func(client *cef.ICefClient) {
|
||||
// fmt.Println("OnGetDefaultClient")
|
||||
//})
|
||||
var process bool
|
||||
if !common.Args.IsMain() {
|
||||
process = application.StartSubProcess()
|
||||
} else {
|
||||
process = application.StartMainProcess()
|
||||
application.RunMessageLoop()
|
||||
}
|
||||
fmt.Println("application.StartMainProcess()", process)
|
||||
if process {
|
||||
fmt.Println("application.RunMessageLoop()")
|
||||
application.RunMessageLoop()
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ func main() {
|
||||
logger.SetLevel(logger.CefLog_Debug)
|
||||
//环境变量 ENERGY_HOME="/app/cefframework" 配置框架所在目录
|
||||
//全局初始化
|
||||
cef.GlobalCEFInit(&libs, &resources)
|
||||
cef.GlobalInit(&libs, &resources)
|
||||
fmt.Println("CEFVersion:", cef.CEFVersion(), "LibBuildVersion:", cef.LibBuildVersion())
|
||||
//Render 子进程一些初始化配置
|
||||
cefApp := src.AppRenderInit()
|
||||
|
@ -15,7 +15,7 @@ var resources embed.FS
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//指定一个URL地址,或本地html文件目录
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"github.com/energye/energy/cef"
|
||||
"github.com/energye/energy/common"
|
||||
"github.com/energye/energy/common/assetserve"
|
||||
sys_tray "github.com/energye/energy/example/dev-test/sys-tray"
|
||||
"github.com/energye/energy/ipc"
|
||||
"github.com/energye/golcl/lcl"
|
||||
)
|
||||
@ -15,20 +14,22 @@ import (
|
||||
var resources embed.FS
|
||||
|
||||
func main() {
|
||||
fmt.Println("ARGS", common.Args.ProcessType())
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, &resources)
|
||||
cef.GlobalInit(nil, &resources)
|
||||
//创建应用
|
||||
config := cef.NewApplicationConfig()
|
||||
config.SetMultiThreadedMessageLoop(false)
|
||||
config.SetExternalMessagePump(false)
|
||||
config.SetRemoteDebuggingPort(33333)
|
||||
config.SetRemoteDebuggingPort(0)
|
||||
config.SetSingleProcess(true)
|
||||
cefApp := cef.NewApplication(config)
|
||||
//指定一个URL地址,或本地html文件目录
|
||||
cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html"
|
||||
cef.BrowserWindow.Config.IconFS = "resources/icon.png"
|
||||
cef.BrowserWindow.Config.CanDragFile = true
|
||||
cef.BrowserWindow.SetBrowserInit(func(event *cef.BrowserEvent, window cef.IBrowserWindow) {
|
||||
window.DisableResize()
|
||||
//window.DisableResize()
|
||||
window.SetTitle("这里改变了窗口标题")
|
||||
window.SetSize(1600, 900)
|
||||
fmt.Println("cef.BrowserWindow.SetViewFrameBrowserInit", window)
|
||||
@ -63,7 +64,7 @@ func main() {
|
||||
bw := window.AsViewsFrameworkBrowserWindow().BrowserWindow()
|
||||
fmt.Println("handle", bw.WindowComponent().WindowHandle().ToPtr())
|
||||
//cefTray(window)
|
||||
go sys_tray.TrayMain()
|
||||
//go sys_tray.TrayMain()
|
||||
fmt.Println("SetBrowserInitAfter 结束")
|
||||
})
|
||||
//在主进程启动成功之后执行
|
||||
@ -78,7 +79,6 @@ func main() {
|
||||
server.Assets = &resources
|
||||
go server.StartHttpServer()
|
||||
})
|
||||
fmt.Println("ARGS", common.Args.ProcessType())
|
||||
//运行应用
|
||||
cef.Run(cefApp)
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
//开发环境中 MacOSX平台必须在"GlobalCEFInit"之前设置CEF
|
||||
//开发环境中 MacOSX平台必须在"GlobalInit"之前设置CEF
|
||||
macapp.MacApp.IsCEF(common.IsDarwin())
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, nil)
|
||||
cef.GlobalInit(nil, nil)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//指定一个URL地址,或本地html文件目录
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
func main() {
|
||||
//全局初始化 每个应用都必须调用的
|
||||
cef.GlobalCEFInit(nil, nil)
|
||||
cef.GlobalInit(nil, nil)
|
||||
//创建应用
|
||||
cefApp := cef.NewApplication(nil)
|
||||
//指定一个URL地址,或本地html文件目录
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
*/
|
||||
func main() {
|
||||
//MacOS通过指定 IsCEF ,在开发环境中自动生成可运行的程序包
|
||||
//MacOS配置要在 GlobalCEFInit 它之前
|
||||
//MacOS配置要在 GlobalInit 它之前
|
||||
//特别说明MacOS:子进程不需要配置
|
||||
if common.IsDarwin() {
|
||||
//自动生成mac app程序包
|
||||
@ -32,7 +32,7 @@ func main() {
|
||||
macapp.MacApp.SetBrowseSubprocessPath("/Users/zhangli/go/src/github.com/energye/energy/demos/demo-sub-process/sub-process/sub-process")
|
||||
}
|
||||
//CEF全局初始化
|
||||
cef.GlobalCEFInit(nil, nil)
|
||||
cef.GlobalInit(nil, nil)
|
||||
//Cef应用的配置 执行程序如果在 chromium 目录中可不配置
|
||||
cfg := cef.NewApplicationConfig()
|
||||
//配置chromium frameworks 编译好的二进制目录
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
*/
|
||||
func main() {
|
||||
//全局配置初始化
|
||||
cef.GlobalCEFInit(nil, nil)
|
||||
cef.GlobalInit(nil, nil)
|
||||
//IPC通信
|
||||
src.IPCInit()
|
||||
//Cef应用的配置 执行程序如果在 chromium 目录中可不配置
|
||||
|
Loading…
Reference in New Issue
Block a user