mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-18 16:30:29 +00:00
Stop assuming that NSNotification => window.isVisible.
This commit is contained in:
parent
5d154e3d0c
commit
e72cfbf447
@ -144,12 +144,13 @@ class MachineDocument:
|
|||||||
private var interactionMode: InteractionMode = .notStarted
|
private var interactionMode: InteractionMode = .notStarted
|
||||||
|
|
||||||
// Attempting to show a sheet before the window is visible (such as when the NIB is loaded) results in
|
// Attempting to show a sheet before the window is visible (such as when the NIB is loaded) results in
|
||||||
// a sheet mysteriously floating on its own. For now, use windowDidUpdate as a proxy to know that the window
|
// a sheet mysteriously floating on its own. For now, use windowDidUpdate as a proxy to check whether
|
||||||
// is visible, though it's a little premature.
|
// the window is visible.
|
||||||
func windowDidUpdate(_ notification: Notification) {
|
func windowDidUpdate(_ notification: Notification) {
|
||||||
|
if let window = self.windowControllers[0].window, window.isVisible {
|
||||||
// Grab the regular window title, if it's not already stored.
|
// Grab the regular window title, if it's not already stored.
|
||||||
if self.unadornedWindowTitle.count == 0 {
|
if self.unadornedWindowTitle.count == 0 {
|
||||||
self.unadornedWindowTitle = self.windowControllers[0].window!.title
|
self.unadornedWindowTitle = window.title
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an interaction mode is not yet in effect, pick the proper one and display the relevant thing.
|
// If an interaction mode is not yet in effect, pick the proper one and display the relevant thing.
|
||||||
@ -172,7 +173,8 @@ class MachineDocument:
|
|||||||
self.interactionMode = .showingMachinePicker
|
self.interactionMode = .showingMachinePicker
|
||||||
Bundle.main.loadNibNamed("MachinePicker", owner: self, topLevelObjects: nil)
|
Bundle.main.loadNibNamed("MachinePicker", owner: self, topLevelObjects: nil)
|
||||||
self.machinePicker?.establishStoredOptions()
|
self.machinePicker?.establishStoredOptions()
|
||||||
self.windowControllers[0].window?.beginSheet(self.machinePickerPanel!, completionHandler: nil)
|
window.beginSheet(self.machinePickerPanel!, completionHandler: nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user