mirror of
https://gitee.com/energye/energy.git
synced 2024-12-02 11:47:37 +08:00
U: frameless for windows LCL, Border style reflects,
This commit is contained in:
parent
00fdcd0a8a
commit
d46f3f043c
@ -44,16 +44,21 @@ func (m *LCLBrowserWindow) wndProc(hwnd types.HWND, message uint32, wParam, lPar
|
||||
// See: https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmextendframeintoclientarea#remarks
|
||||
extendFrameIntoClientArea(m.Handle(), margins{CxLeftWidth: 1, CxRightWidth: 1, CyTopHeight: 1, CyBottomHeight: 1})
|
||||
case messages.WM_NCCALCSIZE:
|
||||
// Disable the standard frame by allowing the client area to take the full
|
||||
// window size.
|
||||
// Trigger condition: Change the window size
|
||||
// Disable the standard frame by allowing the client area to take the full window size.
|
||||
// See: https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-nccalcsize#remarks
|
||||
// This hides the titlebar and also disables the resizing from user interaction because the standard frame is not
|
||||
// shown. We still need the WS_THICKFRAME style to enable resizing from the frontend.
|
||||
if wParam != 0 {
|
||||
//cycaption := win.GetSystemMetrics(4)
|
||||
//rect := (*types.TRect)(unsafe.Pointer(lParam))
|
||||
//rect.Bottom += -1
|
||||
//rect.Right += -1
|
||||
// Content overflow screen issue when maximizing borderless windows
|
||||
// See: https://github.com/MicrosoftEdge/WebView2Feedback/issues/2549
|
||||
//isMinimize := uint32(win.GetWindowLong(m.Handle(), win.GWL_STYLE))&win.WS_MINIMIZE != 0
|
||||
isMaximize := uint32(win.GetWindowLong(m.Handle(), win.GWL_STYLE))&win.WS_MAXIMIZE != 0
|
||||
if isMaximize {
|
||||
rect := (*types.TRect)(unsafe.Pointer(lParam))
|
||||
workRect := m.Monitor().WorkareaRect()
|
||||
*rect = workRect
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ func (m *LCLBrowserWindow) doOnRenderCompMsg(chromiumBrowser ICEFChromiumBrowser
|
||||
// 判断当前鼠标是否在边框范围
|
||||
// 窗口边框和CEF组件边框
|
||||
|
||||
handled := m.cwcap.onCanBorder(chromiumBrowser, x, y, &rect)
|
||||
handled := m.cwcap.onCanBorder(chromiumBrowser, x, y, rect)
|
||||
if handled {
|
||||
// 鼠标在边框位置
|
||||
*lResult = types.LRESULT(m.cwcap.borderHT)
|
||||
|
@ -50,19 +50,6 @@ func (m *customWindowCaption) onNCMouseMove(hWND types.HWND, message *types.TMes
|
||||
} else if m.canBorder { // 当前在边框
|
||||
*lResult = types.LRESULT(m.borderHT)
|
||||
*aHandled = true
|
||||
//全屏时不允许移动窗口
|
||||
// TODO 暂时不使用,配合 WndProc
|
||||
//if m.bw.WindowProperty().current.ws == types.WsFullScreen {
|
||||
// return
|
||||
//}
|
||||
//s := winapi.GetKeyState(winapi.VK_LBUTTON) & 0x800
|
||||
//if winapi.GetKeyState(winapi.VK_LBUTTON) < 0 {
|
||||
// x, y := m.toPoint(message)
|
||||
// m.borderMD = true
|
||||
// if win.ReleaseCapture() {
|
||||
// win.PostMessage(hWND, messages.WM_SYSCOMMAND, uintptr(messages.SC_SIZE|m.borderWMSZ), rtl.MakeLParam(uint16(x), uint16(y)))
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +78,7 @@ func (m *customWindowCaption) onSetCursor(message *types.TMessage, lResult *type
|
||||
}
|
||||
|
||||
// 鼠标是否在边框,并返回当前鼠标样式
|
||||
func (m *customWindowCaption) onCanBorder(chromiumBrowser ICEFChromiumBrowser, x, y int32, windowRect *types.TRect) bool {
|
||||
func (m *customWindowCaption) onCanBorder(chromiumBrowser ICEFChromiumBrowser, x, y int32, windowRect types.TRect) bool {
|
||||
width := windowRect.Width()
|
||||
height := windowRect.Height()
|
||||
bda := chromiumBrowser.BroderDirectionAdjustments()
|
||||
|
Loading…
Reference in New Issue
Block a user