From 4160bdcb8faa6e105894287de2cfb9e966c050d0 Mon Sep 17 00:00:00 2001 From: zhangli10 Date: Mon, 12 Aug 2024 16:14:51 +0800 Subject: [PATCH] U: drag window, Control window resizing --- cef/browser_window_lcl_darwin.go | 10 ++++++++-- examples/frameless/frameless.go | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cef/browser_window_lcl_darwin.go b/cef/browser_window_lcl_darwin.go index 2d4c56f5..a161d2d8 100644 --- a/cef/browser_window_lcl_darwin.go +++ b/cef/browser_window_lcl_darwin.go @@ -101,7 +101,7 @@ func (m *PlatformWindow) SetBackgroundColor(red, green, blue, alpha uint8) { } func (m *PlatformWindow) Init() { - C.init() + //C.init() } func (m *LCLBrowserWindow) PlatformWindow() *PlatformWindow { @@ -112,7 +112,13 @@ func (m *LCLBrowserWindow) frameless() { nsWindow := m.PlatformWindow() nsWindow.SetTitleBarAppearsTransparent(true) nsWindow.SetTitleVisibility(types.NSWindowTitleHidden) - nsWindow.SetStyleMask(NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable) + mask := uint(NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable) + wp := m.WindowProperty() + if !wp.EnableResize { + mask ^= NSWindowStyleMaskResizable + } + nsWindow.SetStyleMask(mask) + C.setFrameless(nsWindow.Instance()) } diff --git a/examples/frameless/frameless.go b/examples/frameless/frameless.go index 851d2f66..a2c896a5 100644 --- a/examples/frameless/frameless.go +++ b/examples/frameless/frameless.go @@ -40,7 +40,8 @@ func main() { //指定一个URL地址,或本地html文件目录 cef.BrowserWindow.Config.Url = "http://localhost:22022/index.html" - //cef.BrowserWindow.Config.EnableHideCaption = true + cef.BrowserWindow.Config.EnableHideCaption = true + //cef.BrowserWindow.Config.EnableResize = false cef.BrowserWindow.Config.Title = "Energy Vue + ElementUI 示例" cef.BrowserWindow.Config.Width = 1200 cef.BrowserWindow.Config.Height = 600