diff --git a/patches/0004-ns-add-interactive-span-elements-for-Tab.patch b/patches/0004-ns-add-interactive-span-elements-for-Tab.patch index 6c2d71e..d04022b 100644 --- a/patches/0004-ns-add-interactive-span-elements-for-Tab.patch +++ b/patches/0004-ns-add-interactive-span-elements-for-Tab.patch @@ -1,4 +1,4 @@ -From e276b4cc0cda1504373656f664c39af7631208ad Mon Sep 17 00:00:00 2001 +From 9d99df6f95ac2011a1a9f3de448f2f0ec4c27145 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Wed, 4 Mar 2026 15:23:55 +0100 Subject: [PATCH 5/9] ns: add interactive span elements for Tab @@ -14,14 +14,32 @@ elements with an AXPress action that sends a synthetic TAB keystroke. (accessibilityChildrenInNavigationOrder): Return cached span array, rebuilding lazily when interactiveSpansDirty is set. --- - src/nsterm.m | 293 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 293 insertions(+) + src/nsterm.m | 304 +++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 293 insertions(+), 11 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m -index 84a32a05cb..c713943b30 100644 +index 84a32a05cb..b327102521 100644 --- a/src/nsterm.m +++ b/src/nsterm.m -@@ -9385,6 +9385,299 @@ - (NSRect)accessibilityFrame +@@ -7637,17 +7637,6 @@ - (id)accessibilityTopLevelUIElement + + @end + +-/* Stub implementation of InteractiveSpans category. +- The full implementation is added in a later patch. */ +-@implementation EmacsAccessibilityBuffer (InteractiveSpans) +- +-- (void)invalidateInteractiveSpans +-{ +- /* Stub: full implementation added in patch 0004. */ +-} +- +-@end +- + static BOOL + ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point, + ptrdiff_t *out_start, +@@ -9385,6 +9374,299 @@ - (NSRect)accessibilityFrame @end diff --git a/patches/0005-ns-wire-accessibility-into-EmacsView-and-redisplay.patch b/patches/0005-ns-wire-accessibility-into-EmacsView-and-redisplay.patch index f8b08ab..6d0ed49 100644 --- a/patches/0005-ns-wire-accessibility-into-EmacsView-and-redisplay.patch +++ b/patches/0005-ns-wire-accessibility-into-EmacsView-and-redisplay.patch @@ -1,4 +1,4 @@ -From 6a4b906f183f4472b3df458cdfbeb7d9dfef95f4 Mon Sep 17 00:00:00 2001 +From cba3eda4d3c50dcd77c73353c6a8d2713bfcb8ae Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Wed, 4 Mar 2026 15:23:55 +0100 Subject: [PATCH 6/9] ns: wire accessibility into EmacsView and redisplay @@ -51,7 +51,7 @@ index 4c149e41d6..7f917f93b2 100644 ** Re-introduced dictation, lost in Emacs v30 (macOS). We lost macOS dictation in v30 when migrating to NSTextInputClient. diff --git a/src/nsterm.m b/src/nsterm.m -index c713943b30..b66f350486 100644 +index b327102521..e003bca5bd 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1405,7 +1405,8 @@ so the visual offset is (ov_line + 1) * line_h from @@ -132,7 +132,7 @@ index c713943b30..b66f350486 100644 - (void)antialiasThresholdDidChange:(NSNotification *)notification { #ifdef NS_IMPL_COCOA -@@ -8780,7 +8832,6 @@ - (NSRect)accessibilityFrame +@@ -8769,7 +8821,6 @@ - (NSRect)accessibilityFrame @end @@ -140,7 +140,7 @@ index c713943b30..b66f350486 100644 /* =================================================================== EmacsAccessibilityBuffer (Notifications) — AX event dispatch -@@ -9274,6 +9325,54 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f +@@ -9263,6 +9314,54 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f granularity = ns_ax_text_selection_granularity_line; } @@ -195,7 +195,7 @@ index c713943b30..b66f350486 100644 /* Post notifications for focused and non-focused elements. */ if ([self isAccessibilityFocused]) [self postFocusedCursorNotification:point -@@ -9386,7 +9485,6 @@ - (NSRect)accessibilityFrame +@@ -9375,7 +9474,6 @@ - (NSRect)accessibilityFrame @end @@ -203,7 +203,7 @@ index c713943b30..b66f350486 100644 /* =================================================================== EmacsAccessibilityInteractiveSpan --- helpers and implementation =================================================================== */ -@@ -9723,6 +9821,7 @@ - (void)dealloc +@@ -9712,6 +9810,7 @@ - (void)dealloc [layer release]; #endif @@ -211,7 +211,7 @@ index c713943b30..b66f350486 100644 [[self menu] release]; [super dealloc]; } -@@ -11071,6 +11170,32 @@ - (void)windowDidBecomeKey /* for direct calls */ +@@ -11060,6 +11159,32 @@ - (void)windowDidBecomeKey /* for direct calls */ XSETFRAME (event.frame_or_window, emacsframe); kbd_buffer_store_event (&event); ns_send_appdefined (-1); // Kick main loop @@ -244,7 +244,7 @@ index c713943b30..b66f350486 100644 } -@@ -12308,6 +12433,332 @@ - (int) fullscreenState +@@ -12297,6 +12422,332 @@ - (int) fullscreenState return fs_state; } @@ -577,7 +577,7 @@ index c713943b30..b66f350486 100644 @end /* EmacsView */ -@@ -14304,13 +14755,17 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with +@@ -14293,13 +14744,17 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with ns_use_srgb_colorspace = YES; DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled, diff --git a/patches/0006-doc-add-VoiceOver-section-to-macOS-appendix.patch b/patches/0006-doc-add-VoiceOver-section-to-macOS-appendix.patch index 619005f..3a9cf24 100644 --- a/patches/0006-doc-add-VoiceOver-section-to-macOS-appendix.patch +++ b/patches/0006-doc-add-VoiceOver-section-to-macOS-appendix.patch @@ -1,4 +1,4 @@ -From 9845dd8500f80118b3c9bb5bdf13fdbbb897d550 Mon Sep 17 00:00:00 2001 +From a1ea69133e5a5c04076901dce47cd54683c4ca2e Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Wed, 4 Mar 2026 15:23:55 +0100 Subject: [PATCH 7/9] doc: add VoiceOver section to macOS appendix @@ -110,10 +110,10 @@ index 6bd334f48e..72ac3a9aa9 100644 @section GNUstep Support diff --git a/src/nsterm.m b/src/nsterm.m -index b66f350486..4261886974 100644 +index e003bca5bd..705c3ece06 100644 --- a/src/nsterm.m +++ b/src/nsterm.m -@@ -14756,9 +14756,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with +@@ -14745,9 +14745,13 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with DEFVAR_BOOL ("ns-accessibility-enabled", ns_accessibility_enabled, doc: /* Non-nil enables Zoom cursor tracking and VoiceOver support. diff --git a/patches/0007-ns-announce-overlay-completions-to-VoiceOver.patch b/patches/0007-ns-announce-overlay-completions-to-VoiceOver.patch index 893c98e..093040a 100644 --- a/patches/0007-ns-announce-overlay-completions-to-VoiceOver.patch +++ b/patches/0007-ns-announce-overlay-completions-to-VoiceOver.patch @@ -1,4 +1,4 @@ -From 87d1a86ca4130475a908e41928f4ee802c861372 Mon Sep 17 00:00:00 2001 +From b6bc1d102334e32dbc3e284d9e65b0f304c3e694 Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Wed, 4 Mar 2026 15:23:56 +0100 Subject: [PATCH 8/9] ns: announce overlay completions to VoiceOver @@ -43,7 +43,7 @@ index d9ae6efc2e..ff81675bb5 100644 @property (nonatomic, assign) BOOL cachedMarkActive; @property (nonatomic, copy) NSString *cachedCompletionAnnouncement; diff --git a/src/nsterm.m b/src/nsterm.m -index 4261886974..90c59c47b4 100644 +index 705c3ece06..209b8a0a1d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -7276,11 +7276,126 @@ Accessibility virtual elements (macOS / Cocoa only) @@ -174,7 +174,7 @@ index 4261886974..90c59c47b4 100644 static NSString * ns_ax_buffer_text (struct window *w, ptrdiff_t *out_start, ns_ax_visible_run **out_runs, NSUInteger *out_nruns) -@@ -7917,6 +8032,7 @@ @implementation EmacsAccessibilityBuffer +@@ -7906,6 +8021,7 @@ @implementation EmacsAccessibilityBuffer @synthesize cachedOverlayModiff; @synthesize cachedTextStart; @synthesize cachedModiff; @@ -182,7 +182,7 @@ index 4261886974..90c59c47b4 100644 @synthesize cachedPoint; @synthesize cachedMarkActive; @synthesize cachedCompletionAnnouncement; -@@ -8027,20 +8143,33 @@ - (void)ensureTextCache +@@ -8016,20 +8132,33 @@ - (void)ensureTextCache return; /* Use BUF_MODIFF, not BUF_CHARS_MODIFF, for cache validity. @@ -228,7 +228,7 @@ index 4261886974..90c59c47b4 100644 ptrdiff_t modiff = BUF_MODIFF (b); ptrdiff_t pt = BUF_PT (b); NSUInteger textLen = cachedText ? [cachedText length] : 0; -@@ -8072,9 +8201,8 @@ included in the cached AX text (it is handled separately via +@@ -8061,9 +8190,8 @@ included in the cached AX text (it is handled separately via Walk the cached text once, recording the start offset of each line. Uses NSString lineRangeForRange: --- O(N) in the total text --- but this loop runs only on cache rebuild, which is @@ -240,7 +240,7 @@ index 4261886974..90c59c47b4 100644 if (lineStartOffsets) xfree (lineStartOffsets); lineStartOffsets = NULL; -@@ -8590,26 +8718,26 @@ - (NSInteger)accessibilityInsertionPointLineNumber +@@ -8579,26 +8707,26 @@ - (NSInteger)accessibilityInsertionPointLineNumber return [self lineForAXIndex:point_idx]; } @@ -278,7 +278,7 @@ index 4261886974..90c59c47b4 100644 } - (NSInteger)accessibilityLineForIndex:(NSInteger)index -@@ -8631,6 +8759,29 @@ - (NSInteger)accessibilityLineForIndex:(NSInteger)index +@@ -8620,6 +8748,29 @@ - (NSInteger)accessibilityLineForIndex:(NSInteger)index idx = [cachedText length]; return [self lineForAXIndex:idx]; @@ -308,7 +308,7 @@ index 4261886974..90c59c47b4 100644 } - (NSRange)accessibilityRangeForIndex:(NSInteger)index -@@ -8833,7 +8984,7 @@ - (NSRect)accessibilityFrame +@@ -8822,7 +8973,7 @@ - (NSRect)accessibilityFrame /* =================================================================== @@ -317,7 +317,7 @@ index 4261886974..90c59c47b4 100644 These methods notify VoiceOver of text and selection changes. Called from the redisplay cycle (postAccessibilityUpdates). -@@ -8848,7 +8999,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point +@@ -8837,7 +8988,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point if (point > self.cachedPoint && point - self.cachedPoint == 1) { @@ -326,7 +326,7 @@ index 4261886974..90c59c47b4 100644 [self invalidateTextCache]; [self ensureTextCache]; if (cachedText) -@@ -8867,7 +9018,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point +@@ -8856,7 +9007,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point /* Update cachedPoint here so the selection-move branch does NOT fire for point changes caused by edits. WebKit and Chromium never send both ValueChanged and SelectedTextChanged for the @@ -335,7 +335,7 @@ index 4261886974..90c59c47b4 100644 self.cachedPoint = point; NSDictionary *change = @{ -@@ -9261,16 +9412,80 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f +@@ -9250,16 +9401,80 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f BOOL markActive = !NILP (BVAR (b, mark_active)); /* --- Text changed (edit) --- */ @@ -420,7 +420,7 @@ index 4261886974..90c59c47b4 100644 { ptrdiff_t oldPoint = self.cachedPoint; BOOL oldMarkActive = self.cachedMarkActive; -@@ -9288,8 +9503,14 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f +@@ -9277,8 +9492,14 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f bool isCtrlNP = ns_ax_event_is_line_nav_key (&ctrlNP); /* --- Granularity detection --- */ @@ -436,7 +436,7 @@ index 4261886974..90c59c47b4 100644 if (cachedText && oldPoint > 0) { NSUInteger tlen = [cachedText length]; -@@ -12449,7 +12670,7 @@ - (int) fullscreenState +@@ -12438,7 +12659,7 @@ - (int) fullscreenState if (WINDOW_LEAF_P (w)) { @@ -445,7 +445,7 @@ index 4261886974..90c59c47b4 100644 EmacsAccessibilityBuffer *elem = [existing objectForKey:[NSValue valueWithPointer:w]]; if (!elem) -@@ -12483,7 +12704,7 @@ - (int) fullscreenState +@@ -12472,7 +12693,7 @@ - (int) fullscreenState } else { @@ -454,7 +454,7 @@ index 4261886974..90c59c47b4 100644 Lisp_Object child = w->contents; while (!NILP (child)) { -@@ -12595,7 +12816,7 @@ - (void)postAccessibilityUpdates +@@ -12584,7 +12805,7 @@ - (void)postAccessibilityUpdates accessibilityUpdating = YES; /* Detect window tree change (split, delete, new buffer). Compare @@ -463,7 +463,7 @@ index 4261886974..90c59c47b4 100644 Lisp_Object curRoot = FRAME_ROOT_WINDOW (emacsframe); if (!EQ (curRoot, lastRootWindow)) { -@@ -12604,12 +12825,12 @@ - (void)postAccessibilityUpdates +@@ -12593,12 +12814,12 @@ - (void)postAccessibilityUpdates } /* If tree is stale, rebuild FIRST so we don't iterate freed diff --git a/patches/0008-ns-announce-child-frame-completions-to-VoiceOver.patch b/patches/0008-ns-announce-child-frame-completions-to-VoiceOver.patch index 67b5037..ab4f005 100644 --- a/patches/0008-ns-announce-child-frame-completions-to-VoiceOver.patch +++ b/patches/0008-ns-announce-child-frame-completions-to-VoiceOver.patch @@ -1,4 +1,4 @@ -From 40650cf6d2272083b62c9a60b3ef61908c3b0092 Mon Sep 17 00:00:00 2001 +From a6b1def9a83e23cc0e3325d795ac22b46eb16a5d Mon Sep 17 00:00:00 2001 From: Martin Sukany Date: Wed, 4 Mar 2026 15:23:56 +0100 Subject: [PATCH 9/9] ns: announce child frame completions to VoiceOver @@ -155,7 +155,7 @@ index ff81675bb5..9ee6c86f18 100644 @end diff --git a/src/nsterm.m b/src/nsterm.m -index 90c59c47b4..79a4fa371d 100644 +index 209b8a0a1d..13696786ab 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1287,6 +1287,12 @@ If a completion candidate is selected (overlay or child frame), @@ -304,7 +304,7 @@ index 90c59c47b4..79a4fa371d 100644 if (b != current_buffer) set_buffer_internal_1 (b); -@@ -8600,6 +8721,11 @@ - (void)setAccessibilitySelectedTextRange:(NSRange)range +@@ -8589,6 +8710,11 @@ - (void)setAccessibilitySelectedTextRange:(NSRange)range [self ensureTextCache]; @@ -316,7 +316,7 @@ index 90c59c47b4..79a4fa371d 100644 specpdl_ref count = SPECPDL_INDEX (); record_unwind_current_buffer (); /* Ensure block_input is always matched by unblock_input even if -@@ -9048,20 +9174,38 @@ - (void)postFocusedCursorNotification:(ptrdiff_t)point +@@ -9037,20 +9163,38 @@ - (void)postFocusedCursorNotification:(ptrdiff_t)point && granularity == ns_ax_text_selection_granularity_character); @@ -365,7 +365,7 @@ index 90c59c47b4..79a4fa371d 100644 ns_ax_post_notification_with_info ( self, NSAccessibilitySelectedTextChangedNotification, -@@ -9161,12 +9305,17 @@ user expectation ("w" jumps to next word and reads it). */ +@@ -9150,12 +9294,17 @@ user expectation ("w" jumps to next word and reads it). */ } } @@ -388,7 +388,7 @@ index 90c59c47b4..79a4fa371d 100644 if (cachedText && granularity == ns_ax_text_selection_granularity_line) { -@@ -9231,6 +9380,11 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b +@@ -9220,6 +9369,11 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b block_input (); specpdl_ref count2 = SPECPDL_INDEX (); @@ -400,7 +400,7 @@ index 90c59c47b4..79a4fa371d 100644 record_unwind_protect_void (unblock_input); record_unwind_current_buffer (); if (b != current_buffer) -@@ -9407,12 +9561,29 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f +@@ -9396,12 +9550,29 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f if (!b) return; @@ -430,7 +430,7 @@ index 90c59c47b4..79a4fa371d 100644 if (modiff != self.cachedModiff) { self.cachedModiff = modiff; -@@ -9426,6 +9597,7 @@ Text property changes (e.g. face updates from +@@ -9415,6 +9586,7 @@ Text property changes (e.g. face updates from { self.cachedCharsModiff = chars_modiff; [self postTextChangedNotification:point]; @@ -438,7 +438,7 @@ index 90c59c47b4..79a4fa371d 100644 } } -@@ -9448,41 +9620,49 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property +@@ -9437,41 +9609,49 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property displayed in the minibuffer. In normal editing buffers, font-lock and other modes change BUF_OVERLAY_MODIFF on every redisplay, triggering O(overlays) work per keystroke. @@ -517,7 +517,7 @@ index 90c59c47b4..79a4fa371d 100644 /* --- Cursor moved or selection changed --- Independent check from the overlay branch above. */ if (point != self.cachedPoint || markActive != self.cachedMarkActive) -@@ -9492,7 +9672,18 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property +@@ -9481,7 +9661,18 @@ frameworks like Vertico bump BOTH BUF_MODIFF (via text property self.cachedPoint = point; self.cachedMarkActive = markActive; @@ -537,7 +537,7 @@ index 90c59c47b4..79a4fa371d 100644 NSInteger direction = ns_ax_text_selection_direction_discontiguous; if (point > oldPoint) direction = ns_ax_text_selection_direction_next; -@@ -9511,6 +9702,7 @@ granularity hint (defaulting to unknown), which causes VoiceOver +@@ -9500,6 +9691,7 @@ granularity hint (defaulting to unknown), which causes VoiceOver to make its own determination. Fresh text is always available to VoiceOver via the AX getter path (accessibilityValue etc.). */ NSInteger granularity = ns_ax_text_selection_granularity_unknown; @@ -545,7 +545,7 @@ index 90c59c47b4..79a4fa371d 100644 if (cachedText && oldPoint > 0) { NSUInteger tlen = [cachedText length]; -@@ -9524,7 +9716,18 @@ to VoiceOver via the AX getter path (accessibilityValue etc.). */ +@@ -9513,7 +9705,18 @@ to VoiceOver via the AX getter path (accessibilityValue etc.). */ NSRange newLine = [cachedText lineRangeForRange: NSMakeRange (newIdx, 0)]; if (oldLine.location != newLine.location) @@ -565,7 +565,7 @@ index 90c59c47b4..79a4fa371d 100644 else { NSUInteger dist = (newIdx > oldIdx -@@ -9546,38 +9749,23 @@ to VoiceOver via the AX getter path (accessibilityValue etc.). */ +@@ -9535,38 +9738,23 @@ to VoiceOver via the AX getter path (accessibilityValue etc.). */ granularity = ns_ax_text_selection_granularity_line; } @@ -617,7 +617,7 @@ index 90c59c47b4..79a4fa371d 100644 { NSWindow *win = [self.emacsView window]; if (win) -@@ -9736,6 +9924,13 @@ - (NSRect)accessibilityFrame +@@ -9725,6 +9913,13 @@ - (NSRect)accessibilityFrame if (vis_start >= vis_end) return @[]; @@ -631,7 +631,7 @@ index 90c59c47b4..79a4fa371d 100644 block_input (); specpdl_ref blk_count = SPECPDL_INDEX (); record_unwind_protect_void (unblock_input); -@@ -10043,6 +10238,10 @@ - (void)dealloc +@@ -10032,6 +10227,10 @@ - (void)dealloc #endif [accessibilityElements release]; @@ -642,7 +642,7 @@ index 90c59c47b4..79a4fa371d 100644 [[self menu] release]; [super dealloc]; } -@@ -11492,6 +11691,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f +@@ -11481,6 +11680,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f windowClosing = NO; processingCompose = NO; @@ -652,7 +652,7 @@ index 90c59c47b4..79a4fa371d 100644 scrollbarsNeedingUpdate = 0; fs_state = FULLSCREEN_NONE; fs_before_fs = next_maximized = -1; -@@ -12800,6 +13002,156 @@ - (id)accessibilityFocusedUIElement +@@ -12789,6 +12991,156 @@ - (id)accessibilityFocusedUIElement The existing elements carry cached state (modiff, point) from the previous redisplay cycle. Rebuilding first would create fresh elements with current values, making change detection impossible. */ @@ -809,7 +809,7 @@ index 90c59c47b4..79a4fa371d 100644 - (void)postAccessibilityUpdates { NSTRACE ("[EmacsView postAccessibilityUpdates]"); -@@ -12810,11 +13162,69 @@ - (void)postAccessibilityUpdates +@@ -12799,11 +13151,69 @@ - (void)postAccessibilityUpdates /* Re-entrance guard: VoiceOver callbacks during notification posting can trigger redisplay, which calls ns_update_end, which calls us