Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
energye
energy
提交
205a2846
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,发现更多精彩内容 >>
提交
205a2846
编写于
1月 09, 2023
作者:
yanghye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v2.2.20 Fixed Chinese input and gtk3 issues for linux packagin
上级
0110b6f5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
93 addition
and
90 deletion
+93
-90
cef/cef-aux-dev-tools-window.go
cef/cef-aux-dev-tools-window.go
+5
-5
cef/cef-browser-window.go
cef/cef-browser-window.go
+2
-2
cef/cef-events-callback.go
cef/cef-events-callback.go
+6
-0
cef/cef-lcl-browser-window.go
cef/cef-lcl-browser-window.go
+4
-2
cef/cef-views-frame-commponent-tray_windows.go
cef/cef-views-frame-commponent-tray_windows.go
+65
-65
cef/cef-views-framework-browser-window.go
cef/cef-views-framework-browser-window.go
+7
-5
example/dev-test/vf-browser/vf-browser.go
example/dev-test/vf-browser/vf-browser.go
+4
-11
未找到文件。
cef/cef-aux-dev-tools-window.go
浏览文件 @
205a2846
...
...
@@ -84,8 +84,7 @@ func (m *ICefBrowser) createBrowserDevTools(browserWinInfo IBrowserWindow) {
devToolsWindow
.
putChromiumWindowInfo
()
devToolsWindow
.
defaultChromiumEvent
()
winAuxTools
.
devToolsWindow
.
Show
()
//明确的生成下一个窗体序号
BrowserWindow
.
setOrIncNextWindowNum
()
BrowserWindow
.
setOrIncNextWindowNum
()
//明确的生成下一个窗体序号
_CEFBrowser_ShowDevTools
(
devToolsWindow
.
chromium
.
Instance
(),
uintptr
(
m
.
Identifier
()),
devToolsWindow
.
windowParent
.
Instance
(),
api
.
PascalStr
(
dev_tools_name
))
})
}
else
if
browserWinInfo
.
IsViewsFramework
()
{
...
...
@@ -98,9 +97,10 @@ func (m *ICefBrowser) createBrowserDevTools(browserWinInfo IBrowserWindow) {
devToolsWindow
:=
NewViewsFrameworkBrowserWindow
(
nil
,
wp
,
BrowserWindow
.
MainWindow
()
.
AsViewsFrameworkBrowserWindow
()
.
Component
())
devToolsWindow
.
ResetWindowPropertyForEvent
()
devToolsWindow
.
SetWindowType
(
WT_DEV_TOOLS
)
devToolsWindow
.
windowId
=
BrowserWindow
.
GetNextWindowNum
()
devToolsWindow
.
putChromiumWindowInfo
()
devToolsWindow
.
registerDefaultEvent
()
//devToolsWindow.windowId = BrowserWindow.GetNextWindowNum()
//devToolsWindow.putChromiumWindowInfo()
//devToolsWindow.registerDefaultEvent()
BrowserWindow
.
setOrIncNextWindowNum
()
//明确的生成下一个窗口序号
devToolsWindow
.
windowComponent
.
CreateTopLevelWindow
()
}
}
...
...
cef/cef-browser-window.go
浏览文件 @
205a2846
...
...
@@ -79,8 +79,8 @@ type BrowserEvent struct {
onKeyEvent
ChromiumEventOnKeyEvent
//default can cover
onProcessMessageReceived
BrowseProcessMessageReceived
//default
onTitleChange
ChromiumEventOnTitleChange
//default
onContextMenuCommand
ChromiumEventOnContextMenuCommand
//default
onBeforeContextMenu
ChromiumEventOnBeforeContextMenu
//default
onContextMenuCommand
ChromiumEventOnContextMenuCommand
//default
can cover
onBeforeContextMenu
ChromiumEventOnBeforeContextMenu
//default
can cover
onBeforeResourceLoad
ChromiumEventOnBeforeResourceLoad
//default
}
...
...
cef/cef-events-callback.go
浏览文件 @
205a2846
...
...
@@ -12,6 +12,7 @@ import (
.
"github.com/energye/energy/common"
.
"github.com/energye/energy/consts"
"github.com/energye/energy/ipc"
"github.com/energye/energy/logger"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/api"
"github.com/energye/golcl/lcl/rtl"
...
...
@@ -274,6 +275,11 @@ func chromiumOnBeforeContextMenu(sender lcl.IObject, browser *ICefBrowser, frame
}
func
chromiumOnContextMenuCommand
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
,
params
*
ICefContextMenuParams
,
commandId
MenuId
,
eventFlags
uint32
,
result
*
bool
)
{
defer
func
()
{
if
err
:=
recover
();
err
!=
nil
{
logger
.
Error
(
"OnContextMenuCommand Error:"
,
err
)
}
}()
*
result
=
true
if
commandId
==
backId
{
browser
.
GoBack
()
...
...
cef/cef-lcl-browser-window.go
浏览文件 @
205a2846
...
...
@@ -824,15 +824,17 @@ func (m *LCLBrowserWindow) registerDefaultEvent() {
}
})
m
.
chromium
.
SetOnBeforeContextMenu
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
,
params
*
ICefContextMenuParams
,
model
*
ICefMenuModel
)
{
chromiumOnBeforeContextMenu
(
sender
,
browser
,
frame
,
params
,
model
)
if
bwEvent
.
onBeforeContextMenu
!=
nil
{
bwEvent
.
onBeforeContextMenu
(
sender
,
browser
,
frame
,
params
,
model
)
}
else
{
chromiumOnBeforeContextMenu
(
sender
,
browser
,
frame
,
params
,
model
)
}
})
m
.
chromium
.
SetOnContextMenuCommand
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
,
params
*
ICefContextMenuParams
,
commandId
consts
.
MenuId
,
eventFlags
uint32
,
result
*
bool
)
{
chromiumOnContextMenuCommand
(
sender
,
browser
,
frame
,
params
,
commandId
,
eventFlags
,
result
)
if
bwEvent
.
onContextMenuCommand
!=
nil
{
bwEvent
.
onContextMenuCommand
(
sender
,
browser
,
frame
,
params
,
commandId
,
eventFlags
,
result
)
}
else
{
chromiumOnContextMenuCommand
(
sender
,
browser
,
frame
,
params
,
commandId
,
eventFlags
,
result
)
}
})
m
.
chromium
.
SetOnFrameCreated
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
)
{
...
...
cef/cef-views-frame-commponent-tray_windows.go
浏览文件 @
205a2846
...
...
@@ -47,8 +47,6 @@ func newViewsFrameTray(owner lcl.IComponent, width, height int32, url string) *t
wp
.
CenterWindow
=
false
tray
.
trayWindow
=
NewViewsFrameworkBrowserWindow
(
cc
,
wp
)
tray
.
trayWindow
.
ResetWindowPropertyForEvent
()
tray
.
trayWindow
.
windowId
=
BrowserWindow
.
GetNextWindowNum
()
tray
.
trayWindow
.
putChromiumWindowInfo
()
tray
.
trayIcon
=
lcl
.
NewTrayIcon
(
owner
)
tray
.
trayIcon
.
SetVisible
(
true
)
tray
.
x
=
wp
.
X
...
...
@@ -60,73 +58,20 @@ func newViewsFrameTray(owner lcl.IComponent, width, height int32, url string) *t
return
tray
}
func
(
m
*
tViewsFrameTrayWindow
)
Tray
()
*
Tray
{
return
nil
}
func
(
m
*
tViewsFrameTrayWindow
)
Show
()
{
m
.
trayWindow
.
Show
()
}
func
(
m
*
tViewsFrameTrayWindow
)
Hide
()
{
m
.
trayWindow
.
Hide
()
}
func
(
m
*
tViewsFrameTrayWindow
)
close
()
{
if
m
.
isClosing
{
return
}
m
.
trayIcon
.
SetVisible
(
false
)
m
.
Hide
()
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnDblClick
(
fn
lcl
.
TNotifyEvent
)
{
m
.
trayIcon
.
SetOnDblClick
(
fn
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnClick
(
fn
lcl
.
TNotifyEvent
)
{
m
.
trayIcon
.
SetOnClick
(
fn
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnMouseUp
(
fn
TMouseEvent
)
{
m
.
mouseUp
=
fn
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnMouseDown
(
fn
lcl
.
TMouseEvent
)
{
m
.
trayIcon
.
SetOnMouseDown
(
fn
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnMouseMove
(
fn
lcl
.
TMouseMoveEvent
)
{
m
.
trayIcon
.
SetOnMouseMove
(
fn
)
}
func
(
m
*
tViewsFrameTrayWindow
)
Visible
()
bool
{
return
false
}
func
(
m
*
tViewsFrameTrayWindow
)
SetVisible
(
v
bool
)
{
m
.
trayIcon
.
SetVisible
(
v
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetHint
(
value
string
)
{
m
.
trayIcon
.
SetHint
(
value
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetTitle
(
title
string
)
{
}
func
(
m
*
tViewsFrameTrayWindow
)
registerMouseEvent
()
{
m
.
trayWindow
.
WindowComponent
()
.
SetOnWindowActivationChanged
(
func
(
sender
lcl
.
IObject
,
window
*
ICefWindow
,
active
bool
)
{
if
active
{
m
.
trayWindow
.
Show
()
}
else
{
m
.
trayWindow
.
Hide
()
}
})
var
I
sCreateTopLevelWindow
=
true
var
i
sCreateTopLevelWindow
=
true
m
.
trayIcon
.
SetOnMouseUp
(
func
(
sender
lcl
.
IObject
,
button
types
.
TMouseButton
,
shift
types
.
TShiftState
,
x
,
y
int32
)
{
if
IsCreateTopLevelWindow
{
IsCreateTopLevelWindow
=
false
if
isCreateTopLevelWindow
{
isCreateTopLevelWindow
=
false
//m.trayWindow.windowId = BrowserWindow.GetNextWindowNum()
//m.trayWindow.putChromiumWindowInfo()
BrowserWindow
.
setOrIncNextWindowNum
()
//明确的生成下一个窗口序号
m
.
trayWindow
.
CreateTopLevelWindow
()
m
.
trayWindow
.
HideTitle
()
m
.
trayWindow
.
SetNotInTaskBar
()
...
...
@@ -167,10 +112,10 @@ func (m *tViewsFrameTrayWindow) registerChromiumEvent() {
m
.
trayWindow
.
Chromium
()
.
SetOnBeforeContextMenu
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
,
params
*
ICefContextMenuParams
,
model
*
ICefMenuModel
)
{
model
.
Clear
()
})
m
.
trayWindow
.
Chromium
()
.
SetOnBeforeBrowser
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
)
bool
{
BrowserWindow
.
setOrIncNextWindowNum
(
browser
.
Identifier
()
+
1
)
return
false
})
//
m.trayWindow.Chromium().SetOnBeforeBrowser(func(sender lcl.IObject, browser *ICefBrowser, frame *ICefFrame) bool {
//
BrowserWindow.setOrIncNextWindowNum(browser.Identifier() + 1)
//
return false
//
})
m
.
trayWindow
.
Chromium
()
.
SetOnBeforeResourceLoad
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
,
request
*
ICefRequest
,
callback
*
ICefCallback
,
result
*
consts
.
TCefReturnValue
)
{
if
assetserve
.
AssetsServerHeaderKeyValue
!=
""
{
request
.
SetHeaderByName
(
assetserve
.
AssetsServerHeaderKeyName
,
assetserve
.
AssetsServerHeaderKeyValue
,
true
)
...
...
@@ -185,6 +130,61 @@ func (m *tViewsFrameTrayWindow) registerChromiumEvent() {
})
}
func
(
m
*
tViewsFrameTrayWindow
)
Tray
()
*
Tray
{
return
nil
}
func
(
m
*
tViewsFrameTrayWindow
)
Show
()
{
m
.
trayWindow
.
Show
()
}
func
(
m
*
tViewsFrameTrayWindow
)
Hide
()
{
m
.
trayWindow
.
Hide
()
}
func
(
m
*
tViewsFrameTrayWindow
)
close
()
{
if
m
.
isClosing
{
return
}
m
.
trayIcon
.
SetVisible
(
false
)
m
.
Hide
()
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnDblClick
(
fn
lcl
.
TNotifyEvent
)
{
m
.
trayIcon
.
SetOnDblClick
(
fn
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnClick
(
fn
lcl
.
TNotifyEvent
)
{
m
.
trayIcon
.
SetOnClick
(
fn
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnMouseUp
(
fn
TMouseEvent
)
{
m
.
mouseUp
=
fn
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnMouseDown
(
fn
lcl
.
TMouseEvent
)
{
m
.
trayIcon
.
SetOnMouseDown
(
fn
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetOnMouseMove
(
fn
lcl
.
TMouseMoveEvent
)
{
m
.
trayIcon
.
SetOnMouseMove
(
fn
)
}
func
(
m
*
tViewsFrameTrayWindow
)
Visible
()
bool
{
return
false
}
func
(
m
*
tViewsFrameTrayWindow
)
SetVisible
(
v
bool
)
{
m
.
trayIcon
.
SetVisible
(
v
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetHint
(
value
string
)
{
m
.
trayIcon
.
SetHint
(
value
)
}
func
(
m
*
tViewsFrameTrayWindow
)
SetTitle
(
title
string
)
{
}
//设置托盘气泡
//title 气泡标题
//content 气泡内容
...
...
cef/cef-views-framework-browser-window.go
浏览文件 @
205a2846
...
...
@@ -9,7 +9,6 @@
package
cef
import
(
"fmt"
"github.com/energye/energy/common"
"github.com/energye/energy/common/assetserve"
"github.com/energye/energy/consts"
...
...
@@ -109,7 +108,7 @@ func (m *browser) appContextInitialized(app *TCEFApplication) {
}
})
vFrameBrowserWindow
.
ResetWindowPropertyForEvent
()
vFrameBrowserWindow
.
SetWindowType
(
consts
.
WT_
POPUP_SUB
_BROWSER
)
vFrameBrowserWindow
.
SetWindowType
(
consts
.
WT_
MAIN
_BROWSER
)
vFrameBrowserWindow
.
windowId
=
BrowserWindow
.
GetNextWindowNum
()
vFrameBrowserWindow
.
putChromiumWindowInfo
()
vFrameBrowserWindow
.
registerPopupEvent
()
...
...
@@ -229,16 +228,20 @@ func (m *ViewsFrameworkBrowserWindow) registerDefaultEvent() {
callback
.
Cont
(
consts
.
ExePath
+
consts
.
Separator
+
suggestedName
,
true
)
}
})
//事件可以覆盖
m
.
chromium
.
SetOnBeforeContextMenu
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
,
params
*
ICefContextMenuParams
,
model
*
ICefMenuModel
)
{
chromiumOnBeforeContextMenu
(
sender
,
browser
,
frame
,
params
,
model
)
if
bwEvent
.
onBeforeContextMenu
!=
nil
{
bwEvent
.
onBeforeContextMenu
(
sender
,
browser
,
frame
,
params
,
model
)
}
else
{
chromiumOnBeforeContextMenu
(
sender
,
browser
,
frame
,
params
,
model
)
}
})
//事件可以覆盖
m
.
chromium
.
SetOnContextMenuCommand
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
,
params
*
ICefContextMenuParams
,
commandId
consts
.
MenuId
,
eventFlags
uint32
,
result
*
bool
)
{
chromiumOnContextMenuCommand
(
sender
,
browser
,
frame
,
params
,
commandId
,
eventFlags
,
result
)
if
bwEvent
.
onContextMenuCommand
!=
nil
{
bwEvent
.
onContextMenuCommand
(
sender
,
browser
,
frame
,
params
,
commandId
,
eventFlags
,
result
)
}
else
{
chromiumOnContextMenuCommand
(
sender
,
browser
,
frame
,
params
,
commandId
,
eventFlags
,
result
)
}
})
m
.
chromium
.
SetOnFrameCreated
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
)
{
...
...
@@ -285,7 +288,6 @@ func (m *ViewsFrameworkBrowserWindow) registerDefaultEvent() {
}
})
m
.
chromium
.
SetOnBeforeBrowser
(
func
(
sender
lcl
.
IObject
,
browser
*
ICefBrowser
,
frame
*
ICefFrame
)
bool
{
fmt
.
Println
(
"SetOnBeforeBrowser"
)
chromiumOnBeforeBrowser
(
browser
,
frame
)
if
bwEvent
.
onBeforeBrowser
!=
nil
{
return
bwEvent
.
onBeforeBrowser
(
sender
,
browser
,
frame
)
...
...
example/dev-test/vf-browser/v
iews-framework
.go
→
example/dev-test/vf-browser/v
f-browser
.go
浏览文件 @
205a2846
...
...
@@ -5,7 +5,6 @@ import (
"fmt"
"github.com/energye/energy/cef"
"github.com/energye/energy/common/assetserve"
"github.com/energye/energy/consts"
"github.com/energye/energy/ipc"
"github.com/energye/golcl/lcl"
)
...
...
@@ -35,12 +34,6 @@ func main() {
event
.
SetOnDraggableRegionsChanged
(
func
(
sender
lcl
.
IObject
,
browser
*
cef
.
ICefBrowser
,
frame
*
cef
.
ICefFrame
,
regions
*
cef
.
TCefDraggableRegions
)
{
fmt
.
Println
(
"SetOnDraggableRegionsChanged"
,
regions
.
RegionsCount
(),
"frame:"
,
frame
.
Id
,
frame
.
Url
)
})
event
.
SetOnBeforeContextMenu
(
func
(
sender
lcl
.
IObject
,
browser
*
cef
.
ICefBrowser
,
frame
*
cef
.
ICefFrame
,
params
*
cef
.
ICefContextMenuParams
,
model
*
cef
.
ICefMenuModel
)
{
model
.
AddCheckItem
(
model
.
CefMis
.
NextCommandId
(),
"测试"
)
})
event
.
SetOnContextMenuCommand
(
func
(
sender
lcl
.
IObject
,
browser
*
cef
.
ICefBrowser
,
frame
*
cef
.
ICefFrame
,
params
*
cef
.
ICefContextMenuParams
,
commandId
consts
.
MenuId
,
eventFlags
uint32
,
result
*
bool
)
{
fmt
.
Println
(
"SetOnContextMenuCommand"
,
commandId
)
})
event
.
SetOnBeforePopup
(
func
(
sender
lcl
.
IObject
,
browser
*
cef
.
ICefBrowser
,
frame
*
cef
.
ICefFrame
,
beforePopupInfo
*
cef
.
BeforePopupInfo
,
popupWindow
cef
.
IBrowserWindow
,
noJavascriptAccess
*
bool
)
bool
{
fmt
.
Println
(
"IsViewsFramework:"
,
popupWindow
.
IsViewsFramework
())
popupWindow
.
SetTitle
(
"修改了标题: "
+
beforePopupInfo
.
TargetUrl
)
...
...
@@ -61,13 +54,13 @@ func main() {
})
//设置隐藏窗口标题
//window.HideTitle()
cefTray
(
window
)
window
.
Show
()
fmt
.
Println
(
"SetBrowserInit 结束"
)
})
cef
.
BrowserWindow
.
SetBrowserInitAfter
(
func
(
window
cef
.
IBrowserWindow
)
{
bw
:=
window
.
AsViewsFrameworkBrowserWindow
()
.
BrowserWindow
()
fmt
.
Println
(
"handle"
,
bw
.
WindowComponent
()
.
WindowHandle
()
.
ToPtr
())
cefTray
(
window
)
})
//在主进程启动成功之后执行
//在这里启动内置http服务
...
...
@@ -99,11 +92,11 @@ func cefTray(browserWindow cef.IBrowserWindow) {
tray
.
SetOnClick
(
func
(
sender
lcl
.
IObject
)
{
s
=
!
s
if
s
{
browserWindow
.
ShowTitle
()
}
else
{
browserWindow
.
HideTitle
()
}
else
{
browserWindow
.
ShowTitle
()
}
//
browserWindow.Show()
browserWindow
.
Show
()
})
tray
.
SetBalloon
(
"气泡标题"
,
"气泡内容"
,
2000
)
ipc
.
IPC
.
Browser
()
.
On
(
"tray-show-balloon"
,
func
(
context
ipc
.
IIPCContext
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录