Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ extension SuggestionController {
static func makeWindow() -> NSWindow {
let window = NSWindow(
contentRect: .zero,
styleMask: [.resizable, .fullSizeContentView, .nonactivatingPanel, .utilityWindow],
styleMask: [.borderless],
backing: .buffered,
defer: false
)
Expand All @@ -97,8 +97,10 @@ extension SuggestionController {
window.hasShadow = true
window.isOpaque = false
window.tabbingMode = .disallowed
window.hidesOnDeactivate = true
window.hidesOnDeactivate = false
window.backgroundColor = .clear
window.canHide = false
window.acceptsMouseMovedEvents = true

return window
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ public final class SuggestionController: NSWindowController {
/// Opens the window as a child of another window.
public func showWindow(attachedTo parentWindow: NSWindow) {
guard let window = window else { return }

super.showWindow(nil)
parentWindow.addChildWindow(window, ordered: .above)
window.orderFront(nil)

// Close on window switch observer
// Initialized outside of `setupEventMonitors` in order to grab the parent window
Expand All @@ -118,8 +121,6 @@ public final class SuggestionController: NSWindowController {
self?.close()
}

super.showWindow(nil)
window.orderFront(nil)
window.contentViewController?.viewWillAppear()
}

Expand All @@ -134,6 +135,12 @@ public final class SuggestionController: NSWindowController {
contentViewController?.viewWillDisappear()
}

// Clean up window observers
if let observer = windowResignObserver {
NotificationCenter.default.removeObserver(observer)
windowResignObserver = nil
}

super.close()
}

Expand Down