ghostty/macos/Sources/Helpers/EventSinkHostingView.swift
Mitchell Hashimoto 2c44e20860 macos: EventSinkHostingView must not override mouse events
This breaks split resizing. Removing this doesn't seem to have negative
effects for hidden titlebars (which it was originally made for).
2024-09-20 21:40:30 -07:00

22 lines
555 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 var mouseDownCanMoveWindow: Bool {
return false
}
}