From 6d7b506c8a380e4dd97f337590ca079d810a360a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 15 Sep 2026 13:46:50 -0300 Subject: Follow embedded PDF links through Look --- src/macos/Sources/PardesView.swift | 12 +++++++++++- src/macos/pardes.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/macos') diff --git a/src/macos/Sources/PardesView.swift b/src/macos/Sources/PardesView.swift index bfc8a060..2160047d 100644 --- a/src/macos/Sources/PardesView.swift +++ b/src/macos/Sources/PardesView.swift @@ -809,6 +809,14 @@ final class PardesView: NSView { // whatever we do, so clipping would save fills and nothing else. Narrow // the row loops to the dirty band if that ever shows up in a profile. let count = pardes_frame() + let nextLinkPointer = pardes_pointer_shape() == 1 + if nextLinkPointer != linkPointer { + linkPointer = nextLinkPointer + window?.invalidateCursorRects(for: self) + if let window, bounds.contains(convert(window.mouseLocationOutsideOfEventStream, from: nil)) { + (linkPointer ? NSCursor.pointingHand : NSCursor.iBeam).set() + } + } let scene = pardes_scene() let trackCount = Int(pardes_frame_panel_tracks()) let tracks: UnsafeBufferPointer @@ -1967,10 +1975,12 @@ final class PardesView: NSView { userInfo: nil)) } + private var linkPointer = false + override func resetCursorRects() { // Every cell in this view is text, including the tags. An arrow over a // grid you can sweep and click words in is the wrong affordance. - addCursorRect(bounds, cursor: .iBeam) + addCursorRect(bounds, cursor: linkPointer ? .pointingHand : .iBeam) } override func setFrameSize(_ newSize: NSSize) { diff --git a/src/macos/pardes.h b/src/macos/pardes.h index 546273d9..f94e37eb 100644 --- a/src/macos/pardes.h +++ b/src/macos/pardes.h @@ -466,6 +466,8 @@ 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. +uint32_t pardes_pointer_shape(void); // The Look or Exec the core performed since this was last asked, and clears // it. Call it once per pump, after pardes_tick — the input functions run the -- cgit v1.3