Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
energye
energy
提交
e9852f2b
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,发现更多精彩内容 >>
提交
e9852f2b
编写于
1月 18, 2023
作者:
yanghye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v2.3.24 Fixed Chinese input and gtk3 issues for linux packagin
上级
c2beeea2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
159 addition
and
151 deletion
+159
-151
cef/cef-browser-window-lcl.go
cef/cef-browser-window-lcl.go
+0
-151
cef/cef-browser-window-lcl_other.go
cef/cef-browser-window-lcl_other.go
+5
-0
cef/cef-browser-window-lcl_windows.go
cef/cef-browser-window-lcl_windows.go
+154
-0
未找到文件。
cef/cef-browser-window-lcl.go
浏览文件 @
e9852f2b
...
...
@@ -20,9 +20,7 @@ import (
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/api"
"github.com/energye/golcl/lcl/rtl"
"github.com/energye/golcl/lcl/rtl/version"
"github.com/energye/golcl/lcl/types"
"github.com/energye/golcl/lcl/win"
"time"
)
...
...
@@ -798,155 +796,6 @@ func (m *LCLBrowserWindow) registerPopupEvent() {
})
}
var
wdrs
=
&
windowDragRegionsState
{}
type
windowDragRegionsState
struct
{
canCaption
bool
}
func
(
m
*
windowDragRegionsState
)
toPoint
(
message
*
types
.
TMessage
)
(
x
,
y
int32
)
{
return
int32
(
message
.
LParam
&
0xFFFF
),
int32
(
message
.
LParam
&
0xFFFF0000
>>
16
)
}
//鼠标在标题栏区域
func
(
m
*
windowDragRegionsState
)
isCaption
(
hWND
types
.
HWND
,
rgn
*
HRGN
,
message
*
types
.
TMessage
)
(
x
,
y
int32
,
caption
bool
)
{
dx
,
dy
:=
m
.
toPoint
(
message
)
p
:=
&
types
.
TPoint
{
X
:
dx
,
Y
:
dy
,
}
WinScreenToClient
(
hWND
,
p
)
m
.
canCaption
=
WinPtInRegion
(
rgn
,
p
.
X
,
p
.
Y
)
return
p
.
X
,
p
.
Y
,
m
.
canCaption
}
var
ov
=
version
.
OSVersion
func
(
m
*
LCLBrowserWindow
)
doOnRenderCompMsg
(
message
*
types
.
TMessage
,
lResult
*
types
.
LRESULT
,
aHandled
*
bool
)
{
if
m
.
regions
!=
nil
&&
m
.
regions
.
RegionsCount
()
>
0
{
switch
message
.
Msg
{
case
WM_GETMINMAXINFO
:
fmt
.
Println
(
"WM_GETMINMAXINFO"
)
case
WM_MOUSEMOVE
:
//fmt.Println("move")
case
WM_LBUTTONDBLCLK
:
case
WM_LBUTTONDOWN
:
case
WM_LBUTTONUP
:
fmt
.
Println
(
"l up"
,
wdrs
.
canCaption
)
case
WM_MOVE
,
WM_MOVING
:
fmt
.
Println
(
"move"
)
case
WM_NCLBUTTONDBLCLK
:
/*-- NC --*/
if
!
m
.
WindowProperty
()
.
CanCaptionDClkMaximize
{
break
}
fmt
.
Println
(
"nc ld click"
,
m
.
windowsState
)
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
if
ov
.
Major
==
6
{
//win.ReleaseCapture()
}
//SendMessage(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); // 最大化
//SendMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); // 最小化
//SendMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0); // 关闭
//SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); // 最大化状态还原
if
m
.
windowsState
==
0
{
m
.
windowsState
=
types
.
WsMaximized
m
.
SetWindowState
(
types
.
WsMaximized
)
//var monitor = m.Monitor().WorkareaRect()
//m.SetBounds(monitor.Left, monitor.Top, monitor.Right-monitor.Left-1, monitor.Bottom-monitor.Top-1)
}
else
{
//需要先设置一次-不然不生效
m
.
SetWindowState
(
m
.
windowsState
)
m
.
windowsState
=
types
.
WsNormal
m
.
SetWindowState
(
types
.
WsNormal
)
}
return
}
case
WM_NCLBUTTONDOWN
:
fmt
.
Println
(
"nc l down"
,
wdrs
.
canCaption
)
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
*
lResult
=
HTCAPTION
*
aHandled
=
true
//1 这个在windows7不正确
//WinDefWindowProc(m.hWnd, message.Msg, message.WParam, message.LParam)
//2 这个在windows7下正常
win
.
ReleaseCapture
()
rtl
.
SendMessage
(
m
.
Handle
(),
WM_NCLBUTTONDOWN
,
HTCAPTION
,
0
)
rtl
.
SendMessage
(
m
.
Handle
(),
WM_NCLBUTTONUP
,
0
,
0
)
//rtl.SendMessage(m.Handle(), WM_NCLBUTTONUP, 0, 0)
return
}
case
WM_NCLBUTTONUP
:
fmt
.
Println
(
"nc l up"
,
wdrs
.
canCaption
)
case
WM_NCMOUSEMOVE
:
fmt
.
Println
(
"nc mouse move"
,
wdrs
.
canCaption
)
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
WinDefWindowProc
(
m
.
Handle
(),
message
.
Msg
,
message
.
WParam
,
message
.
LParam
)
*
lResult
=
HTCAPTION
*
aHandled
=
true
break
}
case
WM_NCRBUTTONDOWN
:
fmt
.
Println
(
"nc r down"
,
wdrs
.
canCaption
)
case
WM_NCRBUTTONUP
:
fmt
.
Println
(
"nc r up"
,
wdrs
.
canCaption
)
case
WM_NCHITTEST
:
/*-- NCHITTEST --*/
if
m
.
rgn
!=
nil
{
//var hit = WinDefWindowProc(m.Handle(), message.Msg, message.WParam, message.LParam)
_
,
_
,
caption
:=
wdrs
.
isCaption
(
m
.
Handle
(),
m
.
rgn
,
message
)
//设置鼠标坐标是否在标题区域
wdrs
.
canCaption
=
caption
if
caption
{
//如果光标在一个可拖动区域内,返回HTCAPTION允许拖动。
*
lResult
=
HTCAPTION
*
aHandled
=
true
return
}
//*lResult = hit
return
}
}
//other message -> WinDefWindowProc
*
lResult
=
WinDefWindowProc
(
m
.
Handle
(),
message
.
Msg
,
message
.
WParam
,
message
.
LParam
)
//m.InheritedWndProc(message)
}
}
// 默认事件注册 windows 消息事件
func
(
m
*
LCLBrowserWindow
)
registerWindowsCompMsgEvent
()
{
var
bwEvent
=
BrowserWindow
.
browserEvent
if
m
.
WindowProperty
()
.
CanWebkitAppRegion
{
m
.
chromium
.
SetOnRenderCompMsg
(
func
(
sender
lcl
.
IObject
,
message
*
types
.
TMessage
,
lResult
*
types
.
LRESULT
,
aHandled
*
bool
)
{
if
bwEvent
.
onRenderCompMsg
!=
nil
{
bwEvent
.
onRenderCompMsg
(
sender
,
message
,
lResult
,
aHandled
)
}
if
!*
aHandled
{
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()
})
}
else
{
if
bwEvent
.
onRenderCompMsg
!=
nil
{
m
.
chromium
.
SetOnRenderCompMsg
(
bwEvent
.
onRenderCompMsg
)
}
if
m
.
onConstrainedResizeEvent
!=
nil
{
m
.
TForm
.
SetOnConstrainedResize
(
m
.
onConstrainedResizeEvent
)
}
}
}
// 默认事件注册 部分事件允许被覆盖
func
(
m
*
LCLBrowserWindow
)
registerDefaultEvent
()
{
var
bwEvent
=
BrowserWindow
.
browserEvent
...
...
cef/cef-browser-window-lcl_other.go
浏览文件 @
e9852f2b
...
...
@@ -28,3 +28,8 @@ func (m *LCLBrowserWindow) HideTitle() {
}
m
.
TForm
.
SetBorderStyle
(
types
.
BsSingle
)
}
// 默认事件注册 windows 消息事件
func
(
m
*
LCLBrowserWindow
)
registerWindowsCompMsgEvent
()
{
}
cef/cef-browser-window-lcl_windows.go
浏览文件 @
e9852f2b
...
...
@@ -12,6 +12,11 @@
package
cef
import
(
"fmt"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/rtl"
"github.com/energye/golcl/lcl/rtl/version"
"github.com/energye/golcl/lcl/types"
"github.com/energye/golcl/lcl/win"
)
...
...
@@ -26,3 +31,152 @@ func (m *LCLBrowserWindow) HideTitle() {
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
)
}
var
wdrs
=
&
windowDragRegionsState
{}
type
windowDragRegionsState
struct
{
canCaption
bool
}
func
(
m
*
windowDragRegionsState
)
toPoint
(
message
*
types
.
TMessage
)
(
x
,
y
int32
)
{
return
int32
(
message
.
LParam
&
0xFFFF
),
int32
(
message
.
LParam
&
0xFFFF0000
>>
16
)
}
//鼠标在标题栏区域
func
(
m
*
windowDragRegionsState
)
isCaption
(
hWND
types
.
HWND
,
rgn
*
HRGN
,
message
*
types
.
TMessage
)
(
x
,
y
int32
,
caption
bool
)
{
dx
,
dy
:=
m
.
toPoint
(
message
)
p
:=
&
types
.
TPoint
{
X
:
dx
,
Y
:
dy
,
}
WinScreenToClient
(
hWND
,
p
)
m
.
canCaption
=
WinPtInRegion
(
rgn
,
p
.
X
,
p
.
Y
)
return
p
.
X
,
p
.
Y
,
m
.
canCaption
}
var
ov
=
version
.
OSVersion
func
(
m
*
LCLBrowserWindow
)
doOnRenderCompMsg
(
message
*
types
.
TMessage
,
lResult
*
types
.
LRESULT
,
aHandled
*
bool
)
{
if
m
.
regions
!=
nil
&&
m
.
regions
.
RegionsCount
()
>
0
{
switch
message
.
Msg
{
case
WM_GETMINMAXINFO
:
fmt
.
Println
(
"WM_GETMINMAXINFO"
)
case
WM_MOUSEMOVE
:
//fmt.Println("move")
case
WM_LBUTTONDBLCLK
:
case
WM_LBUTTONDOWN
:
case
WM_LBUTTONUP
:
fmt
.
Println
(
"l up"
,
wdrs
.
canCaption
)
case
WM_MOVE
,
WM_MOVING
:
fmt
.
Println
(
"move"
)
case
WM_NCLBUTTONDBLCLK
:
/*-- NC --*/
if
!
m
.
WindowProperty
()
.
CanCaptionDClkMaximize
{
break
}
fmt
.
Println
(
"nc ld click"
,
m
.
windowsState
)
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
if
ov
.
Major
==
6
{
//win.ReleaseCapture()
}
//SendMessage(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); // 最大化
//SendMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); // 最小化
//SendMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0); // 关闭
//SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); // 最大化状态还原
if
m
.
windowsState
==
0
{
m
.
windowsState
=
types
.
WsMaximized
m
.
SetWindowState
(
types
.
WsMaximized
)
//var monitor = m.Monitor().WorkareaRect()
//m.SetBounds(monitor.Left, monitor.Top, monitor.Right-monitor.Left-1, monitor.Bottom-monitor.Top-1)
}
else
{
//需要先设置一次-不然不生效
m
.
SetWindowState
(
m
.
windowsState
)
m
.
windowsState
=
types
.
WsNormal
m
.
SetWindowState
(
types
.
WsNormal
)
}
return
}
case
WM_NCLBUTTONDOWN
:
fmt
.
Println
(
"nc l down"
,
wdrs
.
canCaption
)
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
*
lResult
=
HTCAPTION
*
aHandled
=
true
//1 这个在windows7不正确
//WinDefWindowProc(m.hWnd, message.Msg, message.WParam, message.LParam)
//2 这个在windows7下正常
win
.
ReleaseCapture
()
rtl
.
SendMessage
(
m
.
Handle
(),
WM_NCLBUTTONDOWN
,
HTCAPTION
,
0
)
rtl
.
SendMessage
(
m
.
Handle
(),
WM_NCLBUTTONUP
,
0
,
0
)
//rtl.SendMessage(m.Handle(), WM_NCLBUTTONUP, 0, 0)
return
}
case
WM_NCLBUTTONUP
:
fmt
.
Println
(
"nc l up"
,
wdrs
.
canCaption
)
case
WM_NCMOUSEMOVE
:
fmt
.
Println
(
"nc mouse move"
,
wdrs
.
canCaption
)
if
m
.
rgn
!=
nil
&&
wdrs
.
canCaption
{
WinDefWindowProc
(
m
.
Handle
(),
message
.
Msg
,
message
.
WParam
,
message
.
LParam
)
*
lResult
=
HTCAPTION
*
aHandled
=
true
break
}
case
WM_NCRBUTTONDOWN
:
fmt
.
Println
(
"nc r down"
,
wdrs
.
canCaption
)
case
WM_NCRBUTTONUP
:
fmt
.
Println
(
"nc r up"
,
wdrs
.
canCaption
)
case
WM_NCHITTEST
:
/*-- NCHITTEST --*/
if
m
.
rgn
!=
nil
{
//var hit = WinDefWindowProc(m.Handle(), message.Msg, message.WParam, message.LParam)
_
,
_
,
caption
:=
wdrs
.
isCaption
(
m
.
Handle
(),
m
.
rgn
,
message
)
//设置鼠标坐标是否在标题区域
wdrs
.
canCaption
=
caption
if
caption
{
//如果光标在一个可拖动区域内,返回HTCAPTION允许拖动。
*
lResult
=
HTCAPTION
*
aHandled
=
true
return
}
//*lResult = hit
return
}
}
//other message -> WinDefWindowProc
*
lResult
=
WinDefWindowProc
(
m
.
Handle
(),
message
.
Msg
,
message
.
WParam
,
message
.
LParam
)
//m.InheritedWndProc(message)
}
}
// 默认事件注册 windows 消息事件
func
(
m
*
LCLBrowserWindow
)
registerWindowsCompMsgEvent
()
{
var
bwEvent
=
BrowserWindow
.
browserEvent
if
m
.
WindowProperty
()
.
CanWebkitAppRegion
{
m
.
chromium
.
SetOnRenderCompMsg
(
func
(
sender
lcl
.
IObject
,
message
*
types
.
TMessage
,
lResult
*
types
.
LRESULT
,
aHandled
*
bool
)
{
if
bwEvent
.
onRenderCompMsg
!=
nil
{
bwEvent
.
onRenderCompMsg
(
sender
,
message
,
lResult
,
aHandled
)
}
if
!*
aHandled
{
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()
})
}
else
{
if
bwEvent
.
onRenderCompMsg
!=
nil
{
m
.
chromium
.
SetOnRenderCompMsg
(
bwEvent
.
onRenderCompMsg
)
}
if
m
.
onConstrainedResizeEvent
!=
nil
{
m
.
TForm
.
SetOnConstrainedResize
(
m
.
onConstrainedResizeEvent
)
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录