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

And Windows Drag Region
This commit is contained in:
杨红岩 2023-01-23 14:01:28 +08:00
parent 84d12153be
commit 91db993849
3 changed files with 20 additions and 12 deletions

View File

@ -12,7 +12,6 @@
package cef package cef
import ( import (
"fmt"
"github.com/energye/energy/consts" "github.com/energye/energy/consts"
"github.com/energye/golcl/lcl" "github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/rtl" "github.com/energye/golcl/lcl/rtl"
@ -90,7 +89,7 @@ func (m *customWindowCaption) onNCMouseMove(message *types.TMessage, lResult *ty
//设置鼠标图标 //设置鼠标图标
func (m *customWindowCaption) onSetCursor(message *types.TMessage, lResult *types.LRESULT, aHandled *bool) { func (m *customWindowCaption) onSetCursor(message *types.TMessage, lResult *types.LRESULT, aHandled *bool) {
if m.canBorder { //当前在边框 if m.canBorder { //当前在边框
switch LOWORD(message.LParam) { switch LOWORD(uint32(message.LParam)) {
case HTBOTTOMRIGHT, HTTOPLEFT: //右下 左上 case HTBOTTOMRIGHT, HTTOPLEFT: //右下 左上
*lResult = types.LRESULT(m.borderHT) *lResult = types.LRESULT(m.borderHT)
*aHandled = true *aHandled = true
@ -152,32 +151,34 @@ func (m *customWindowCaption) onCanBorder(x, y int32, rect *types.TRect) (int, b
//NC 鼠标左键按下 //NC 鼠标左键按下
func (m *customWindowCaption) onNCLButtonDown(hWND types.HWND, message *types.TMessage, lResult *types.LRESULT, aHandled *bool) { func (m *customWindowCaption) onNCLButtonDown(hWND types.HWND, message *types.TMessage, lResult *types.LRESULT, aHandled *bool) {
if m.canCaption { // 标题栏 if m.canCaption { // 标题栏
x, y := m.toPoint(message)
*lResult = HTCAPTION *lResult = HTCAPTION
m.borderMD = true m.borderMD = true
*aHandled = true *aHandled = true
win.ReleaseCapture() win.ReleaseCapture()
rtl.PostMessage(hWND, WM_NCLBUTTONDOWN, HTCAPTION, rtl.MakeLParam(m.toPoint(message))) rtl.PostMessage(hWND, WM_NCLBUTTONDOWN, HTCAPTION, rtl.MakeLParam(uint16(x), uint16(y)))
} else if m.canBorder { // 边框 } else if m.canBorder { // 边框
x, y := m.toPoint(message)
*lResult = types.LRESULT(m.borderHT) *lResult = types.LRESULT(m.borderHT)
m.borderMD = true m.borderMD = true
*aHandled = true *aHandled = true
win.ReleaseCapture() win.ReleaseCapture()
rtl.PostMessage(hWND, WM_SYSCOMMAND, uintptr(SC_SIZE|m.borderWMSZ), rtl.MakeLParam(m.toPoint(message))) rtl.PostMessage(hWND, WM_SYSCOMMAND, uintptr(SC_SIZE|m.borderWMSZ), rtl.MakeLParam(uint16(x), uint16(y)))
//rtl.PostMessage(hWND, WM_SYSCOMMAND, uintptr(SC_SIZE|m.borderWMSZ), 0) //rtl.PostMessage(hWND, WM_SYSCOMMAND, uintptr(SC_SIZE|m.borderWMSZ), 0)
} }
} }
//转换XY坐标 //转换XY坐标
func (m *customWindowCaption) toPoint(message *types.TMessage) (x, y uint16) { func (m *customWindowCaption) toPoint(message *types.TMessage) (x, y int32) {
return LOWORD(message.LParam), HIWORD(message.LParam) return GET_X_LPARAM(message.LParam), GET_Y_LPARAM(message.LParam)
} }
//鼠标在标题栏区域 //鼠标在标题栏区域
func (m *customWindowCaption) isCaption(hWND types.HWND, message *types.TMessage) (int32, int32, bool) { func (m *customWindowCaption) isCaption(hWND types.HWND, message *types.TMessage) (int32, int32, bool) {
dx, dy := m.toPoint(message) dx, dy := m.toPoint(message)
p := &types.TPoint{ p := &types.TPoint{
X: int32(dx), X: dx,
Y: int32(dy), Y: dy,
} }
WinScreenToClient(hWND, p) WinScreenToClient(hWND, p)
m.canCaption = WinPtInRegion(m.rgn, p.X, p.Y) m.canCaption = WinPtInRegion(m.rgn, p.X, p.Y)
@ -222,7 +223,6 @@ func (m *LCLBrowserWindow) doOnRenderCompMsg(message *types.TMessage, lResult *t
case WM_NCLBUTTONDOWN: // 161 nc left down case WM_NCLBUTTONDOWN: // 161 nc left down
m.cwcap.onNCLButtonDown(m.Handle(), message, lResult, aHandled) m.cwcap.onNCLButtonDown(m.Handle(), message, lResult, aHandled)
case WM_NCLBUTTONUP: // 162 nc l up case WM_NCLBUTTONUP: // 162 nc l up
fmt.Println("nc l up")
if m.cwcap.rgn != nil && m.cwcap.canCaption { if m.cwcap.rgn != nil && m.cwcap.canCaption {
*lResult = HTCAPTION *lResult = HTCAPTION
*aHandled = true *aHandled = true

View File

@ -198,10 +198,18 @@ func HIBYTE(w uint16) byte {
return byte(w >> 8 & 0xff) return byte(w >> 8 & 0xff)
} }
func LOWORD(dw uintptr) uint16 { func LOWORD(dw uint32) uint16 {
return uint16(dw & 0xFFFF) return uint16(dw & 0xFFFF)
} }
func HIWORD(dw uintptr) uint16 { func HIWORD(dw uint32) uint16 {
return uint16(dw >> 16 & 0xffff) return uint16(dw >> 16 & 0xffff)
} }
func GET_X_LPARAM(lp uintptr) int32 {
return int32(int16(LOWORD(uint32(lp))))
}
func GET_Y_LPARAM(lp uintptr) int32 {
return int32(int16(HIWORD(uint32(lp))))
}

View File

@ -27,8 +27,8 @@ func main() {
//browserWindow := window.AsLCLBrowserWindow().BrowserWindow() //browserWindow := window.AsLCLBrowserWindow().BrowserWindow()
//browserWindow.Constraints().SetMinWidth(300) //browserWindow.Constraints().SetMinWidth(300)
//browserWindow.Constraints().SetMinHeight(300) //browserWindow.Constraints().SetMinHeight(300)
//window.DisableResize()
window.HideTitle() window.HideTitle()
//window.DisableResize()
//browserWindow.BorderIcons().Exclude(types.BiHelp, types.BiMinimize, types.BiMaximize, types.BiSystemMenu) //browserWindow.BorderIcons().Exclude(types.BiHelp, types.BiMinimize, types.BiMaximize, types.BiSystemMenu)
//browserWindow.SetBorderStyle(types.BsSizeable) //browserWindow.SetBorderStyle(types.BsSizeable)