Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
energye
energy
提交
13528a2a
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,发现更多精彩内容 >>
提交
13528a2a
编写于
1月 18, 2023
作者:
yanghye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v2.3.26 Fixed Chinese input and gtk3 issues for linux packagin,
And Windows Drag Region
上级
f908c6d1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
68 addition
and
69 deletion
+68
-69
cef/cef-browser-main-window.go
cef/cef-browser-main-window.go
+1
-1
cef/cef-browser-window-lcl.go
cef/cef-browser-window-lcl.go
+35
-34
cef/cef-browser-window-lcl_windows.go
cef/cef-browser-window-lcl_windows.go
+26
-18
cef/cef-browser-window-views-framework_windows.go
cef/cef-browser-window-views-framework_windows.go
+2
-0
cef/cef-browser-window.go
cef/cef-browser-window.go
+3
-0
example/dev-test/lcl-browser/resources/index.html
example/dev-test/lcl-browser/resources/index.html
+1
-16
未找到文件。
cef/cef-browser-main-window.go
浏览文件 @
13528a2a
...
...
@@ -169,7 +169,7 @@ func (m *browserWindow) OnFormCreate(sender lcl.IObject) {
BrowserWindow
.
browserEvent
.
chromium
=
m
.
chromium
BrowserWindow
.
Config
.
browserWindowOnEventCallback
(
BrowserWindow
.
browserEvent
,
&
m
.
LCLBrowserWindow
)
}
//browserWindowOnEventCallback 执行完后,注册
windows消息事件
//browserWindowOnEventCallback 执行完后,注册
CompMsgEvent
m
.
registerWindowsCompMsgEvent
()
//主进程(主窗口)启动后回调函数事件
...
...
cef/cef-browser-window-lcl.go
浏览文件 @
13528a2a
...
...
@@ -38,31 +38,31 @@ type IBaseWindow interface {
//
//该窗口使用CEF和LCL组件实现,CEF<=1.106.xx版本 在windows、MacOSX可正常使用, Linux无法输入中文, CEF>=2.107.xx版本linux强制使用 ViewsFrameworkBrowserWindow 窗口组件
type
LCLBrowserWindow
struct
{
*
lcl
.
TForm
//
chromium
IChromium
//
browser
*
ICefBrowser
//
windowParent
ITCefWindowParent
//
windowProperty
*
WindowProperty
//
windowId
int32
//
windowType
consts
.
WINDOW_TYPE
//窗口类型
isClosing
bool
//
canClose
bool
//
onResize
TNotifyEvent
//
onActivate
TNotifyEvent
//
onShow
TNotifyEvent
//
on
Close
TCloseEvent
//
onClose
Query
TCloseQueryEvent
//
on
ActivateAfter
lcl
.
TNotifyEvent
//
on
ConstrainedResizeEvent
lcl
.
TConstrainedResizeEvent
//
isFormCreate
bool
//是否创建完成 WindowForm
isChromiumCreate
bool
//是否创建完成 Chromium
frames
TCEFFrame
//当前浏览器下的所有frame
auxTools
*
auxTools
//辅助工具
tray
ITray
//托盘
regions
*
TCefDraggableRegions
//窗口内html拖拽区域
rgn
*
HRGN
//
hWnd
types
.
HWND
//
windowsState
types
.
TWindowState
//
*
lcl
.
TForm
//
chromium
IChromium
//
browser
*
ICefBrowser
//
windowParent
ITCefWindowParent
//
windowProperty
*
WindowProperty
//
windowId
int32
//
windowType
consts
.
WINDOW_TYPE
//窗口类型
isClosing
bool
//
canClose
bool
//
onResize
TNotifyEvent
//
onActivate
TNotifyEvent
//
onShow
TNotifyEvent
//
on
Paint
TNotifyEvent
//
onClose
TCloseEvent
//
on
CloseQuery
TCloseQueryEvent
//
on
ActivateAfter
lcl
.
TNotifyEvent
//
isFormCreate
bool
//是否创建完成 WindowForm
isChromiumCreate
bool
//是否创建完成 Chromium
frames
TCEFFrame
//当前浏览器下的所有frame
auxTools
*
auxTools
//辅助工具
tray
ITray
//托盘
regions
*
TCefDraggableRegions
//窗口内html拖拽区域
rgn
*
HRGN
//
hWnd
types
.
HWND
//
windowsState
types
.
TWindowState
//
}
//创建一个 LCL 带有 chromium 窗口
...
...
@@ -470,27 +470,32 @@ func (m *LCLBrowserWindow) EnableAllDefaultEvent() {
m
.
defaultChromiumEvent
()
}
// 添加OnResize事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
// SetOnPaint 事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
func
(
m
*
LCLBrowserWindow
)
SetOnPaint
(
fn
TNotifyEvent
)
{
m
.
onPaint
=
fn
}
// SetOnResize 事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
func
(
m
*
LCLBrowserWindow
)
SetOnResize
(
fn
TNotifyEvent
)
{
m
.
onResize
=
fn
}
//
添加OnActivate
事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
//
SetOnActivate
事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
func
(
m
*
LCLBrowserWindow
)
SetOnActivate
(
fn
TNotifyEvent
)
{
m
.
onActivate
=
fn
}
//
添加OnShow
事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
//
SetOnShow
事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
func
(
m
*
LCLBrowserWindow
)
SetOnShow
(
fn
TNotifyEvent
)
{
m
.
onShow
=
fn
}
//
添加OnClose
事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
//
SetOnClose
事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
func
(
m
*
LCLBrowserWindow
)
SetOnClose
(
fn
TCloseEvent
)
{
m
.
onClose
=
fn
}
//
添加OnCloseQuery
事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
//
SetOnCloseQuery
事件,不会覆盖默认事件,返回值:false继续执行默认事件, true跳过默认事件
func
(
m
*
LCLBrowserWindow
)
SetOnCloseQuery
(
fn
TCloseQueryEvent
)
{
m
.
onCloseQuery
=
fn
}
...
...
@@ -720,10 +725,6 @@ func (m *LCLBrowserWindow) show(sender lcl.IObject) {
}
}
func
(
m
*
LCLBrowserWindow
)
SetOnConstrainedResize
(
fn
lcl
.
TConstrainedResizeEvent
)
{
m
.
onConstrainedResizeEvent
=
fn
}
func
(
m
*
LCLBrowserWindow
)
resize
(
sender
lcl
.
IObject
)
{
var
ret
bool
if
m
.
onResize
!=
nil
{
...
...
cef/cef-browser-window-lcl_windows.go
浏览文件 @
13528a2a
...
...
@@ -24,12 +24,14 @@ var ov = version.OSVersion
//显示标题栏
func
(
m
*
LCLBrowserWindow
)
ShowTitle
()
{
m
.
WindowProperty
()
.
_CanHideCaption
=
false
win
.
SetWindowLong
(
m
.
Handle
(),
win
.
GWL_STYLE
,
uintptr
(
win
.
GetWindowLong
(
m
.
Handle
(),
win
.
GWL_STYLE
)
|
win
.
WS_CAPTION
))
win
.
SetWindowPos
(
m
.
Handle
(),
m
.
Handle
(),
0
,
0
,
0
,
0
,
win
.
SWP_NOSIZE
|
win
.
SWP_NOMOVE
|
win
.
SWP_NOZORDER
|
win
.
SWP_NOACTIVATE
|
win
.
SWP_FRAMECHANGED
)
}
//隐藏标题栏
func
(
m
*
LCLBrowserWindow
)
HideTitle
()
{
m
.
WindowProperty
()
.
_CanHideCaption
=
true
win
.
SetWindowLong
(
m
.
Handle
(),
win
.
GWL_STYLE
,
uintptr
(
win
.
GetWindowLong
(
m
.
Handle
(),
win
.
GWL_STYLE
)
&^
win
.
WS_CAPTION
))
win
.
SetWindowPos
(
m
.
Handle
(),
m
.
Handle
(),
0
,
0
,
0
,
0
,
win
.
SWP_NOSIZE
|
win
.
SWP_NOMOVE
|
win
.
SWP_NOZORDER
|
win
.
SWP_NOACTIVATE
|
win
.
SWP_FRAMECHANGED
)
}
...
...
@@ -65,7 +67,7 @@ func (m *LCLBrowserWindow) doOnRenderCompMsg(message *types.TMessage, lResult *t
fmt
.
Println
(
"l up"
,
wdrs
.
canCaption
)
case
WM_NCLBUTTONDBLCLK
:
/*-- NC --*/
if
!
m
.
WindowProperty
()
.
CanCaptionDClkMaximize
{
break
return
}
fmt
.
Println
(
"nc ld click"
,
m
.
windowsState
,
m
.
WindowState
())
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
...
...
@@ -85,7 +87,6 @@ func (m *LCLBrowserWindow) doOnRenderCompMsg(message *types.TMessage, lResult *t
rtl
.
SendMessage
(
m
.
Handle
(),
WM_SYSCOMMAND
,
SC_RESTORE
,
0
)
}
rtl
.
SendMessage
(
m
.
Handle
(),
WM_NCLBUTTONUP
,
0
,
0
)
return
}
case
WM_NCLBUTTONDOWN
:
fmt
.
Println
(
"nc l down"
,
wdrs
.
canCaption
)
...
...
@@ -95,20 +96,21 @@ func (m *LCLBrowserWindow) doOnRenderCompMsg(message *types.TMessage, lResult *t
win
.
ReleaseCapture
()
rtl
.
PostMessage
(
m
.
Handle
(),
WM_NCLBUTTONDOWN
,
HTCAPTION
,
0
)
rtl
.
SendMessage
(
m
.
Handle
(),
WM_NCLBUTTONUP
,
0
,
0
)
return
}
case
WM_NCLBUTTONUP
:
fmt
.
Println
(
"nc l up"
,
wdrs
.
canCaption
)
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
//WinDefWindowProc(m.Handle(), message.Msg, message.WParam, message.LParam)
*
lResult
=
HTCAPTION
*
aHandled
=
true
return
}
case
WM_NCRBUTTONDOWN
:
fmt
.
Println
(
"nc r down"
,
wdrs
.
canCaption
)
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
}
case
WM_NCRBUTTONUP
:
fmt
.
Println
(
"nc r up"
,
wdrs
.
canCaption
)
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
*
lResult
=
HTCAPTION
*
aHandled
=
true
}
case
WM_NCHITTEST
:
/*-- NCHITTEST --*/
if
m
.
rgn
!=
nil
{
_
,
_
,
caption
:=
wdrs
.
isCaption
(
m
.
Handle
(),
m
.
rgn
,
message
)
...
...
@@ -118,14 +120,13 @@ func (m *LCLBrowserWindow) doOnRenderCompMsg(message *types.TMessage, lResult *t
//如果光标在一个可拖动区域内,返回HTCAPTION允许拖动。
*
lResult
=
HTCAPTION
*
aHandled
=
true
return
}
}
}
}
}
// 默认事件注册 windows
消息事件
// 默认事件注册 windows
CompMsgEvent
func
(
m
*
LCLBrowserWindow
)
registerWindowsCompMsgEvent
()
{
var
bwEvent
=
BrowserWindow
.
browserEvent
if
m
.
WindowProperty
()
.
CanWebkitAppRegion
{
...
...
@@ -137,23 +138,30 @@ func (m *LCLBrowserWindow) registerWindowsCompMsgEvent() {
m
.
doOnRenderCompMsg
(
message
,
lResult
,
aHandled
)
}
})
m
.
TForm
.
SetOnConstrainedResize
(
func
(
sender
lcl
.
IObject
,
minWidth
,
minHeight
,
maxWidth
,
maxHeight
*
int32
)
{
//m.windowsState = m.WindowState()
if
m
.
onConstrainedResizeEvent
!=
nil
{
m
.
onConstrainedResizeEvent
(
sender
,
minWidth
,
minHeight
,
maxWidth
,
maxHeight
)
}
})
m
.
TForm
.
SetOnPaint
(
func
(
sender
lcl
.
IObject
)
{
fmt
.
Println
(
"OnPaint"
,
m
.
WindowState
())
//TODO test
//m.chromium.NotifyMoveOrResizeStarted()
//m.windowParent.UpdateSize()
var
ret
bool
if
m
.
onPaint
!=
nil
{
ret
=
m
.
onPaint
(
sender
)
}
if
!
ret
{
if
m
.
WindowState
()
==
types
.
WsMaximized
&&
m
.
WindowProperty
()
.
_CanHideCaption
{
var
monitor
=
m
.
Monitor
()
.
WorkareaRect
()
m
.
SetBounds
(
monitor
.
Left
,
monitor
.
Top
,
monitor
.
Right
-
monitor
.
Left
,
monitor
.
Bottom
-
monitor
.
Top
)
m
.
SetWindowState
(
types
.
WsMaximized
)
//rtl.PostMessage(m.Handle(), WM_NCLBUTTONDOWN, HTCAPTION, 0) //WM_PAINT
}
}
})
}
else
{
if
bwEvent
.
onRenderCompMsg
!=
nil
{
m
.
chromium
.
SetOnRenderCompMsg
(
bwEvent
.
onRenderCompMsg
)
}
if
m
.
onConstrainedResizeEvent
!=
nil
{
m
.
TForm
.
SetOnConstrainedResize
(
m
.
onConstrainedResizeEvent
)
if
m
.
onPaint
!=
nil
{
m
.
TForm
.
SetOnPaint
(
func
(
sender
lcl
.
IObject
)
{
m
.
onPaint
(
sender
)
})
}
}
}
cef/cef-browser-window-views-framework_windows.go
浏览文件 @
13528a2a
...
...
@@ -17,6 +17,7 @@ import (
//显示标题栏
func
(
m
*
ViewsFrameworkBrowserWindow
)
ShowTitle
()
{
m
.
WindowProperty
()
.
_CanHideCaption
=
false
handle
:=
m
.
WindowComponent
()
.
WindowHandle
()
win
.
SetWindowLong
(
handle
.
ToPtr
(),
win
.
GWL_STYLE
,
uintptr
(
win
.
GetWindowLong
(
handle
.
ToPtr
(),
win
.
GWL_STYLE
)
|
win
.
WS_CAPTION
))
win
.
SetWindowPos
(
handle
.
ToPtr
(),
0
,
0
,
0
,
0
,
0
,
win
.
SWP_NOSIZE
|
win
.
SWP_NOMOVE
|
win
.
SWP_NOZORDER
|
win
.
SWP_NOACTIVATE
|
win
.
SWP_FRAMECHANGED
)
...
...
@@ -24,6 +25,7 @@ func (m *ViewsFrameworkBrowserWindow) ShowTitle() {
//隐藏标题栏
func
(
m
*
ViewsFrameworkBrowserWindow
)
HideTitle
()
{
m
.
WindowProperty
()
.
_CanHideCaption
=
true
handle
:=
m
.
WindowComponent
()
.
WindowHandle
()
win
.
SetWindowLong
(
handle
.
ToPtr
(),
win
.
GWL_STYLE
,
uintptr
(
win
.
GetWindowLong
(
handle
.
ToPtr
(),
win
.
GWL_STYLE
)
&^
win
.
WS_CAPTION
))
win
.
SetWindowPos
(
handle
.
ToPtr
(),
0
,
0
,
0
,
0
,
0
,
win
.
SWP_NOSIZE
|
win
.
SWP_NOMOVE
|
win
.
SWP_NOZORDER
|
win
.
SWP_NOACTIVATE
|
win
.
SWP_FRAMECHANGED
)
...
...
cef/cef-browser-window.go
浏览文件 @
13528a2a
...
...
@@ -30,6 +30,8 @@ type auxTools struct {
}
//窗口属性配置器
//
//部分属性配置并不支持所有平台
type
WindowProperty
struct
{
IsShowModel
bool
//是否以模态窗口显示
WindowState
types
.
TWindowState
//窗口 状态
...
...
@@ -37,6 +39,7 @@ type WindowProperty struct {
Url
string
//默认打开URL
Icon
string
//窗口图标 加载本地图标 local > /app/resources/icon.ico
IconFS
string
//窗口图标 加载emfs内置图标 emfs > resources/icon.ico
_CanHideCaption
bool
//窗口 是否隐藏标题栏
CanMinimize
bool
//窗口 是否启用最小化 default: true
CanMaximize
bool
//窗口 是否启用最大化 default: true
CanResize
bool
//窗口 是否允许调整大小 default: true
...
...
example/dev-test/lcl-browser/resources/index.html
浏览文件 @
13528a2a
...
...
@@ -6,18 +6,6 @@
<style>
</style>
<script
type=
"application/javascript"
>
function
divMnmousedown
(
e
)
{
windowDrag
.
mousedown
(
e
.
clientX
,
e
.
clientY
);
document
.
onmousemove
=
function
(
e
)
{
e
.
preventDefault
()
windowDrag
.
mousemove
(
e
.
clientX
,
e
.
clientY
);
}
document
.
onmouseup
=
function
()
{
windowDrag
.
mouseup
();
document
.
onmousemove
=
null
;
document
.
onmouseup
=
null
;
};
}
</script>
</head>
<body
style=
"overflow: hidden;margin: 0px;padding: 0px;"
>
...
...
@@ -29,10 +17,7 @@
<span
href=
"javascript:void(0)"
target=
"_blank"
>
新窗口百度-此处点不到
</span>
<a
href=
"https://www.baidu.com"
style=
"-webkit-app-region:no-drag"
>
百度
</a>
<a
href=
"/"
target=
"_blank"
style=
"-webkit-app-region:no-drag"
>
新窗口
</a>
<div
style=
"position: absolute;width: 100px;height: 100px;-webkit-app-region: drag; border: 1px solid red;left: 0;top: 0;"
></div>
<div
style=
"position: absolute;width: 200px;height: 100px;border: 1px solid red;left: 100px;top: 100px;"
onmousedown=
"divMnmousedown(event)"
>
这里是鼠标事件onmousedown="onmousedown(event)"
</div>
<div
style=
"position: absolute;width: 100px;height: 100px;-webkit-app-region: drag; border: 1px solid red;left: 0;top: 30px;"
></div>
</div>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录