Add right-click action to the Article Extractor Button. Fixes #3695

This commit is contained in:
Maurice Parker
2022-09-27 12:02:45 -05:00
parent 9566947dee
commit d100c64d80
7 changed files with 122 additions and 12 deletions

View File

@@ -0,0 +1,36 @@
//
// MainWindow.swift
// NetNewsWire
//
// Created by Maurice Parker on 9/26/22.
// Copyright © 2022 Ranchero Software. All rights reserved.
//
import Foundation
class MainWindow: NSWindow {
override func sendEvent(_ event: NSEvent) {
// 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" {
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)
}
}