Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
energye
energy
提交
edcf6031
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,发现更多精彩内容 >>
提交
edcf6031
编写于
12月 27, 2022
作者:
yanghye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ready to fix some problems on linux
上级
fd311cab
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
78 addition
and
18 deletion
+78
-18
cef/cef-application.go
cef/cef-application.go
+4
-0
cef/cef-browser-view-component.go
cef/cef-browser-view-component.go
+5
-1
cef/cef-chromium-proc.go
cef/cef-chromium-proc.go
+21
-0
cef/cef-proc-def.go
cef/cef-proc-def.go
+8
-0
cef/cef-types.go
cef/cef-types.go
+7
-0
cef/cef-window-component.go
cef/cef-window-component.go
+6
-2
example/browser-tiny/tiny.go
example/browser-tiny/tiny.go
+27
-15
未找到文件。
cef/cef-application.go
浏览文件 @
edcf6031
...
...
@@ -79,6 +79,10 @@ func (m *TCEFApplication) RunMessageLoop() {
Proc
(
internale_CEFApplication_RunMessageLoop
)
.
Call
()
}
func
(
m
*
TCEFApplication
)
QuitMessageLoop
()
{
Proc
(
internale_CEFApplication_QuitMessageLoop
)
.
Call
()
}
func
(
m
*
TCEFApplication
)
StopScheduler
()
{
Proc
(
internale_CEFApplication_StopScheduler
)
.
Call
()
}
...
...
cef/cef-browser-view-component.go
浏览文件 @
edcf6031
...
...
@@ -13,7 +13,7 @@ type TCEFBrowserViewComponent struct {
instance
unsafe
.
Pointer
}
func
NewBrowserViewComponent
(
AOwner
lcl
.
T
Component
)
*
TCEFBrowserViewComponent
{
func
NewBrowserViewComponent
(
AOwner
lcl
.
I
Component
)
*
TCEFBrowserViewComponent
{
r1
,
_
,
_
:=
Proc
(
internale_CEFBrowserViewComponent_Create
)
.
Call
(
lcl
.
CheckPtr
(
AOwner
))
return
&
TCEFBrowserViewComponent
{
instance
:
unsafe
.
Pointer
(
r1
),
...
...
@@ -44,6 +44,10 @@ func (m *TCEFBrowserViewComponent) CreateBrowserView(client *ICefClient, url str
Proc
(
internale_CEFBrowserViewComponent_CreateBrowserView
)
.
Call
(
uintptr
(
m
.
instance
),
uintptr
(
client
.
instance
),
api
.
PascalStr
(
url
),
uintptr
(
unsafe
.
Pointer
(
&
contextSettingsPtr
)),
uintptr
(
unsafe
.
Pointer
(
&
browserSettingsPtr
)),
uintptr
(
argsLen
),
uintptr
(
dataBytesPtr
),
uintptr
(
dataBytesLen
))
}
func
(
m
*
TCEFBrowserViewComponent
)
Instance
()
uintptr
{
return
uintptr
(
m
.
instance
)
}
func
(
m
*
TCEFBrowserViewComponent
)
GetForBrowser
(
browser
*
ICefBrowser
)
{
Proc
(
internale_CEFBrowserViewComponent_CreateBrowserView
)
.
Call
(
uintptr
(
m
.
instance
),
uintptr
(
browser
.
Identifier
()))
}
...
...
cef/cef-chromium-proc.go
浏览文件 @
edcf6031
...
...
@@ -38,6 +38,7 @@ type IChromiumProc interface {
ResetZoomLevel
()
CloseAllBrowsers
()
CreateBrowser
(
window
ITCefWindow
)
bool
CreateBrowserByBrowserViewComponent
(
homePage
string
,
browserViewComponent
*
TCEFBrowserViewComponent
)
bool
Initialized
()
bool
BrowserId
()
int32
IsSameBrowser
(
browser
*
ICefBrowser
)
bool
...
...
@@ -67,6 +68,7 @@ type IChromiumProc interface {
SetFocus
(
value
bool
)
SendCaptureLostEvent
()
FrameIsFocused
()
bool
TryCloseBrowser
()
bool
}
func
(
m
*
TCEFChromium
)
IsValid
()
bool
{
...
...
@@ -173,6 +175,10 @@ func (m *TCEFChromium) CreateBrowser(window ITCefWindow) bool {
return
false
}
func
(
m
*
TCEFChromium
)
CreateBrowserByBrowserViewComponent
(
homePage
string
,
browserViewComponent
*
TCEFBrowserViewComponent
)
bool
{
return
_CEFChromium_CreateBrowserByBrowserViewComponent
(
m
.
Instance
(),
api
.
PascalStr
(
homePage
),
browserViewComponent
.
Instance
())
}
func
(
m
*
TCEFChromium
)
Initialized
()
bool
{
return
_CEFChromium_Initialized
(
m
.
Instance
())
}
...
...
@@ -322,6 +328,10 @@ func (m *TCEFChromium) FrameIsFocused() bool {
return
api
.
GoBool
(
_CEFChromium_FrameIsFocused
(
m
.
Instance
()))
}
func
(
m
*
TCEFChromium
)
TryCloseBrowser
()
bool
{
return
api
.
GoBool
(
_CEFChromium_TryCloseBrowser
(
m
.
Instance
()))
}
//--------TCEFChromium proc begin--------
// TCEFChromium _CEFChromium_Create
...
...
@@ -392,6 +402,12 @@ func _CEFChromium_CreateBrowseByLinkedWindow(instance, window uintptr) bool {
return
api
.
GoBool
(
r1
)
}
// TCEFChromium _CEFChromium_CreateBrowserByBrowserViewComponent
func
_CEFChromium_CreateBrowserByBrowserViewComponent
(
instance
,
homePage
,
browserViewComponent
uintptr
)
bool
{
r1
,
_
,
_
:=
Proc
(
internale_CEFChromium_CreateBrowserByBrowserViewComponent
)
.
Call
(
instance
,
homePage
,
browserViewComponent
)
return
api
.
GoBool
(
r1
)
}
// TCEFChromium _CEFChromium_Initialized
func
_CEFChromium_Initialized
(
instance
uintptr
)
bool
{
r1
,
_
,
_
:=
Proc
(
internale_CEFChromium_Initialized
)
.
Call
(
instance
)
...
...
@@ -576,4 +592,9 @@ func _CEFChromium_FrameIsFocused(instance uintptr) uintptr {
return
r1
}
func
_CEFChromium_TryCloseBrowser
(
instance
uintptr
)
uintptr
{
r1
,
_
,
_
:=
Proc
(
internale_CEFChromium_TryCloseBrowser
)
.
Call
(
instance
)
return
r1
}
//--------TCEFChromium proc end--------
cef/cef-proc-def.go
浏览文件 @
edcf6031
...
...
@@ -34,6 +34,7 @@ func init() {
dllimports
.
NewEnergyImport
(
"AddCustomCommandLine"
,
0
),
//application
dllimports
.
NewEnergyImport
(
"CEFApplication_RunMessageLoop"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFApplication_QuitMessageLoop"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFApplication_Create"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFApplication_Destroy"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFApplication_Free"
,
0
),
...
...
@@ -238,6 +239,7 @@ func init() {
dllimports
.
NewEnergyImport
(
"CEFChromium_CloseAllBrowsers"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFChromium_CreateBrowserByWindow"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFChromium_CreateBrowserByLinkedWindow"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFChromium_CreateBrowserByBrowserViewComponent"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFChromium_Initialized"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFChromium_GetBrowserId"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFChromium_IsSameBrowser"
,
0
),
...
...
@@ -266,6 +268,7 @@ func init() {
dllimports
.
NewEnergyImport
(
"CEFChromium_SetFocus"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFChromium_SendCaptureLostEvent"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFChromium_FrameIsFocused"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFChromium_TryCloseBrowser"
,
0
),
//ICefBeforeDownloadCallback
dllimports
.
NewEnergyImport
(
"CEFChromium_SetDownloadPath"
,
0
),
//ICefFrame
...
...
@@ -383,6 +386,7 @@ func init() {
dllimports
.
NewEnergyImport
(
"CEFWindowComponent_IsFullscreen"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFWindowComponent_IsMaximized"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFWindowComponent_IsMinimized"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFWindowComponent_AddChildView"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFWindowComponent_SetOnWindowCreated"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFWindowComponent_SetOnWindowDestroyed"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFWindowComponent_SetOnWindowActivationChanged"
,
0
),
...
...
@@ -436,6 +440,7 @@ const (
internale_AddCustomCommandLine
//application
internale_CEFApplication_RunMessageLoop
internale_CEFApplication_QuitMessageLoop
internale_CEFApplication_Create
internale_CEFApplication_Destroy
internale_CEFApplication_Free
...
...
@@ -641,6 +646,7 @@ const (
internale_CEFChromium_CloseAllBrowsers
internale_CEFChromium_CreateBrowserByWindow
internale_CEFChromium_CreateBrowserByLinkedWindow
internale_CEFChromium_CreateBrowserByBrowserViewComponent
internale_CEFChromium_Initialized
internale_CEFChromium_GetBrowserId
internale_CEFChromium_IsSameBrowser
...
...
@@ -669,6 +675,7 @@ const (
internale_CEFChromium_SetFocus
internale_CEFChromium_SendCaptureLostEvent
internale_CEFChromium_FrameIsFocused
internale_CEFChromium_TryCloseBrowser
//ICefBeforeDownloadCallback
internale_CEFChromium_SetDownloadPath
//ICefFrame
...
...
@@ -786,6 +793,7 @@ const (
internale_CEFWindowComponent_IsFullscreen
internale_CEFWindowComponent_IsMaximized
internale_CEFWindowComponent_IsMinimized
internale_CEFWindowComponent_AddChildView
internale_CEFWindowComponent_SetOnWindowCreated
internale_CEFWindowComponent_SetOnWindowDestroyed
internale_CEFWindowComponent_SetOnWindowActivationChanged
...
...
cef/cef-types.go
浏览文件 @
edcf6031
...
...
@@ -206,6 +206,13 @@ type ICefClient struct {
instance
unsafe
.
Pointer
}
func
NewCefSize
(
width
,
height
int32
)
*
TCefSize
{
return
&
TCefSize
{
Width
:
width
,
Height
:
height
,
}
}
func
(
m
*
ICefWindow
)
SetWindow
(
window
*
ICefWindow
)
{
m
.
instance
=
window
.
instance
}
...
...
cef/cef-window-component.go
浏览文件 @
edcf6031
...
...
@@ -33,8 +33,8 @@ func (m *TCEFWindowComponent) Hide() {
Proc
(
internale_CEFWindowComponent_Hide
)
.
Call
(
uintptr
(
m
.
instance
))
}
func
(
m
*
TCEFWindowComponent
)
CenterWindow
(
size
TCefSize
)
{
Proc
(
internale_CEFWindowComponent_CenterWindow
)
.
Call
(
uintptr
(
m
.
instance
),
uintptr
(
unsafe
.
Pointer
(
&
size
)))
func
(
m
*
TCEFWindowComponent
)
CenterWindow
(
size
*
TCefSize
)
{
Proc
(
internale_CEFWindowComponent_CenterWindow
)
.
Call
(
uintptr
(
m
.
instance
),
uintptr
(
unsafe
.
Pointer
(
size
)))
}
func
(
m
*
TCEFWindowComponent
)
Close
()
{
...
...
@@ -179,6 +179,10 @@ func (m *TCEFWindowComponent) IsMinimized() bool {
return
api
.
GoBool
(
r1
)
}
func
(
m
*
TCEFWindowComponent
)
AddChildView
(
browserViewComponent
*
TCEFBrowserViewComponent
)
{
Proc
(
internale_CEFWindowComponent_AddChildView
)
.
Call
(
uintptr
(
m
.
instance
),
browserViewComponent
.
Instance
())
}
func
(
m
*
TCEFWindowComponent
)
SetOnWindowCreated
(
fn
WindowComponentOnWindowCreated
)
{
Proc
(
internale_CEFWindowComponent_SetOnWindowCreated
)
.
Call
(
uintptr
(
m
.
instance
),
api
.
MakeEventDataPtr
(
fn
))
}
...
...
example/browser-tiny/tiny.go
浏览文件 @
edcf6031
...
...
@@ -18,31 +18,43 @@ func main() {
//config.SetChromeRuntime(true)
application
:=
cef
.
NewCEFApplication
(
config
)
application
.
SetOnContextInitialized
(
func
()
{
fmt
.
Println
(
"OnContextInitialized()"
)
component
:=
lcl
.
NewComponent
(
nil
)
fmt
.
Println
(
"OnContextInitialized("
,
component
)
chromiumConfig
:=
cef
.
NewChromiumConfig
()
chromium
:=
cef
.
NewChromium
(
component
,
chromiumConfig
)
chromium
.
SetOnBeforeClose
(
func
(
sender
lcl
.
IObject
,
browser
*
cef
.
ICefBrowser
)
{
fmt
.
Println
(
"OnBeforeClose"
)
application
.
QuitMessageLoop
()
})
chromium
.
SetOnTitleChange
(
func
(
sender
lcl
.
IObject
,
browser
*
cef
.
ICefBrowser
,
title
string
)
{
fmt
.
Println
(
"OnTitleChange"
,
title
)
})
browserViewComponent
:=
cef
.
NewBrowserViewComponent
(
component
)
windowComponent
:=
cef
.
NewWindowComponent
(
component
)
windowComponent
.
SetOnWindowCreated
(
func
(
sender
lcl
.
IObject
,
window
*
cef
.
ICefWindow
)
{
fmt
.
Println
(
"OnWindowCreated"
)
b
:=
chromium
.
CreateBrowserByBrowserViewComponent
(
"https://www.baidu.com"
,
browserViewComponent
)
fmt
.
Println
(
"
\t
CreateBrowserByBrowserViewComponent"
,
b
)
windowComponent
.
AddChildView
(
browserViewComponent
)
windowComponent
.
CenterWindow
(
cef
.
NewCefSize
(
1024
,
768
))
browserViewComponent
.
RequestFocus
()
windowComponent
.
Show
()
})
windowComponent
.
SetOnCanClose
(
func
(
sender
lcl
.
IObject
,
window
*
cef
.
ICefWindow
,
aResult
*
bool
)
{
fmt
.
Println
(
"OnCanClose"
)
chromium
.
TryCloseBrowser
()
})
windowComponent
.
CreateTopLevelWindow
()
})
application
.
SetOnGetDefaultClient
(
func
(
client
*
cef
.
ICefClient
)
{
fmt
.
Println
(
"OnGetDefaultClient"
)
})
//chromiumConfig := cef.NewChromiumConfig()
//chromium := cef.NewChromium(component, chromiumConfig)
//chromium.SetOnBeforeClose(func(sender lcl.IObject, browser *cef.ICefBrowser) {
// fmt.Println("OnBeforeClose")
//})
//
//windowComponent := cef.NewWindowComponent(component)
//windowComponent.SetOnWindowCreated(func(sender lcl.IObject, window *cef.ICefWindow) {
// fmt.Println("OnWindowCreated")
//})
//windowComponent.SetOnGetInitialBounds(func(sender lcl.IObject, window *cef.ICefWindow, aResult *cef.TCefRect) {
// fmt.Println("OnGetInitialBounds")
//})
process
:=
application
.
StartMainProcess
()
fmt
.
Println
(
"application.StartMainProcess()"
,
process
)
if
process
{
fmt
.
Println
(
"application.RunMessageLoop()"
)
application
.
RunMessageLoop
()
}
fmt
.
Println
(
"end"
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录