v2.3.34 Fixed Chinese input and gtk3 issues for linux packagin,

And Windows Drag Region
This commit is contained in:
杨红岩 2023-01-19 15:15:33 +08:00
parent 7ef0e18a39
commit eff23a18cb
5 changed files with 51 additions and 41 deletions

View File

@ -55,10 +55,6 @@ type queueAsyncCall struct {
//
// 4.在windows linux macos 可同时使用
func QueueAsyncCall(fn qacFn) int {
//if consts.IsMessageLoop {
// fn(0)
// return 0
//}
id := qac.set(&queueCall{
IsSync: false,
Fn: fn,
@ -77,10 +73,6 @@ func QueueAsyncCall(fn qacFn) int {
//
// 4.在windows linux macos 需要注意使用场景, 当非UI线程使用时正常执行, UI线程使用时会造成UI线程锁死, 这种情况建议使用 QueueAsyncCall 自己增加同步锁
func QueueSyncCall(fn qacFn) int {
//if consts.IsMessageLoop {
// fn(0)
// return 0
//}
qc := &queueCall{
IsSync: true,
Fn: fn,

View File

@ -138,21 +138,23 @@ func (m *ViewsFrameworkBrowserWindow) registerPopupEvent() {
return true
}
wp := &WindowProperty{
Title: BrowserWindow.Config.WindowProperty.Title,
Url: beforePopupInfo.TargetUrl,
CanMinimize: BrowserWindow.Config.WindowProperty.CanMinimize,
CanMaximize: BrowserWindow.Config.WindowProperty.CanMaximize,
CanResize: BrowserWindow.Config.WindowProperty.CanResize,
CanClose: BrowserWindow.Config.WindowProperty.CanClose,
CenterWindow: BrowserWindow.Config.WindowProperty.CenterWindow,
IsShowModel: BrowserWindow.Config.WindowProperty.IsShowModel,
WindowState: BrowserWindow.Config.WindowProperty.WindowState,
Icon: BrowserWindow.Config.WindowProperty.Icon,
IconFS: BrowserWindow.Config.WindowProperty.IconFS,
X: BrowserWindow.Config.WindowProperty.X,
Y: BrowserWindow.Config.WindowProperty.Y,
Width: BrowserWindow.Config.WindowProperty.Width,
Height: BrowserWindow.Config.WindowProperty.Height,
Title: BrowserWindow.Config.WindowProperty.Title,
Url: beforePopupInfo.TargetUrl,
CanMinimize: BrowserWindow.Config.WindowProperty.CanMinimize,
CanMaximize: BrowserWindow.Config.WindowProperty.CanMaximize,
CanResize: BrowserWindow.Config.WindowProperty.CanResize,
CanClose: BrowserWindow.Config.WindowProperty.CanClose,
CenterWindow: BrowserWindow.Config.WindowProperty.CenterWindow,
CanWebkitAppRegion: BrowserWindow.Config.WindowProperty.CanWebkitAppRegion,
CanCaptionDClkMaximize: BrowserWindow.Config.WindowProperty.CanCaptionDClkMaximize,
IsShowModel: BrowserWindow.Config.WindowProperty.IsShowModel,
WindowState: BrowserWindow.Config.WindowProperty.WindowState,
Icon: BrowserWindow.Config.WindowProperty.Icon,
IconFS: BrowserWindow.Config.WindowProperty.IconFS,
X: BrowserWindow.Config.WindowProperty.X,
Y: BrowserWindow.Config.WindowProperty.Y,
Width: BrowserWindow.Config.WindowProperty.Width,
Height: BrowserWindow.Config.WindowProperty.Height,
}
var vfbw = NewViewsFrameworkBrowserWindow(BrowserWindow.Config.ChromiumConfig(), wp, BrowserWindow.MainWindow().AsViewsFrameworkBrowserWindow().Component())
var result = false
@ -295,8 +297,6 @@ func (m *ViewsFrameworkBrowserWindow) registerDefaultEvent() {
return false
})
m.chromium.SetOnTitleChange(func(sender lcl.IObject, browser *ICefBrowser, title string) {
updateBrowserDevTools(browser, title)
updateBrowserViewSource(browser, title)
if bwEvent.onTitleChange != nil {
bwEvent.onTitleChange(sender, browser, title)
}

View File

@ -38,8 +38,7 @@ func chromiumOnBeforeBrowser(browser *ICefBrowser, frame *ICefFrame) {
}
}
BrowserWindow.setOrIncNextWindowNum(browser.Identifier() + 1)
if IsMessageLoop {
} else {
if !IsMessageLoop {
QueueAsyncCall(func(id int) {
BrowserWindow.createNextLCLPopupWindow()
})
@ -195,9 +194,13 @@ func chromiumOnBeforeContextMenu(sender lcl.IObject, browser *ICefBrowser, frame
Accelerator: "alt+" + string(rune(37)),
Callback: func(browser *ICefBrowser, commandId MenuId, params *ICefContextMenuParams, menuType TCefContextMenuType, eventFlags uint32, result *bool) {
if browser.CanGoBack() {
QueueAsyncCall(func(id int) {
if IsMessageLoop {
browser.GoBack()
})
} else {
QueueAsyncCall(func(id int) {
browser.GoBack()
})
}
}
},
})
@ -208,9 +211,13 @@ func chromiumOnBeforeContextMenu(sender lcl.IObject, browser *ICefBrowser, frame
Accelerator: "alt+" + string(rune(39)),
Callback: func(browser *ICefBrowser, commandId MenuId, params *ICefContextMenuParams, menuType TCefContextMenuType, eventFlags uint32, result *bool) {
if browser.CanGoForward() {
QueueAsyncCall(func(id int) {
if IsMessageLoop {
browser.GoForward()
})
} else {
QueueAsyncCall(func(id int) {
browser.GoForward()
})
}
}
},
})
@ -303,15 +310,23 @@ func chromiumOnContextMenuCommand(sender lcl.IObject, browser *ICefBrowser, fram
browser.ShowDevTools()
}
} else if commandId == aUrlId {
QueueAsyncCall(func(id int) {
if IsMessageLoop {
lcl.Clipboard.SetAsText(params.LinkUrl)
})
} else {
QueueAsyncCall(func(id int) {
lcl.Clipboard.SetAsText(params.LinkUrl)
})
}
} else if commandId == copyImageId {
frame.Copy()
} else if commandId == imageUrlId {
QueueAsyncCall(func(id int) {
if IsMessageLoop {
lcl.Clipboard.SetAsText(params.SourceUrl)
})
} else {
QueueAsyncCall(func(id int) {
lcl.Clipboard.SetAsText(params.SourceUrl)
})
}
} else if commandId == imageSaveId {
browser.StartDownload(params.SourceUrl)
}

View File

@ -24,12 +24,14 @@
<body style="overflow: hidden;margin: 0px;padding: 0px; ">
<div style="width: 600px;-webkit-app-region: drag; border: 1px solid red;">
<a href="https://www.baidu.com" target="_blank" style="-webkit-app-region: no-drag">百度</a>
<a href="https://www.baidu.com" target="_blank">新窗口百度-此处点不到</a>
<a href="/" target="_blank" style="-webkit-app-region: no-drag">index</a>
<a href="https://www.baidu.com" target="_blank">新窗口百度-此处点不到</a>
<a href="https://energy.yanghy.cn"style="-webkit-app-region: no-drag">Energy</a>
<a href="/" target="_blank" style="-webkit-app-region: no-drag">当前页面</a>
<a href="https://energy.yanghy.cn" style="-webkit-app-region: no-drag">Energy</a>
<a href="/" target="_blank" style="-webkit-app-region: no-drag">当前页面-新窗口</a>
<a href="https://www.baidu.com" style="-webkit-app-region: no-drag" target="_blank">百度新窗口</a>
<a href="https://www.baidu.com" 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)">
<div style="position: absolute;width: 200px;height: 100px; border: 1px solid red;left: 100px;top: 100px;"
onmousedown="divMnmousedown(event)">
这里是鼠标事件 onmousedown="onmousedown(event)"
</div>
</div>

View File

@ -6,6 +6,7 @@ import (
"github.com/energye/energy/cef"
"github.com/energye/energy/common"
"github.com/energye/energy/common/assetserve"
sys_tray "github.com/energye/energy/example/dev-test/sys-tray"
"github.com/energye/energy/ipc"
"github.com/energye/golcl/lcl"
)
@ -63,7 +64,7 @@ func main() {
//设置隐藏窗口标题
//window.HideTitle()
cefTray(window)
//sys_tray.TrayMain()
sys_tray.TrayMain()
fmt.Println("SetBrowserInitAfter 结束")
})
//在主进程启动成功之后执行