Position the window on first-run exactly once. Opening a second window should not place it in the same position as the first.
This commit is contained in:
parent
a4c82739b6
commit
9c249ef6b2
|
@ -25,6 +25,8 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static var didPositionWindowOnFirstRun = false
|
||||||
|
|
||||||
override func windowDidLoad() {
|
override func windowDidLoad() {
|
||||||
|
|
||||||
super.windowDidLoad()
|
super.windowDidLoad()
|
||||||
|
@ -34,7 +36,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||||
}
|
}
|
||||||
|
|
||||||
window?.setFrameUsingName(windowAutosaveName, force: true)
|
window?.setFrameUsingName(windowAutosaveName, force: true)
|
||||||
if AppDefaults.shared.isFirstRun {
|
if AppDefaults.shared.isFirstRun && !MainWindowController.didPositionWindowOnFirstRun {
|
||||||
|
|
||||||
if let window = window, let screen = window.screen {
|
if let window = window, let screen = window.screen {
|
||||||
let width: CGFloat = 1280.0
|
let width: CGFloat = 1280.0
|
||||||
|
@ -44,6 +46,8 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||||
|
|
||||||
window.setContentSize(NSSize(width: width, height: height))
|
window.setContentSize(NSSize(width: width, height: height))
|
||||||
window.setFrameTopLeftPoint(NSPoint(x: insetX, y: screen.visibleFrame.maxY - insetY))
|
window.setFrameTopLeftPoint(NSPoint(x: insetX, y: screen.visibleFrame.maxY - insetY))
|
||||||
|
|
||||||
|
MainWindowController.didPositionWindowOnFirstRun = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue