diff --git a/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch b/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch index 8d77379..029edd4 100644 --- a/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch +++ b/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch @@ -1,5 +1,5 @@ From: Martin Sukany -Date: Tue, 25 Feb 2026 20:45:00 +0100 +Date: Tue, 25 Feb 2026 21:00:00 +0100 Subject: [PATCH] ns: implement macOS Zoom cursor tracking and VoiceOver support @@ -25,9 +25,9 @@ Add comprehensive accessibility support for macOS: FocusedUIElementChanged (window focus) Ref: https://developer.apple.com/documentation/appkit/nsaccessibilityprotocol -accessibilityFrame returns the view's frame (not cursor rect) to avoid -VoiceOver drawing a duplicate cursor overlay. Cursor position is exposed -only via accessibilityBoundsForRange:. +Uses raw string literals ("AXTextStateChangeType" etc.) for semi-private +notification keys to avoid type conflicts between SDK versions (these +symbols were added to public AppKit headers in macOS 26). --- diff --git a/src/nsterm.h b/src/nsterm.h index 7c1ee4c..5e5f61b 100644 @@ -45,22 +45,20 @@ index 7c1ee4c..5e5f61b 100644 /* AppKit-side interface. */ diff --git a/src/nsterm.m b/src/nsterm.m -index 932d209..8dc5915 100644 +index 932d209..6bfc080 100644 --- a/src/nsterm.m +++ b/src/nsterm.m -@@ -3232,6 +3232,117 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. +@@ -3232,6 +3232,115 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. /* Prevent the cursor from being drawn outside the text area. */ r = NSIntersectionRect (r, ns_row_rect (w, glyph_row, TEXT_AREA)); +#ifdef NS_IMPL_COCOA -+ /* Semi-private NSAccessibility keys for rich text change notifications. -+ These symbols are exported by AppKit.framework (macOS 10.11+) and used -+ by WebKit for VoiceOver typing echo. Declared extern here because -+ they are not in the public AppKit headers. */ -+ extern NSString *NSAccessibilityTextStateChangeTypeKey; -+ extern NSString *NSAccessibilityTextChangeValues; -+ extern NSString *NSAccessibilityTextEditType; -+ extern NSString *NSAccessibilityTextChangeValue; ++ /* NSAccessibility keys for rich text change notifications. ++ Used by WebKit/Safari for VoiceOver typing echo. These symbols ++ have been exported by AppKit since macOS 10.11 but were only ++ added to the public headers in the macOS 26 SDK. We use raw ++ string literals here to avoid redeclaration type conflicts ++ across different SDK versions. */ + + /* Accessibility cursor tracking for macOS Zoom and VoiceOver. + @@ -121,12 +119,12 @@ index 932d209..8dc5915 100644 + kAXTextStateChangeTypeEdit = 1, kAXTextEditTypeTyping = 3. */ + + NSDictionary *change = @{ -+ NSAccessibilityTextEditType: @3, -+ NSAccessibilityTextChangeValue: changedText ++ @"AXTextEditType": @3, ++ @"AXTextChangeValue": changedText + }; + NSDictionary *userInfo = @{ -+ NSAccessibilityTextStateChangeTypeKey: @1, -+ NSAccessibilityTextChangeValues: @[change] ++ @"AXTextStateChangeType": @1, ++ @"AXTextChangeValues": @[change] + }; + NSAccessibilityPostNotificationWithUserInfo ( + view, NSAccessibilityValueChangedNotification, userInfo); @@ -166,7 +164,7 @@ index 932d209..8dc5915 100644 ns_focus (f, NULL, 0); NSGraphicsContext *ctx = [NSGraphicsContext currentContext]; -@@ -8237,6 +8348,14 @@ - (void)windowDidBecomeKey /* for direct calls */ +@@ -8237,6 +8346,14 @@ - (void)windowDidBecomeKey /* for direct calls */ XSETFRAME (event.frame_or_window, emacsframe); kbd_buffer_store_event (&event); ns_send_appdefined (-1); // Kick main loop @@ -181,7 +179,7 @@ index 932d209..8dc5915 100644 } -@@ -9474,6 +9593,421 @@ - (int) fullscreenState +@@ -9474,6 +9591,421 @@ - (int) fullscreenState return fs_state; }