diff --git a/example/context-menu/context-menu.go b/example/context-menu/context-menu.go index 7721ff0d87e3f3c12e4e687abc8b86a51c26abab..43e091e9a81f4473cb391dfb8acba1c118855c1e 100644 --- a/example/context-menu/context-menu.go +++ b/example/context-menu/context-menu.go @@ -21,7 +21,7 @@ func main() { cefApp := cef.NewApplication() //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/control/control.go b/example/control/control.go index 0e06058e726140ddf576e04290b5b54b44784476..6211b2b77e2034fae82660b7b8b42a58963a1f73 100644 --- a/example/control/control.go +++ b/example/control/control.go @@ -19,11 +19,11 @@ func main() { //全局初始化 每个应用都必须调用的 cef.GlobalInit(&libs, &resources) //创建应用 - cefApp := cef.NewApplication() - cefApp.SetEnableGPU(true) + app := cef.NewApplication() + app.SetEnableGPU(true) //主进程窗口 - src.MainBrowserWindow() + src.MainBrowserWindow(app) //运行应用 - cef.Run(cefApp) + cef.Run(app) } diff --git a/example/control/src/main-browser-window.go b/example/control/src/main-browser-window.go index 649ce64587315eaed9286ab776fec15333cb95a9..b29c4a6716a1f56b314e038ed4d4b08a40a71e70 100644 --- a/example/control/src/main-browser-window.go +++ b/example/control/src/main-browser-window.go @@ -10,7 +10,7 @@ import ( ) //主浏览器窗口 -func MainBrowserWindow() { +func MainBrowserWindow(app *cef.TCEFApplication) { //只有启动主进程才会继续执行 if !process.Args.IsMain() { return @@ -23,7 +23,7 @@ func MainBrowserWindow() { //窗口宽高 cef.BrowserWindow.Config.Width = 1024 cef.BrowserWindow.Config.Height = 768 - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" @@ -35,34 +35,34 @@ func MainBrowserWindow() { cef.BrowserWindow.Config.SetChromiumConfig(config) //创建窗口时的回调函数 对浏览器事件设置,和窗口属性组件等创建和修改 cef.BrowserWindow.SetBrowserInit(func(event *cef.BrowserEvent, window cef.IBrowserWindow) { - if window.IsLCL() { - //在窗体初始化时创建窗口内的组件 - back, forward, stop, refresh, progressLabel, addr := controlUI(window.AsLCLBrowserWindow().BrowserWindow()) - //页面加载处理进度 - event.SetOnLoadingProgressChange(func(sender lcl.IObject, browser *cef.ICefBrowser, progress float64) { - //linux 更新UI组件必须使用 QueueAsyncCall 主线程异步同步 - cef.QueueAsyncCall(func(id int) { - //参数-进度 - progressLabel.SetCaption(fmt.Sprintf("%v", progress*100)) - }) + //if window.IsLCL() { + //在窗体初始化时创建窗口内的组件 + back, forward, stop, refresh, progressLabel, addr := controlUI(window.AsLCLBrowserWindow().BrowserWindow()) + //页面加载处理进度 + event.SetOnLoadingProgressChange(func(sender lcl.IObject, browser *cef.ICefBrowser, progress float64) { + //linux 更新UI组件必须使用 QueueAsyncCall 主线程异步同步 + cef.QueueAsyncCall(func(id int) { + //参数-进度 + progressLabel.SetCaption(fmt.Sprintf("%v", progress*100)) }) - //页面加载状态,根据状态判断是否加载完成,和是否可前进后退 - event.SetOnLoadingStateChange(func(sender lcl.IObject, browser *cef.ICefBrowser, isLoading, canGoBack, canGoForward bool) { - //linux 更新UI组件必须使用 QueueAsyncCall 主线程异步同步 - cef.QueueAsyncCall(func(id int) { - //控制按钮状态 - stop.SetEnabled(isLoading) - refresh.SetEnabled(!isLoading) - back.SetEnabled(canGoBack) - forward.SetEnabled(canGoForward) - }) + }) + //页面加载状态,根据状态判断是否加载完成,和是否可前进后退 + event.SetOnLoadingStateChange(func(sender lcl.IObject, browser *cef.ICefBrowser, isLoading, canGoBack, canGoForward bool) { + //linux 更新UI组件必须使用 QueueAsyncCall 主线程异步同步 + cef.QueueAsyncCall(func(id int) { + //控制按钮状态 + stop.SetEnabled(isLoading) + refresh.SetEnabled(!isLoading) + back.SetEnabled(canGoBack) + forward.SetEnabled(canGoForward) }) - event.SetOnAddressChange(func(sender lcl.IObject, browser *cef.ICefBrowser, frame *cef.ICefFrame, url string) { - cef.QueueAsyncCall(func(id int) { - addr.SetText(url) - }) + }) + event.SetOnAddressChange(func(sender lcl.IObject, browser *cef.ICefBrowser, frame *cef.ICefFrame, url string) { + cef.QueueAsyncCall(func(id int) { + addr.SetText(url) }) - } + }) + //} }) } diff --git a/example/cookie-manager/cookie-manager.go b/example/cookie-manager/cookie-manager.go index 523ce1b8f1dae2ff7362a72c60b1bce58ccf6d98..a6003fb77ad6cca04e8b871a0194b6f8d01340f5 100644 --- a/example/cookie-manager/cookie-manager.go +++ b/example/cookie-manager/cookie-manager.go @@ -22,7 +22,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "https://www.baidu.com" cef.BrowserWindow.Config.Title = "Energy - cookie-manager" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/cookie/cookie.go b/example/cookie/cookie.go index 6f1e3473e914eab053093fb8ea4a555ba3ee51d8..32a6f84d548146a119dc35b70a4734ed6b047086 100644 --- a/example/cookie/cookie.go +++ b/example/cookie/cookie.go @@ -27,7 +27,7 @@ func main() { //主窗口的配置 //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/cookie.html" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/custom-drag-window/custom-drag-window.go b/example/custom-drag-window/custom-drag-window.go index 95bf17d5387d5eee899a83fb4b10bf36cc3624ae..09d424f337179d2eb378931bad30c9230242f4d9 100644 --- a/example/custom-drag-window/custom-drag-window.go +++ b/example/custom-drag-window/custom-drag-window.go @@ -15,7 +15,7 @@ func main() { cef.GlobalInit(nil, &resources) app := cef.NewApplication() cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/dom-visitor/dom-visitor.go b/example/dom-visitor/dom-visitor.go index 6505b9f2a1731d80566e23bd6ee664f42c3cf176..4929ba3aad0ac878e260550caa6acf5937e89839 100644 --- a/example/dom-visitor/dom-visitor.go +++ b/example/dom-visitor/dom-visitor.go @@ -25,7 +25,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/dom-visitor.html" cef.BrowserWindow.Config.Title = "Energy - dom-visitor" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/download/download.go b/example/download/download.go index 60d917cf3677f3dfb4cde577d3b4e4c4cf5bd29d..efbbb7a8f604873232c614eafa3a3760496e8af3 100644 --- a/example/download/download.go +++ b/example/download/download.go @@ -25,7 +25,7 @@ func main() { //主窗口的配置 //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/download.html" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/drag-file/drag-file.go b/example/drag-file/drag-file.go index 3091864827744178458e6543fe54ff0568989259..d86104d59c2e5805ea454ac60f053896070734b5 100644 --- a/example/drag-file/drag-file.go +++ b/example/drag-file/drag-file.go @@ -17,7 +17,7 @@ func main() { cef.GlobalInit(nil, &resources) app := cef.NewApplication() cef.BrowserWindow.Config.Url = "http://chrome.360.cn/html5_labs/demos/dnd/" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/execute-dev-tools-method/dev-tools-method.go b/example/execute-dev-tools-method/dev-tools-method.go index 7c75fdd1ec600dc585cc74bc0d283edd65e1dac8..613d79b3cbbf9df350ea1f743c83e98a7ea448ff 100644 --- a/example/execute-dev-tools-method/dev-tools-method.go +++ b/example/execute-dev-tools-method/dev-tools-method.go @@ -24,7 +24,7 @@ func main() { //主窗口的配置 //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/execute-dev-tool-method.html" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/execute-javascript/execute-javascript.go b/example/execute-javascript/execute-javascript.go index af9d6fc179987a1b73ec756698c0726c0aa46269..1605bf315415e44414aaad4d649ff5fd4a5cce15 100644 --- a/example/execute-javascript/execute-javascript.go +++ b/example/execute-javascript/execute-javascript.go @@ -21,7 +21,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/execute-javascript.html" cef.BrowserWindow.Config.Title = "Energy - execute-javascript" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/frameless/frameless.go b/example/frameless/frameless.go index 268c1ec21374041eb737ee77dcc1a043e8915631..b822bf15e091686b22b44a832804c5e4fc301263 100644 --- a/example/frameless/frameless.go +++ b/example/frameless/frameless.go @@ -35,7 +35,7 @@ func main() { //cefApp.SetMultiThreadedMessageLoop(false) //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/i18n/i18n.go b/example/i18n/i18n.go index ee9ddde911151091553fbc02ca1a7b68949e78ff..be052b3f9cbb0b6cd961deaece9a86bf6dd4153d 100644 --- a/example/i18n/i18n.go +++ b/example/i18n/i18n.go @@ -35,7 +35,7 @@ func main() { i18n.Switch(consts.LANGUAGE_zh_CN) //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/i18n.html" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/internal-http-server/internal-http-server.go b/example/internal-http-server/internal-http-server.go index 164f9b2abf45623e65583562939ef2f7fd09f311..2f0c95f03f4ebcf3f6449f81416b33c22318091b 100644 --- a/example/internal-http-server/internal-http-server.go +++ b/example/internal-http-server/internal-http-server.go @@ -20,7 +20,7 @@ func main() { cefApp := cef.NewApplication() //主窗口的配置 cef.BrowserWindow.Config.Title = "Energy - 内置资源和内置服务示例" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/ipc-on-emit/go-composite-type/go-composite-type.go b/example/ipc-on-emit/go-composite-type/go-composite-type.go index 758c68b0d667b291e56ba5b1c663accb46c44790..83a833f8f4aa41ec55241ee1a3139e64bcc75d35 100644 --- a/example/ipc-on-emit/go-composite-type/go-composite-type.go +++ b/example/ipc-on-emit/go-composite-type/go-composite-type.go @@ -22,7 +22,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/go-composite-type.html" cef.BrowserWindow.Config.Title = "Energy - go-composite-type" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/ipc-on-emit/go-to-js/go-to-js.go b/example/ipc-on-emit/go-to-js/go-to-js.go index 5d3e0827371a528af4a19c3d5869b6114e878fc4..c65ee6a51e70c16afde440f06b3a79badfa527b0 100644 --- a/example/ipc-on-emit/go-to-js/go-to-js.go +++ b/example/ipc-on-emit/go-to-js/go-to-js.go @@ -23,7 +23,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/go-to-js.html" cef.BrowserWindow.Config.Title = "Energy - go on event - js emit event" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/ipc-on-emit/js-to-go/js-to-go.go b/example/ipc-on-emit/js-to-go/js-to-go.go index 1cfe98191c6aa6739ee85243c9e7859350f96ffa..37e51691092ad2dc41c2a760d0f1d43c256183ec 100644 --- a/example/ipc-on-emit/js-to-go/js-to-go.go +++ b/example/ipc-on-emit/js-to-go/js-to-go.go @@ -21,7 +21,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/js-to-go.html" cef.BrowserWindow.Config.Title = "Energy - js on event - go emit event" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/key-event/key-event.go b/example/key-event/key-event.go index 91a16794ed835e090eac52a471b54c422b0d9c2a..b05885296459302f1eabf6ab34374f488758d819 100644 --- a/example/key-event/key-event.go +++ b/example/key-event/key-event.go @@ -21,7 +21,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/key-event.html" cef.BrowserWindow.Config.Title = "Energy - Key Event" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/load-html-url/load-html-url.go b/example/load-html-url/load-html-url.go index e109d94ae3b72cb1d6dfad7a1b0b66ea98749898..e4192fedcfffde8a32ef1dc5db2b9d37f951a8ef 100644 --- a/example/load-html-url/load-html-url.go +++ b/example/load-html-url/load-html-url.go @@ -22,7 +22,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = indexHtmlPath cef.BrowserWindow.Config.Title = "Energy 本地加载html" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/msgbox/msgbox.go b/example/msgbox/msgbox.go index 52bfc57761b3c964201a48130bb96d701ab1d4f3..def8cb0a6cf16cd28479ffde1fd333f43aed3979 100644 --- a/example/msgbox/msgbox.go +++ b/example/msgbox/msgbox.go @@ -24,7 +24,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/msgbox.html" cef.BrowserWindow.Config.Title = "Energy - msgbox" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/popup-sub-window/popup-sub-window.go b/example/popup-sub-window/popup-sub-window.go index 3efe3f5c84905fbc4b343633ed458d75aa2f2af5..fcf2ab26a1858b60d20b73130888982552a1976a 100644 --- a/example/popup-sub-window/popup-sub-window.go +++ b/example/popup-sub-window/popup-sub-window.go @@ -26,7 +26,7 @@ func main() { cefApp := cef.NewApplication() //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/print-pdf/print-pdf.go b/example/print-pdf/print-pdf.go index f71fc9630c51159eef6dc21c505c7323dca22b63..81f9d514e85358c338cb315c34343d9043b7bc4c 100644 --- a/example/print-pdf/print-pdf.go +++ b/example/print-pdf/print-pdf.go @@ -23,7 +23,7 @@ func main() { cefApp := cef.NewApplication() //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/process-type/process-type.go b/example/process-type/process-type.go index 1f3c1060da3237ab9e9d921f0db65337644c8607..ca508884c86aa27cb3c2cce88021afb1a6421d7f 100644 --- a/example/process-type/process-type.go +++ b/example/process-type/process-type.go @@ -28,7 +28,7 @@ func main() { cefApp := cef.NewApplication() //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "https://energy.yanghy.cn" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/response-filter/response-filter.go b/example/response-filter/response-filter.go index 682d8c6f560df7f8f5eba018e54bf5b7c42ee71e..550e197db195c792c0273916fd5b725a57f87048 100644 --- a/example/response-filter/response-filter.go +++ b/example/response-filter/response-filter.go @@ -28,7 +28,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/response-filter.html" cef.BrowserWindow.Config.Title = "Energy - response-filter" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/scheme/scheme.go b/example/scheme/scheme.go index 7b8d2a736e77d78c2779a81691c2d89090299a59..a57f980876b54539fd543b827166db6e92a07fab 100644 --- a/example/scheme/scheme.go +++ b/example/scheme/scheme.go @@ -26,7 +26,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "https://www.baidu.com/" cef.BrowserWindow.Config.Title = "Energy - Scheme" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/search-text/seach-text.go b/example/search-text/seach-text.go index 1894f4f541011ccdbd37feeba8ac31200ba82a88..23bacc73df8a4ce619558ceafd8e02c117385874 100644 --- a/example/search-text/seach-text.go +++ b/example/search-text/seach-text.go @@ -22,7 +22,7 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html" cef.BrowserWindow.Config.Title = "Energy 搜索页面中文本" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/sub-process/main-process/main-process.go b/example/sub-process/main-process/main-process.go index 7338f9f6cb67e6a9df211eb9e8cd32fec0a1d19d..8c2bb14e0549e2467998d25a6a97f477b691a1e9 100644 --- a/example/sub-process/main-process/main-process.go +++ b/example/sub-process/main-process/main-process.go @@ -61,7 +61,7 @@ func main() { //cefApp.SetSingleProcess(false) //单进程 或 多进程 ,单进程上面的子进程配置就不起作用了 cefApp.SetBrowserSubprocessPath(subExePath) //主进程初始化 - src.MainBrowserInit() + src.MainBrowserInit(cefApp) cef.SetBrowserProcessStartAfterCallback(func(b bool) { fmt.Println("主进程启动 创建一个内置http服务") //通过内置http服务加载资源 diff --git a/example/sub-process/main-process/src/main-browser.go b/example/sub-process/main-process/src/main-browser.go index da4950b31f0fcbb05f746554242966dad1574cd7..e56390a36924f3837bfc2eb4959b91a12d0ec7b3 100644 --- a/example/sub-process/main-process/src/main-browser.go +++ b/example/sub-process/main-process/src/main-browser.go @@ -8,11 +8,11 @@ import ( ) //主进程浏览器初始化 -func MainBrowserInit() { +func MainBrowserInit(app *cef.TCEFApplication) { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html" cef.BrowserWindow.Config.Title = "ENERGY 区分主/子进程执行文件" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/sys-dialog/sysdialog.go b/example/sys-dialog/sysdialog.go index 4c4944dfca913a38ec209c2bdf0eda5d9eece60a..edbfe2b0e6dbfbc92a50120ec1ecde7e8a2628d0 100644 --- a/example/sys-dialog/sysdialog.go +++ b/example/sys-dialog/sysdialog.go @@ -38,7 +38,7 @@ func main() { cef.BrowserWindow.Config.Url = "http://localhost:22022/sysdialog.html" } cef.BrowserWindow.Config.Title = "Energy - dialog" - if common.IsLinux() { + if common.IsLinux() && app.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico" diff --git a/example/webkit-register/webkit-register.go b/example/webkit-register/webkit-register.go index 91a3777885f533831399b246af7a052deceaa970..c897c86dd9313dc995e2dec069a8172262680e1e 100644 --- a/example/webkit-register/webkit-register.go +++ b/example/webkit-register/webkit-register.go @@ -28,7 +28,7 @@ func main() { cefApp := cef.NewApplication() //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/webkit-register.html" - if common.IsLinux() { + if common.IsLinux() && cefApp.IsUIGtk3() { cef.BrowserWindow.Config.IconFS = "resources/icon.png" } else { cef.BrowserWindow.Config.IconFS = "resources/icon.ico"