提交 2426cca4 编写于 作者: yanghye's avatar yanghye

v2.3.24 Fixed Chinese input and gtk3 issues for linux packagin

上级 e9852f2b
......@@ -20,6 +20,8 @@ import (
"github.com/energye/golcl/lcl/win"
)
var ov = version.OSVersion
//显示标题栏
func (m *LCLBrowserWindow) ShowTitle() {
win.SetWindowLong(m.Handle(), win.GWL_STYLE, uintptr(win.GetWindowLong(m.Handle(), win.GWL_STYLE)|win.WS_CAPTION))
......@@ -32,18 +34,19 @@ func (m *LCLBrowserWindow) HideTitle() {
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{}
//windows 窗口拖拽区域管理
var wdrs = &windowDragRegions{}
type windowDragRegionsState struct {
type windowDragRegions struct {
canCaption bool
}
func (m *windowDragRegionsState) toPoint(message *types.TMessage) (x, y int32) {
func (m *windowDragRegions) 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) {
func (m *windowDragRegions) isCaption(hWND types.HWND, rgn *HRGN, message *types.TMessage) (x, y int32, caption bool) {
dx, dy := m.toPoint(message)
p := &types.TPoint{
X: dx,
......@@ -54,8 +57,6 @@ func (m *windowDragRegionsState) isCaption(hWND types.HWND, rgn *HRGN, message *
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 {
......
......@@ -10,10 +10,7 @@ package cef
import (
"github.com/energye/energy/common"
"github.com/energye/energy/consts"
"github.com/energye/golcl/lcl/api"
"github.com/energye/golcl/lcl/types"
"unsafe"
)
var (
......@@ -38,105 +35,3 @@ func LibBuildVersion() string {
}
return lib_build_version
}
func WinCreateRectRgn(X1, Y1, X2, Y2 int32) *HRGN {
if common.IsWindows() {
r1, _, _ := common.Proc(internale_CEF_Win_CreateRectRgn).Call(uintptr(X1), uintptr(Y1), uintptr(X2), uintptr(Y2))
return &HRGN{
instance: unsafe.Pointer(r1),
}
}
return nil
}
func WinSetRectRgn(aRGN *HRGN, X1, Y1, X2, Y2 int32) bool {
if common.IsWindows() {
r1, _, _ := common.Proc(internale_CEF_Win_SetRectRgn).Call(uintptr(aRGN.instance), uintptr(X1), uintptr(Y1), uintptr(X2), uintptr(Y2))
return api.GoBool(r1)
}
return false
}
func WinDeleteObject(aRGN *HRGN) bool {
if common.IsWindows() {
r1, _, _ := common.Proc(internale_CEF_Win_DeleteObject).Call(uintptr(aRGN.instance))
return api.GoBool(r1)
}
return false
}
func WinCombineRgn(dest, src1, src2 *HRGN, fnCombineMode consts.RNGFnCombineMode) int32 {
if common.IsWindows() {
r1, _, _ := common.Proc(internale_CEF_Win_CombineRgn).Call(uintptr(dest.instance), uintptr(src1.instance), uintptr(src2.instance), uintptr(fnCombineMode))
return int32(r1)
}
return 0
}
func WinPtInRegion(RGN *HRGN, X, Y int32) bool {
if common.IsWindows() {
r1, _, _ := common.Proc(internale_CEF_Win_PtInRegion).Call(uintptr(RGN.instance), uintptr(X), uintptr(Y))
return api.GoBool(r1)
}
return false
}
func WinScreenToClient(handle types.HWND, p *types.TPoint) int32 {
if common.IsWindows() {
r1, _, _ := common.Proc(internale_CEF_Win_ScreenToClient).Call(handle, uintptr(unsafe.Pointer(p)))
return int32(r1)
}
return 0
}
func WinClientToScreen(handle types.HWND, p *types.TPoint) bool {
if common.IsWindows() {
r1, _, _ := common.Proc(internale_CEF_Win_ClientToScreen).Call(handle, uintptr(unsafe.Pointer(p)))
return api.GoBool(r1)
}
return false
}
func WinDefWindowProc(handle types.HWND, msg types.UINT, wParam types.WPARAM, lParam types.LPARAM) types.LRESULT {
if common.IsWindows() {
r1, _, _ := common.Proc(internale_CEF_Win_DefWindowProc).Call(handle, uintptr(msg), wParam, lParam)
return types.LRESULT(r1)
}
return 0
}
func WinDefSubclassProc(handle types.HWND, msg types.UINT, wParam types.WPARAM, lParam types.LPARAM) types.LRESULT {
if common.IsWindows() {
r1, _, _ := common.Proc(internale_CEF_Win_DefSubclassProc).Call(handle, uintptr(msg), wParam, lParam)
return types.LRESULT(r1)
}
return 0
}
func WinOnPaint(handle types.HWND) {
if common.IsWindows() {
common.Proc(internale_CEF_Win_OnPaint).Call(handle)
}
}
func WinSetDraggableRegions(aRGN *HRGN, regions []TCefDraggableRegion) {
/*
//SetDraggableRegions 代码实现
draggableRegion := WinCreateRectRgn(0, 0, 0, 0)
WinSetRectRgn(draggableRegion, 0, 0, 0, 0)
for i := 0; i < regions.RegionsCount(); i++ {
region := regions.Region(i)
creRGN := WinCreateRectRgn(region.Bounds.X, region.Bounds.Y, region.Bounds.X+region.Bounds.Width, region.Bounds.Y+region.Bounds.Height)
if region.Draggable {
WinCombineRgn(draggableRegion, draggableRegion, creRGN, consts.RGN_OR)
} else {
WinCombineRgn(draggableRegion, draggableRegion, creRGN, consts.RGN_DIFF)
}
WinDeleteObject(creRGN)
}
fmt.Println("Check PtInRegion:", WinPtInRegion(draggableRegion, 50, 50))
*/
if common.IsWindows() {
common.Proc(internale_CEF_Win_SetDraggableRegions).Call(uintptr(aRGN.instance), uintptr(int32(len(regions))), uintptr(unsafe.Pointer(&regions[0])), uintptr(int32(len(regions))))
}
}
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under GNU General Public License v3.0
//
//----------------------------------------
//go:build windows
// +build windows
package cef
import (
"github.com/energye/energy/common"
"github.com/energye/energy/consts"
"github.com/energye/golcl/lcl/api"
"github.com/energye/golcl/lcl/types"
"unsafe"
)
func WinCreateRectRgn(X1, Y1, X2, Y2 int32) *HRGN {
r1, _, _ := common.Proc(internale_CEF_Win_CreateRectRgn).Call(uintptr(X1), uintptr(Y1), uintptr(X2), uintptr(Y2))
return &HRGN{
instance: unsafe.Pointer(r1),
}
}
func WinSetRectRgn(aRGN *HRGN, X1, Y1, X2, Y2 int32) bool {
r1, _, _ := common.Proc(internale_CEF_Win_SetRectRgn).Call(uintptr(aRGN.instance), uintptr(X1), uintptr(Y1), uintptr(X2), uintptr(Y2))
return api.GoBool(r1)
}
func WinDeleteObject(aRGN *HRGN) bool {
r1, _, _ := common.Proc(internale_CEF_Win_DeleteObject).Call(uintptr(aRGN.instance))
return api.GoBool(r1)
}
func WinCombineRgn(dest, src1, src2 *HRGN, fnCombineMode consts.RNGFnCombineMode) int32 {
r1, _, _ := common.Proc(internale_CEF_Win_CombineRgn).Call(uintptr(dest.instance), uintptr(src1.instance), uintptr(src2.instance), uintptr(fnCombineMode))
return int32(r1)
}
func WinPtInRegion(RGN *HRGN, X, Y int32) bool {
r1, _, _ := common.Proc(internale_CEF_Win_PtInRegion).Call(uintptr(RGN.instance), uintptr(X), uintptr(Y))
return api.GoBool(r1)
}
func WinScreenToClient(handle types.HWND, p *types.TPoint) int32 {
r1, _, _ := common.Proc(internale_CEF_Win_ScreenToClient).Call(handle, uintptr(unsafe.Pointer(p)))
return int32(r1)
}
func WinClientToScreen(handle types.HWND, p *types.TPoint) bool {
r1, _, _ := common.Proc(internale_CEF_Win_ClientToScreen).Call(handle, uintptr(unsafe.Pointer(p)))
return api.GoBool(r1)
}
func WinDefWindowProc(handle types.HWND, msg types.UINT, wParam types.WPARAM, lParam types.LPARAM) types.LRESULT {
r1, _, _ := common.Proc(internale_CEF_Win_DefWindowProc).Call(handle, uintptr(msg), wParam, lParam)
return types.LRESULT(r1)
}
func WinDefSubclassProc(handle types.HWND, msg types.UINT, wParam types.WPARAM, lParam types.LPARAM) types.LRESULT {
r1, _, _ := common.Proc(internale_CEF_Win_DefSubclassProc).Call(handle, uintptr(msg), wParam, lParam)
return types.LRESULT(r1)
}
func WinOnPaint(handle types.HWND) {
common.Proc(internale_CEF_Win_OnPaint).Call(handle)
}
func WinSetDraggableRegions(aRGN *HRGN, regions []TCefDraggableRegion) {
/*
//SetDraggableRegions 代码实现
draggableRegion := WinCreateRectRgn(0, 0, 0, 0)
WinSetRectRgn(draggableRegion, 0, 0, 0, 0)
for i := 0; i < regions.RegionsCount(); i++ {
region := regions.Region(i)
creRGN := WinCreateRectRgn(region.Bounds.X, region.Bounds.Y, region.Bounds.X+region.Bounds.Width, region.Bounds.Y+region.Bounds.Height)
if region.Draggable {
WinCombineRgn(draggableRegion, draggableRegion, creRGN, consts.RGN_OR)
} else {
WinCombineRgn(draggableRegion, draggableRegion, creRGN, consts.RGN_DIFF)
}
WinDeleteObject(creRGN)
}
fmt.Println("Check PtInRegion:", WinPtInRegion(draggableRegion, 50, 50))
*/
common.Proc(internale_CEF_Win_SetDraggableRegions).Call(uintptr(aRGN.instance), uintptr(int32(len(regions))), uintptr(unsafe.Pointer(&regions[0])), uintptr(int32(len(regions))))
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册