From 9c249ef6b2d08d7b9c98f3a1fa753d0890556d12 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 21 Dec 2017 14:47:12 -0800 Subject: [PATCH] Position the window on first-run exactly once. Opening a second window should not place it in the same position as the first. --- Evergreen/MainWindow/MainWindowController.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Evergreen/MainWindow/MainWindowController.swift b/Evergreen/MainWindow/MainWindowController.swift index 556afab20..67101e0f8 100644 --- a/Evergreen/MainWindow/MainWindowController.swift +++ b/Evergreen/MainWindow/MainWindowController.swift @@ -25,6 +25,8 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { } } + static var didPositionWindowOnFirstRun = false + override func windowDidLoad() { super.windowDidLoad() @@ -34,7 +36,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { } window?.setFrameUsingName(windowAutosaveName, force: true) - if AppDefaults.shared.isFirstRun { + if AppDefaults.shared.isFirstRun && !MainWindowController.didPositionWindowOnFirstRun { if let window = window, let screen = window.screen { let width: CGFloat = 1280.0 @@ -44,6 +46,8 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations { window.setContentSize(NSSize(width: width, height: height)) window.setFrameTopLeftPoint(NSPoint(x: insetX, y: screen.visibleFrame.maxY - insetY)) + + MainWindowController.didPositionWindowOnFirstRun = true } }