Skip to content

Commit f7394c0

Browse files
authored
macOS: only emit a mouse exited position if we're not dragging (#7077)
Fixes #7071 When the mouse is being actively dragged, AppKit continues to emit mouseDragged events which will update our position appropriately. The mouseExit event we were sending sends a synthetic (-1, -1) position which was causing a scroll up.
2 parents 6663619 + 6d80388 commit f7394c0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

macos/Sources/Ghostty/SurfaceView_AppKit.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,13 @@ extension Ghostty {
743743
override func mouseExited(with event: NSEvent) {
744744
guard let surface = self.surface else { return }
745745

746+
// If the mouse is being dragged then we don't have to emit
747+
// this because we get mouse drag events even if we've already
748+
// exited the viewport (i.e. mouseDragged)
749+
if NSEvent.pressedMouseButtons != 0 {
750+
return
751+
}
752+
746753
// Negative values indicate cursor has left the viewport
747754
let mods = Ghostty.ghosttyMods(event.modifierFlags)
748755
ghostty_surface_mouse_pos(surface, -1, -1, mods)

0 commit comments

Comments
 (0)