Skip to content

Commit 858d305

Browse files
authored
fix: Ignore mouse clicks in non-focused windows (#18)
1 parent 9a0a461 commit 858d305

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Sources/SelectableCollectionView/Views/InteractiveCollectionView.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,14 @@ class InteractiveCollectionView: NSCollectionView {
7979
return super.menu(for: event)
8080
}
8181

82-
override func mouseDown(with event: NSEvent) {
82+
override func hitTest(_ point: NSPoint) -> NSView? {
83+
guard NSApp.isActive else {
84+
return nil
85+
}
86+
return super.hitTest(point)
87+
}
8388

89+
override func mouseDown(with event: NSEvent) {
8490
window?.makeFirstResponder(self)
8591

8692
let position = self.convert(event.locationInWindow, from: nil)

0 commit comments

Comments
 (0)