Skip to content

Commit

Permalink
U&R: 移除示例下的icon图标文件
Browse files Browse the repository at this point in the history
  • Loading branch information
sxmxta committed Dec 7, 2023
1 parent 9a751f9 commit d0e18e8
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 35 deletions.
Binary file removed example/control-widget/resources/icon.ico
Binary file not shown.
Binary file removed example/control-widget/resources/icon.png
Binary file not shown.
12 changes: 3 additions & 9 deletions example/control-widget/src/main_browser_window.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import (
"fmt"
"github.com/energye/energy/v2/cef"
"github.com/energye/energy/v2/cef/process"
"github.com/energye/energy/v2/common"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/types"
)

//主浏览器窗口
// 主浏览器窗口
func MainBrowserWindow(app *cef.TCEFApplication) {
//只有启动主进程才会继续执行
if !process.Args.IsMain() {
Expand All @@ -23,11 +22,6 @@ func MainBrowserWindow(app *cef.TCEFApplication) {
//窗口宽高
cef.BrowserWindow.Config.Width = 1024
cef.BrowserWindow.Config.Height = 768
if common.IsLinux() && app.IsUIGtk3() {
cef.BrowserWindow.Config.IconFS = "resources/icon.png"
} else {
cef.BrowserWindow.Config.IconFS = "resources/icon.ico"
}
//chromium配置
config := cef.NewChromiumConfig()
config.SetEnableMenu(true)
Expand Down Expand Up @@ -69,8 +63,8 @@ func MainBrowserWindow(app *cef.TCEFApplication) {
})
}

//控制组件UI
//地址栏和控制按钮创建
// 控制组件UI
// 地址栏和控制按钮创建
func controlUI(browserWindow *cef.LCLBrowserWindow) (goBack *lcl.TButton, goForward *lcl.TButton, stop *lcl.TButton, refresh *lcl.TButton, progressLabel *lcl.TLabel, addrBox *lcl.TComboBox) {
window := browserWindow
//这里使用系统UI组件
Expand Down
12 changes: 1 addition & 11 deletions example/cookie-manager/cookie_manager.go
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
package main

import (
"embed"
"fmt"
"github.com/energye/energy/v2/cef"
"github.com/energye/energy/v2/common"
"github.com/energye/energy/v2/consts"
"github.com/energye/golcl/lcl"
"os"
"path/filepath"
//_ "net/http/pprof"
)

//go:embed resources
var resources embed.FS

func main() {
//全局初始化 每个应用都必须调用的
cef.GlobalInit(nil, &resources)
cef.GlobalInit(nil, nil)
//创建应用
var app = cef.NewApplication()
//指定一个URL地址,或本地html文件目录
cef.BrowserWindow.Config.Url = "https://www.baidu.com"
cef.BrowserWindow.Config.Title = "Energy - cookie-manager"
if common.IsLinux() && app.IsUIGtk3() {
cef.BrowserWindow.Config.IconFS = "resources/icon.png"
} else {
cef.BrowserWindow.Config.IconFS = "resources/icon.ico"
}
envPath := os.Getenv("ENERGY_HOME")
if envPath == "" {
// 未配置 ENERGY_HOME 环境变量, 在当前目录保存cache
Expand Down
Binary file removed example/cookie-manager/resources/icon.ico
Binary file not shown.
Binary file removed example/cookie-manager/resources/icon.png
Binary file not shown.
11 changes: 3 additions & 8 deletions example/cookie/cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import (
"github.com/energye/energy/v2/cef"
"github.com/energye/energy/v2/cef/ipc"
"github.com/energye/energy/v2/cef/ipc/context"
"github.com/energye/energy/v2/common"
"github.com/energye/energy/v2/consts"
"github.com/energye/energy/v2/pkgs/assetserve"
"github.com/energye/golcl/lcl"
"time"
)

//资源目录,内置到执行程序中
// 资源目录,内置到执行程序中
//
//go:embed resources
var resources embed.FS

//这个示例使用了几个事件来演示下载文件
// 这个示例使用了几个事件来演示下载文件
func main() {
//全局初始化 每个应用都必须调用的
cef.GlobalInit(nil, &resources)
Expand All @@ -27,11 +27,6 @@ func main() {
//主窗口的配置
//指定一个URL地址,或本地html文件目录
cef.BrowserWindow.Config.Url = "http://localhost:22022/cookie.html"
if common.IsLinux() && cefApp.IsUIGtk3() {
cef.BrowserWindow.Config.IconFS = "resources/icon.png"
} else {
cef.BrowserWindow.Config.IconFS = "resources/icon.ico"
}

//监听获取cookie事件
ipc.On("VisitCookie", func(context context.IContext) {
Expand Down
Binary file removed example/cookie/resources/icon.ico
Binary file not shown.
Binary file removed example/cookie/resources/icon.png
Binary file not shown.
6 changes: 0 additions & 6 deletions example/custom-drag-window/custom_drag_window.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"embed"
"fmt"
"github.com/energye/energy/v2/cef"
"github.com/energye/energy/v2/common"
"github.com/energye/energy/v2/pkgs/assetserve"
)

Expand All @@ -15,11 +14,6 @@ func main() {
cef.GlobalInit(nil, &resources)
app := cef.NewApplication()
cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html"
if common.IsLinux() && app.IsUIGtk3() {
cef.BrowserWindow.Config.IconFS = "resources/icon.png"
} else {
cef.BrowserWindow.Config.IconFS = "resources/icon.ico"
}
cef.BrowserWindow.Config.Title = "ENERGY - Custom Drag Window"
cef.SetBrowserProcessStartAfterCallback(func(b bool) {
fmt.Println("主进程启动 创建一个内置http服务")
Expand Down
Binary file removed example/custom-drag-window/resources/icon.ico
Binary file not shown.
Binary file removed example/custom-drag-window/resources/icon.png
Binary file not shown.
3 changes: 2 additions & 1 deletion example/frameless/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
无边框可拖拽窗口
无边框可拖拽窗口
macos
29 changes: 29 additions & 0 deletions example/gpu/gpu.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https://www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------

package main

import (
"github.com/energye/energy/v2/cef"
)

func main() {
//全局初始化 每个应用都必须调用的
cef.GlobalInit(nil, nil)
//创建应用
app := cef.NewApplication()
// 启用GPU加速, 默认 energy 未开启GPU加速
// 使用测试网址 www.antutu.com/html5 在任务管理器中观察 CPU 和 GPU 使用情况
app.SetEnableGPU(true)
cef.BrowserWindow.Config.Url = "https://www.antutu.com/html5"
cef.BrowserWindow.Config.Title = "ENERGY GPU Test"
//运行应用
cef.Run(app)
}

0 comments on commit d0e18e8

Please sign in to comment.