mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Update right click toolbar code for Sonoma
This commit is contained in:
@@ -14,23 +14,34 @@ import Foundation
|
||||
|
||||
// Since the Toolbar intercepts right clicks we need to stop it from doing that here
|
||||
// so that the ArticleExtractorButton can receive right click events.
|
||||
if event.isRightClick,
|
||||
let frameView = contentView?.superview,
|
||||
let view = frameView.hitTest(frameView.convert(event.locationInWindow, from: nil)),
|
||||
type(of: view).description() == "NSToolbarView" {
|
||||
if #available(macOS 14.0, *) {
|
||||
if event.isRightClick,
|
||||
let frameView = contentView?.superview,
|
||||
let view = frameView.hitTest(frameView.convert(event.locationInWindow, from: nil)),
|
||||
let articleExtractorButton = view as? ArticleExtractorButton {
|
||||
|
||||
for subview in view.subviews {
|
||||
for subsubview in subview.subviews {
|
||||
let candidateView = subsubview.hitTest(subsubview.convert(event.locationInWindow, from: nil))
|
||||
if candidateView is ArticleExtractorButton {
|
||||
candidateView?.rightMouseDown(with: event)
|
||||
return
|
||||
articleExtractorButton.rightMouseDown(with: event)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if event.isRightClick,
|
||||
let frameView = contentView?.superview,
|
||||
let view = frameView.hitTest(frameView.convert(event.locationInWindow, from: nil)),
|
||||
type(of: view).description() == "NSToolbarView" {
|
||||
|
||||
for subview in view.subviews {
|
||||
for subsubview in subview.subviews {
|
||||
let candidateView = subsubview.hitTest(subsubview.convert(event.locationInWindow, from: nil))
|
||||
if candidateView is ArticleExtractorButton {
|
||||
candidateView?.rightMouseDown(with: event)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
super.sendEvent(event)
|
||||
}
|
||||
|
||||
super.sendEvent(event)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user