提交 1139de2b 编写于 作者: yanghye's avatar yanghye

A: lcl custom window drag

上级 fbc1994d
......@@ -45,12 +45,15 @@ func appWebKitInitialized() {
energyExtensionHandler := V8HandlerRef.New()
energyExtensionHandler.Execute(func(name string, object *ICefV8Value, arguments *TCefV8ValueArray, retVal *ResultV8Value, exception *ResultString) bool {
fmt.Println("Execute", name, consts.IsMessageLoop, application.SingleProcess())
message := &ipcArgument.List{
Id: -1,
BId: ipc.RenderChan().BrowserId(),
Name: internalIPCDRAG,
if name == "mouseMove" {
message := &ipcArgument.List{
Id: -1,
BId: ipc.RenderChan().BrowserId(),
Name: internalIPCDRAG,
}
ipc.RenderChan().IPC().Send(message.Bytes())
return true
}
ipc.RenderChan().IPC().Send(message.Bytes())
return false
})
var code = `
......@@ -98,7 +101,7 @@ func appWebKitInitialized() {
mouseUp();
}
energyExtension.drag.mouseDown = function (e) {
if (!energyExtension.drag.enableDrag && ((e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight))) {
if (!energyExtension.drag.enableDrag || ((e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight))) {
return
}
if (energyExtension.drag.war(e)) {
......
......@@ -139,10 +139,12 @@ func (m *LCLBrowserWindow) Handle() types.HWND {
func (m *LCLBrowserWindow) RunOnMainThread(fn func()) {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
fmt.Println("call-0-DMainThreadId:", api.DMainThreadId(), api.DCurrentThreadId())
if api.DMainThreadId() == api.DCurrentThreadId() {
fn()
} else {
lcl.ThreadSync(func() {
QueueAsyncCall(func(id int) {
//lcl.ThreadSync(func() {
fn()
})
}
......
......@@ -9,6 +9,7 @@ import (
"github.com/energye/energy/v2/consts"
"github.com/energye/energy/v2/pkgs/assetserve"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/api"
"github.com/energye/golcl/lcl/types"
"strings"
//_ "net/http/pprof"
......@@ -163,7 +164,9 @@ func main() {
dlgOpen.SetTitle("打开")
ipc.On("showDialog", func(t int) {
cef.QueueAsyncCall(func(id int) {
window.RunOnMainThread(func() {
fmt.Println("call-1-DMainThreadId:", api.DMainThreadId(), api.DCurrentThreadId())
//cef.QueueAsyncCall(func(id int) {
switch t {
case 1: // InputComboEx
fmt.Println(lcl.InputComboEx("选择", "请选择一项:"+strings.Repeat(" ", 50), []string{"第一项", "第二项", "第三项", "第四项"}, false))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册