macos: notify core of mouse exit

This commit is contained in:
Mitchell Hashimoto
2024-10-06 15:09:37 -10:00
parent 65c907ddab
commit 227eda1d09

View File

@ -354,6 +354,7 @@ extension Ghostty {
addTrackingArea(NSTrackingArea(
rect: frame,
options: [
.mouseEnteredAndExited,
.mouseMoved,
// Only send mouse events that happen in our visible (not obscured) rect
@ -486,6 +487,14 @@ extension Ghostty {
super.rightMouseUp(with: event)
}
override func mouseExited(with event: NSEvent) {
guard let surface = self.surface else { return }
// Negative values indicate cursor has left the viewport
let mods = Ghostty.ghosttyMods(event.modifierFlags)
ghostty_surface_mouse_pos(surface, -1, -1, mods)
}
override func mouseMoved(with event: NSEvent) {
guard let surface = self.surface else { return }