From 99d0bf3669a939fb09ac4ae5a0b2ddbace3d3f63 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 2 Nov 2026 09:15:06 -0300 Subject: Fix macOS stale tag borders, spacing and drag cursors --- src/macos/Sources/PardesView.swift | 25 ++++++++++++++++++------- src/macos/pardes.h | 5 +++-- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src/macos') diff --git a/src/macos/Sources/PardesView.swift b/src/macos/Sources/PardesView.swift index 4ea4475a..b51f6719 100644 --- a/src/macos/Sources/PardesView.swift +++ b/src/macos/Sources/PardesView.swift @@ -2652,22 +2652,26 @@ final class PardesView: NSView { // .inVisibleRect keeps the area correct across resizes on its own, which // is why the rect argument can be anything. addTrackingArea(NSTrackingArea(rect: .zero, - options: [.mouseMoved, .mouseEnteredAndExited, .inVisibleRect, .activeInKeyWindow], + options: [.mouseMoved, .mouseEnteredAndExited, .cursorUpdate, .inVisibleRect, .activeInKeyWindow], owner: self, userInfo: nil)) } - private enum Pointer: Equatable { case text, link, target } + private enum Pointer: Equatable { case text, link, target, grab, dragging, resizeHorizontal, resizeVertical } private var pointer: Pointer = .text /// The core's pointer_shape, in this shell's cursor vocabulary: a link /// is a PDF hyperlink (the hand), a target is a word the core's own /// Look-hover plumbing validated as a real Look or Exec operand, and - /// anything else is text — the I-beam. + /// grips and dividers carry the native drag/resize affordances. private func pointerShape() -> Pointer { switch pardes_pointer_shape() { case 1: return .link case 2: return .target + case 3: return .dragging + case 4: return .grab + case 5: return .resizeHorizontal + case 6: return .resizeVertical default: return .text } } @@ -2677,14 +2681,21 @@ final class PardesView: NSView { case .link: return .pointingHand case .target: return .arrow case .text: return .iBeam + case .grab: return .openHand + case .dragging: return .closedHand + case .resizeHorizontal: return .resizeLeftRight + case .resizeVertical: return .resizeUpDown } } + override func cursorUpdate(with event: NSEvent) { + pointer = pointerShape() + cursorFor(pointer).set() + } + override func resetCursorRects() { - // Every cell in this view is text, including the tags. An arrow over - // plain text is the wrong affordance — but a word the core has - // validated as a Look or Exec target earns it: middle- and - // right-clicking there acts, and the cursor says so before it does. + // AppKit may reset cursor rectangles between frames. Keep the current + // text, target, grip or drag affordance instead of resetting to I-beam. addCursorRect(bounds, cursor: cursorFor(pointer)) } diff --git a/src/macos/pardes.h b/src/macos/pardes.h index 33db3bb5..f9aa0ec4 100644 --- a/src/macos/pardes.h +++ b/src/macos/pardes.h @@ -519,8 +519,9 @@ bool pardes_active_dirty(void); int32_t pardes_cursor_x(void); int32_t pardes_cursor_y(void); bool pardes_cursor_bar(void); -// Mouse pointer affordance: 0 = default text pointer, 1 = link hand, -// 2 = a validated Look/Exec target under the pointer (the acme arrow). +// Mouse pointer affordance: 0 text, 1 link, 2 Look/Exec target, +// 3 carrying a pane/column, +// 4 over a draggable grip, 5 horizontal resize, 6 vertical resize. uint32_t pardes_pointer_shape(void); // The Look or Exec the core performed since this was last asked, and clears -- cgit v1.3