Skip to content

Commit

Permalink
fix: Ignore mouse clicks in non-focused windows (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmorley authored Mar 29, 2024
1 parent 5ecedbe commit 3eecaa0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Folders/Views/InteractiveCollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class InteractiveCollectionView: NSCollectionView {

override func mouseDown(with event: NSEvent) {

// Ignore events if we're not the key window.
guard (self.window?.isKeyWindow ?? false) else {
return
}

window?.makeFirstResponder(self)

let position = self.convert(event.locationInWindow, from: nil)
Expand Down Expand Up @@ -170,6 +175,12 @@ class InteractiveCollectionView: NSCollectionView {
}

override func mouseUp(with event: NSEvent) {

// Ignore events if we're not the key window.
guard (self.window?.isKeyWindow ?? false) else {
return
}

super.mouseUp(with: event)

// Handle double-click.
Expand Down

0 comments on commit 3eecaa0

Please sign in to comment.