Skip to content

Commit

Permalink
Fix context menu issue by converting NSWindow point to be relative to…
Browse files Browse the repository at this point in the history
… the NSBrowser. Fixes #31.
  • Loading branch information
jnross committed Jul 6, 2023
1 parent 855556d commit 5001259
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Bluetility/PasteboardBrowser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ class PasteboardBrowser: NSBrowser {
}

override func menu(for event: NSEvent) -> NSMenu? {
let point = event.locationInWindow
let windowPoint = event.locationInWindow
let viewPoint = self.convert(windowPoint, from: window?.contentView)
var row: Int = 0
var column: Int = 0
guard getRow(&row, column: &column, for: point) else { return nil }
guard getRow(&row, column: &column, for: viewPoint) else { return nil }
selectRow(row, inColumn: column)
self.sendAction()

Expand Down

0 comments on commit 5001259

Please sign in to comment.