mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-24 18:38:39 +03:00
34 lines
796 B
Swift
34 lines
796 B
Swift
import SwiftUI
|
|
|
|
/// Custom subclass of NSHostingView which sinks events so that we can
|
|
/// stop the window from receiving events originating from within this view.
|
|
class EventSinkHostingView<Content: View>: NSHostingView<Content> {
|
|
override var acceptsFirstResponder: Bool {
|
|
return true
|
|
}
|
|
|
|
override func becomeFirstResponder() -> Bool {
|
|
return true
|
|
}
|
|
|
|
override func acceptsFirstMouse(for event: NSEvent?) -> Bool {
|
|
return true
|
|
}
|
|
|
|
override func mouseDown(with event: NSEvent) {
|
|
// Do nothing
|
|
}
|
|
|
|
override func mouseDragged(with event: NSEvent) {
|
|
// Do nothing
|
|
}
|
|
|
|
override func mouseUp(with event: NSEvent) {
|
|
// Do nothing
|
|
}
|
|
|
|
override var mouseDownCanMoveWindow: Bool {
|
|
return false
|
|
}
|
|
}
|