mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 14:00:29 +00:00
macos: passthrough right mouse down event to TabTitleEditor if needed
This commit is contained in:
@@ -38,7 +38,7 @@ class TerminalWindow: NSWindow {
|
||||
private var tabMenuObserver: NSObjectProtocol?
|
||||
|
||||
/// Handles inline tab title editing for this host window.
|
||||
private lazy var tabTitleEditor = TabTitleEditor(
|
||||
private(set) lazy var tabTitleEditor = TabTitleEditor(
|
||||
hostWindow: self,
|
||||
delegate: self
|
||||
)
|
||||
|
||||
@@ -90,6 +90,10 @@ class TitlebarTabsTahoeTerminalWindow: TransparentTitlebarTerminalWindow, NSTool
|
||||
return
|
||||
}
|
||||
|
||||
guard !tabTitleEditor.handleRightMouseDown(event) else {
|
||||
return
|
||||
}
|
||||
|
||||
let locationInTabBar = tabBarView.convert(event.locationInWindow, from: nil)
|
||||
guard tabBarView.bounds.contains(locationInTabBar) else {
|
||||
super.sendEvent(event)
|
||||
|
||||
@@ -92,6 +92,18 @@ final class TabTitleEditor: NSObject, NSTextFieldDelegate {
|
||||
return true
|
||||
}
|
||||
|
||||
/// Handles rightMouseDown events from the host window.
|
||||
///
|
||||
/// If this returns true then the event was handled by the coordinator.
|
||||
func handleRightMouseDown(_ event: NSEvent) -> Bool {
|
||||
if isMouseEventWithinEditor(event) {
|
||||
inlineTitleEditor?.rightMouseDown(with: event)
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/// Begins editing the given target tab window title. Returns true if we're able to start the
|
||||
/// inline edit.
|
||||
@discardableResult
|
||||
|
||||
Reference in New Issue
Block a user