v9 patch: fix macOS 26 SDK compilation error

Replace extern NSString* declarations with raw string literals
(@"AXTextStateChangeType" etc.) to avoid redeclaration type conflict
with NSAccessibilityConstants.h on macOS 26 Tahoe SDK where these
symbols were added to public headers.
This commit is contained in:
2026-02-25 20:49:12 +01:00
parent 5529418b48
commit 01ea5d1f0a

View File

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