Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
energye
energy
提交
301fd110
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,体验更适合开发者的 AI 搜索 >>
提交
301fd110
编写于
1月 06, 2023
作者:
yanghye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v2.2.3 Fixed Chinese input and gtk3 issues for linux packaging
上级
05c48954
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
48 addition
and
44 deletion
+48
-44
cef/cef-commponent-tray.go
cef/cef-commponent-tray.go
+12
-5
cef/cef-commponent-tray_window.go
cef/cef-commponent-tray_window.go
+22
-22
cef/window-component.go
cef/window-component.go
+3
-6
cef/window-component_windows.go
cef/window-component_windows.go
+5
-5
cef/window.go
cef/window.go
+1
-1
example/browser-linux/linux.go
example/browser-linux/linux.go
+1
-1
example/mini-browser/src/min-browser.go
example/mini-browser/src/min-browser.go
+4
-4
未找到文件。
cef/cef-commponent-tray.go
浏览文件 @
301fd110
...
...
@@ -18,6 +18,7 @@ type TMouseEvent func(sender lcl.IObject, button types.TMouseButton, shift types
type
ITray
interface
{
SetTitle
(
title
string
)
//设置标题
SetVisible
(
v
bool
)
//显示和隐藏托盘图标
Visible
()
bool
//
Show
()
//显示托盘菜单窗口 windows有效
Hide
()
//隐藏托盘菜单窗口 windows有效
close
()
//关闭托盘菜单窗口 windows有效
...
...
@@ -35,17 +36,16 @@ type ITray interface {
//系统托盘
type
Tray
struct
{
owner
lcl
.
I
WinControl
owner
lcl
.
I
Component
trayIcon
*
lcl
.
TTrayIcon
popupMenu
*
lcl
.
TPopupMenu
}
//创建系统托盘
func
newTray
(
owner
lcl
.
I
WinControl
)
*
Tray
{
func
newTray
(
owner
lcl
.
I
Component
)
*
Tray
{
trayIcon
:=
lcl
.
NewTrayIcon
(
owner
)
popupMenu
:=
lcl
.
NewPopupMenu
(
owner
)
popupMenu
:=
lcl
.
NewPopupMenu
(
trayIcon
)
trayIcon
.
SetPopupMenu
(
popupMenu
)
trayIcon
.
SetHint
(
owner
.
Caption
())
trayIcon
.
SetVisible
(
true
)
return
&
Tray
{
owner
:
owner
,
...
...
@@ -62,11 +62,18 @@ func (m *Tray) SetVisible(v bool) {
m
.
trayIcon
.
SetVisible
(
v
)
}
func
(
m
*
Tray
)
Visible
()
bool
{
return
m
.
trayIcon
.
Visible
()
}
func
(
m
*
Tray
)
Show
()
{
m
.
SetVisible
(
true
)
}
func
(
m
*
Tray
)
Hide
()
{
m
.
SetVisible
(
false
)
}
func
(
m
*
Tray
)
close
()
{}
func
(
m
*
Tray
)
SetOnDblClick
(
fn
lcl
.
TNotifyEvent
)
{
...
...
@@ -123,7 +130,7 @@ func (m *Tray) ShowBalloon() {
//创建一个菜单,还未添加到托盘
func
(
m
*
Tray
)
NewMenuItem
(
caption
string
,
onClick
func
(
lcl
.
IObject
))
*
lcl
.
TMenuItem
{
item
:=
lcl
.
NewMenuItem
(
m
.
owner
)
item
:=
lcl
.
NewMenuItem
(
m
.
trayIcon
)
item
.
SetCaption
(
caption
)
if
onClick
!=
nil
{
item
.
SetOnClick
(
onClick
)
...
...
cef/cef-commponent-tray_window.go
浏览文件 @
301fd110
...
...
@@ -22,7 +22,7 @@ import (
)
//Cef托盘
type
tCefTrayForm
struct
{
type
t
LCL
CefTrayForm
struct
{
*
lcl
.
TForm
owner
lcl
.
IComponent
trayIcon
*
lcl
.
TTrayIcon
...
...
@@ -34,8 +34,8 @@ type tCefTrayForm struct {
url
string
}
func
new
CefTray
(
owner
lcl
.
IComponent
,
width
,
height
int32
,
url
string
)
*
t
CefTrayForm
{
var
trayForm
*
tCefTrayForm
func
new
LCLCefTray
(
owner
lcl
.
IComponent
,
width
,
height
int32
,
url
string
)
*
tLCL
CefTrayForm
{
var
trayForm
*
t
LCL
CefTrayForm
lcl
.
Application
.
CreateForm
(
&
trayForm
)
trayForm
.
trayIcon
=
lcl
.
NewTrayIcon
(
owner
)
trayForm
.
trayIcon
.
SetVisible
(
true
)
...
...
@@ -50,26 +50,26 @@ func newCefTray(owner lcl.IComponent, width, height int32, url string) *tCefTray
return
trayForm
}
func
(
m
*
tCefTrayForm
)
OnFormCreate
(
sender
lcl
.
IObject
)
{
func
(
m
*
t
LCL
CefTrayForm
)
OnFormCreate
(
sender
lcl
.
IObject
)
{
m
.
SetShowInTaskBar
(
types
.
StNever
)
}
func
(
m
*
tCefTrayForm
)
Tray
()
*
Tray
{
func
(
m
*
t
LCL
CefTrayForm
)
Tray
()
*
Tray
{
return
nil
}
func
(
m
*
tCefTrayForm
)
Show
()
{
func
(
m
*
t
LCL
CefTrayForm
)
Show
()
{
if
BrowserWindow
.
mainBrowserWindow
.
Chromium
()
==
nil
||
!
BrowserWindow
.
mainBrowserWindow
.
Chromium
()
.
Initialized
()
{
return
}
m
.
TForm
.
Show
()
}
func
(
m
*
tCefTrayForm
)
Hide
()
{
func
(
m
*
t
LCL
CefTrayForm
)
Hide
()
{
m
.
TForm
.
Hide
()
}
func
(
m
*
tCefTrayForm
)
close
()
{
func
(
m
*
t
LCL
CefTrayForm
)
close
()
{
if
m
.
isClosing
{
return
}
...
...
@@ -77,41 +77,41 @@ func (m *tCefTrayForm) close() {
m
.
TForm
.
Close
()
}
func
(
m
*
tCefTrayForm
)
SetOnDblClick
(
fn
lcl
.
TNotifyEvent
)
{
func
(
m
*
t
LCL
CefTrayForm
)
SetOnDblClick
(
fn
lcl
.
TNotifyEvent
)
{
m
.
trayIcon
.
SetOnDblClick
(
fn
)
}
func
(
m
*
tCefTrayForm
)
SetOnClick
(
fn
lcl
.
TNotifyEvent
)
{
func
(
m
*
t
LCL
CefTrayForm
)
SetOnClick
(
fn
lcl
.
TNotifyEvent
)
{
m
.
trayIcon
.
SetOnClick
(
fn
)
}
func
(
m
*
tCefTrayForm
)
SetOnMouseUp
(
fn
TMouseEvent
)
{
func
(
m
*
t
LCL
CefTrayForm
)
SetOnMouseUp
(
fn
TMouseEvent
)
{
m
.
mouseUp
=
fn
}
func
(
m
*
tCefTrayForm
)
SetOnMouseDown
(
fn
lcl
.
TMouseEvent
)
{
func
(
m
*
t
LCL
CefTrayForm
)
SetOnMouseDown
(
fn
lcl
.
TMouseEvent
)
{
m
.
trayIcon
.
SetOnMouseDown
(
fn
)
}
func
(
m
*
tCefTrayForm
)
SetOnMouseMove
(
fn
lcl
.
TMouseMoveEvent
)
{
func
(
m
*
t
LCL
CefTrayForm
)
SetOnMouseMove
(
fn
lcl
.
TMouseMoveEvent
)
{
m
.
trayIcon
.
SetOnMouseMove
(
fn
)
}
func
(
m
*
tCefTrayForm
)
Visible
()
bool
{
func
(
m
*
t
LCL
CefTrayForm
)
Visible
()
bool
{
return
m
.
TForm
.
Visible
()
}
func
(
m
*
tCefTrayForm
)
SetVisible
(
v
bool
)
{
func
(
m
*
t
LCL
CefTrayForm
)
SetVisible
(
v
bool
)
{
m
.
trayIcon
.
SetVisible
(
v
)
}
func
(
m
*
tCefTrayForm
)
SetHint
(
value
string
)
{
func
(
m
*
t
LCL
CefTrayForm
)
SetHint
(
value
string
)
{
m
.
trayIcon
.
SetHint
(
value
)
}
func
(
m
*
tCefTrayForm
)
SetTitle
(
title
string
)
{
func
(
m
*
t
LCL
CefTrayForm
)
SetTitle
(
title
string
)
{
m
.
TForm
.
SetCaption
(
title
)
}
func
(
m
*
tCefTrayForm
)
onmMouse
()
{
func
(
m
*
t
LCL
CefTrayForm
)
onmMouse
()
{
QueueAsyncCall
(
func
(
id
int
)
{
m
.
trayIcon
.
SetOnMouseUp
(
func
(
sender
lcl
.
IObject
,
button
types
.
TMouseButton
,
shift
types
.
TShiftState
,
x
,
y
int32
)
{
var
monitor
=
m
.
TForm
.
Monitor
()
...
...
@@ -148,7 +148,7 @@ func (m *tCefTrayForm) onmMouse() {
//title 气泡标题
//content 气泡内容
//timeout 显示时间(毫秒)
func
(
m
*
tCefTrayForm
)
SetBalloon
(
title
,
content
string
,
timeout
int32
)
ITray
{
func
(
m
*
t
LCL
CefTrayForm
)
SetBalloon
(
title
,
content
string
,
timeout
int32
)
ITray
{
m
.
trayIcon
.
SetBalloonTitle
(
title
)
m
.
trayIcon
.
SetBalloonHint
(
content
)
m
.
trayIcon
.
SetBalloonTimeout
(
timeout
)
...
...
@@ -156,11 +156,11 @@ func (m *tCefTrayForm) SetBalloon(title, content string, timeout int32) ITray {
}
//显示托盘气泡
func
(
m
*
tCefTrayForm
)
ShowBalloon
()
{
func
(
m
*
t
LCL
CefTrayForm
)
ShowBalloon
()
{
m
.
trayIcon
.
ShowBalloonHint
()
}
func
(
m
*
tCefTrayForm
)
createCefTrayWindow
()
{
func
(
m
*
t
LCL
CefTrayForm
)
createCefTrayWindow
()
{
m
.
TForm
.
SetBorderStyle
(
types
.
BsNone
)
m
.
TForm
.
SetFormStyle
(
types
.
FsStayOnTop
)
m
.
TForm
.
SetBounds
(
-
(
m
.
w
*
2
),
-
(
m
.
h
*
2
),
m
.
w
,
m
.
h
)
...
...
@@ -249,6 +249,6 @@ func (m *tCefTrayForm) createCefTrayWindow() {
}
//设置托盘图标
func
(
m
*
tCefTrayForm
)
SetIcon
(
iconResourcePath
string
)
{
func
(
m
*
t
LCL
CefTrayForm
)
SetIcon
(
iconResourcePath
string
)
{
m
.
trayIcon
.
Icon
()
.
LoadFromFSFile
(
iconResourcePath
)
}
cef/window-component.go
浏览文件 @
301fd110
...
...
@@ -10,11 +10,8 @@ package cef
//适用于 windows linux macos 系统托盘
func
(
m
*
LCLBrowserWindow
)
NewTray
()
ITray
{
return
newTray
(
m
)
}
//适用于 windows linux macos 系统托盘
func
(
m
*
ViewsFrameworkBrowserWindow
)
NewTray
()
ITray
{
if
m
.
tray
==
nil
{
m
.
tray
=
newTray
(
m
.
TForm
)
}
return
m
.
tray
}
cef/window-component_windows.go
浏览文件 @
301fd110
...
...
@@ -13,13 +13,13 @@ package cef
//只适用于windows的无菜单托盘
func
(
m
*
LCLBrowserWindow
)
NewCefTray
(
width
,
height
int32
,
url
string
)
ITray
{
if
BrowserWindow
.
mainBrowserWindow
.
AsLCLBrowserWindow
()
==
nil
{
if
m
==
nil
{
return
nil
}
if
BrowserWindow
.
mainBrowserWindow
.
AsLCLBrowserWindow
()
.
BrowserWindow
()
.
tray
==
nil
{
BrowserWindow
.
mainBrowserWindow
.
AsLCLBrowserWindow
()
.
BrowserWindow
()
.
tray
=
new
CefTray
(
m
,
width
,
height
,
url
)
if
m
.
tray
==
nil
{
m
.
tray
=
newLCL
CefTray
(
m
,
width
,
height
,
url
)
}
return
BrowserWindow
.
mainBrowserWindow
.
AsLCLBrowserWindow
()
.
BrowserWindow
()
.
tray
return
m
.
tray
}
//只适用于windows的无菜单托盘
...
...
@@ -28,7 +28,7 @@ func (m *ViewsFrameworkBrowserWindow) NewCefTray(width, height int32, url string
return
nil
}
if
m
.
tray
==
nil
{
//m.tray = newCefTray(m.windowC
omponent, width, height, url)
m
.
tray
=
newLCLCefTray
(
m
.
c
omponent
,
width
,
height
,
url
)
}
return
m
.
tray
}
cef/window.go
浏览文件 @
301fd110
...
...
@@ -81,7 +81,6 @@ type IBrowserWindow interface {
SetBounds
(
ALeft
int32
,
ATop
int32
,
AWidth
int32
,
AHeight
int32
)
SetCenterWindow
(
value
bool
)
NewCefTray
(
width
,
height
int32
,
url
string
)
ITray
NewTray
()
ITray
}
type
ILCLBrowserWindow
interface
{
...
...
@@ -99,6 +98,7 @@ type ILCLBrowserWindow interface {
DisableHelp
()
EnableSystemMenu
()
EnableHelp
()
NewTray
()
ITray
}
type
IViewsFrameworkBrowserWindow
interface
{
...
...
example/browser-linux/linux.go
浏览文件 @
301fd110
...
...
@@ -40,7 +40,7 @@ func main() {
popupWindow
.
SetCenterWindow
(
true
)
return
false
})
cefTray
(
window
.
AsViewsFrameworkBrowserWindow
()
.
BrowserWindow
()
)
cefTray
(
window
)
})
//在主进程启动成功之后执行
//在这里启动内置http服务
...
...
example/mini-browser/src/min-browser.go
浏览文件 @
301fd110
...
...
@@ -387,15 +387,15 @@ func AppBrowserInit() {
//在这里创建 一些子窗口 子组件 等
//托盘
if
common
.
IsWindows
()
{
cefTray
(
browserWindow
)
cefTray
(
browserWindow
.
AsLCLBrowserWindow
()
)
}
else
{
tray
(
browserWindow
.
AsLCLBrowserWindow
()
.
BrowserWindow
()
)
tray
(
browserWindow
.
AsLCLBrowserWindow
())
}
})
}
// 托盘 只适用 windows 的系统托盘, 基于html 和 ipc 实现功能
func
cefTray
(
browserWindow
cef
.
IBrowserWindow
)
{
func
cefTray
(
browserWindow
cef
.
I
LCL
BrowserWindow
)
{
window
:=
browserWindow
.
AsLCLBrowserWindow
()
.
BrowserWindow
()
var
url
=
"http://localhost:22022/min-browser-tray.html"
tray
:=
browserWindow
.
NewCefTray
(
250
,
300
,
url
)
...
...
@@ -435,7 +435,7 @@ func cefTray(browserWindow cef.IBrowserWindow) {
}
// 托盘 系统原生 windows linux macos
func
tray
(
browserWindow
cef
.
IBrowserWindow
)
{
func
tray
(
browserWindow
cef
.
I
LCL
BrowserWindow
)
{
window
:=
browserWindow
.
AsLCLBrowserWindow
()
.
BrowserWindow
()
//托盘 windows linux macos 系统托盘
newTray
:=
browserWindow
.
NewTray
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录