mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-30 15:08:38 +00:00
mouse button callbacks returns bool for consumption
This commit is contained in:
@@ -471,15 +471,39 @@ extension Ghostty {
|
||||
|
||||
|
||||
override func rightMouseDown(with event: NSEvent) {
|
||||
guard let surface = self.surface else { return }
|
||||
guard let surface = self.surface else { return super.rightMouseDown(with: event) }
|
||||
|
||||
let mods = Ghostty.ghosttyMods(event.modifierFlags)
|
||||
ghostty_surface_mouse_button(surface, GHOSTTY_MOUSE_PRESS, GHOSTTY_MOUSE_RIGHT, mods)
|
||||
if (ghostty_surface_mouse_button(
|
||||
surface,
|
||||
GHOSTTY_MOUSE_PRESS,
|
||||
GHOSTTY_MOUSE_RIGHT,
|
||||
mods
|
||||
)) {
|
||||
// Consumed
|
||||
return
|
||||
}
|
||||
|
||||
// Mouse event not consumed
|
||||
super.rightMouseDown(with: event)
|
||||
}
|
||||
|
||||
override func rightMouseUp(with event: NSEvent) {
|
||||
guard let surface = self.surface else { return }
|
||||
guard let surface = self.surface else { return super.rightMouseUp(with: event) }
|
||||
|
||||
let mods = Ghostty.ghosttyMods(event.modifierFlags)
|
||||
ghostty_surface_mouse_button(surface, GHOSTTY_MOUSE_RELEASE, GHOSTTY_MOUSE_RIGHT, mods)
|
||||
if (ghostty_surface_mouse_button(
|
||||
surface,
|
||||
GHOSTTY_MOUSE_RELEASE,
|
||||
GHOSTTY_MOUSE_RIGHT,
|
||||
mods
|
||||
)) {
|
||||
// Handled
|
||||
return
|
||||
}
|
||||
|
||||
// Mouse event not consumed
|
||||
super.rightMouseUp(with: event)
|
||||
}
|
||||
|
||||
override func mouseMoved(with event: NSEvent) {
|
||||
@@ -842,6 +866,11 @@ extension Ghostty {
|
||||
ghostty_surface_key(surface, key_ev)
|
||||
}
|
||||
}
|
||||
|
||||
override func menu(for event: NSEvent) -> NSMenu? {
|
||||
Ghostty.logger.warning("menu: event!")
|
||||
return nil
|
||||
}
|
||||
|
||||
// MARK: Menu Handlers
|
||||
|
||||
|
Reference in New Issue
Block a user