mirror of
https://gitee.com/energye/energy.git
synced 2024-12-04 20:58:21 +08:00
Fix: Multiple display window centering issue
A: get screen info
This commit is contained in:
parent
613c1bb9e9
commit
2c9a525e51
@ -62,6 +62,7 @@ type LCLBrowserWindow struct {
|
||||
wmMoveMessage wmMove //
|
||||
wmSizeMessage wmSize //
|
||||
wmWindowPosChangedMessage wmWindowPosChanged //
|
||||
screen *lcl.TScreen //屏幕
|
||||
}
|
||||
|
||||
// NewLCLBrowserWindow 创建一个 LCL 带有 chromium 窗口
|
||||
@ -221,13 +222,13 @@ func (m *LCLBrowserWindow) AsLCLBrowserWindow() ILCLBrowserWindow {
|
||||
return m
|
||||
}
|
||||
|
||||
// SetCenterWindow 窗口居中 // TODO 多显示器时有bug
|
||||
// SetCenterWindow 窗口居中
|
||||
func (m *LCLBrowserWindow) SetCenterWindow(value bool) {
|
||||
if m.TForm == nil {
|
||||
return
|
||||
}
|
||||
if value {
|
||||
m.SetPosition(types.PoDesktopCenter)
|
||||
m.ScreenCenter()
|
||||
} else {
|
||||
m.SetPosition(types.PoDesigned)
|
||||
}
|
||||
@ -1095,6 +1096,13 @@ func (m *LCLBrowserWindow) registerDefaultChromiumCloseEvent() {
|
||||
})
|
||||
}
|
||||
|
||||
func (m *LCLBrowserWindow) Screen() *lcl.TScreen {
|
||||
if m.screen == nil {
|
||||
m.screen = lcl.NewScreen(m)
|
||||
}
|
||||
return m.screen
|
||||
}
|
||||
|
||||
// wm message event
|
||||
type messageType int32
|
||||
|
||||
|
@ -46,8 +46,9 @@ type ViewsFrameworkBrowserWindow struct {
|
||||
doOnWindowCreated WindowComponentOnWindowCreated //窗口创建
|
||||
doOnGetInitialBounds WindowComponentOnGetInitialBounds //窗口初始bounds
|
||||
regions *TCefDraggableRegions //窗口内html拖拽区域
|
||||
context *ICefRequestContext
|
||||
extraInfo *ICefDictionaryValue
|
||||
context *ICefRequestContext //
|
||||
extraInfo *ICefDictionaryValue //
|
||||
screen *lcl.TScreen //屏幕
|
||||
}
|
||||
|
||||
// NewViewsFrameworkBrowserWindow 创建 ViewsFrameworkBrowserWindow 窗口
|
||||
@ -638,6 +639,13 @@ func (m *ViewsFrameworkBrowserWindow) BrowserViewComponent() *TCEFBrowserViewCom
|
||||
return m.browserViewComponent
|
||||
}
|
||||
|
||||
func (m *ViewsFrameworkBrowserWindow) Screen() *lcl.TScreen {
|
||||
if m.screen == nil && m.BrowserViewComponent() != nil {
|
||||
m.screen = lcl.NewScreen(m.BrowserViewComponent())
|
||||
}
|
||||
return m.screen
|
||||
}
|
||||
|
||||
// RunOnMainThread
|
||||
// 在主线程中运行
|
||||
func (m *ViewsFrameworkBrowserWindow) RunOnMainThread(fn func()) {
|
||||
|
@ -116,6 +116,7 @@ type IBrowserWindow interface {
|
||||
NewSysTray() ITray //systray系统原生
|
||||
SetCreateBrowserExtraInfo(windowName string, context *ICefRequestContext, extraInfo *ICefDictionaryValue) //设置 Chromium 创建浏览器时设置的扩展信息
|
||||
RunOnMainThread(fn func()) //在UI主线程中运行
|
||||
Screen() *lcl.TScreen //返回屏幕信息
|
||||
}
|
||||
|
||||
// ILCLBrowserWindow
|
||||
|
Loading…
Reference in New Issue
Block a user