patches: regenerate for combined application (Zoom + VoiceOver)

VoiceOver patches 0001-0008 now apply cleanly on top of Zoom patch
0000.  The full set (git am patches/000*.patch) works without
conflicts.  Patch 0005 (integration) merges Zoom fallback and
VoiceOver postAccessibilityUpdates in ns_update_end.
This commit is contained in:
2026-03-01 03:02:46 +01:00
parent 132e32795f
commit 74fcee0820
9 changed files with 96 additions and 100 deletions

View File

@@ -1,7 +1,7 @@
From d8a9886e85772c934b9f619251f301ee9baddc84 Mon Sep 17 00:00:00 2001
From 6e0de5153029aa55e8f62eddfe5cba7c25d74278 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 14:46:25 +0100
Subject: [PATCH 7/8] ns: announce overlay completion candidates for VoiceOver
Subject: [PATCH 8/9] ns: announce overlay completion candidates for VoiceOver
Completion frameworks such as Vertico, Ivy, and Icomplete render
candidates via overlay before-string/after-string properties rather
@@ -49,7 +49,7 @@ Independent overlay branch, BUF_CHARS_MODIFF gating, candidate
2 files changed, 276 insertions(+), 31 deletions(-)
diff --git a/src/nsterm.h b/src/nsterm.h
index d308a71..7a8c5a0 100644
index dd4e3da..2daa885 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -509,6 +509,7 @@ typedef struct ns_ax_visible_run
@@ -61,10 +61,10 @@ index d308a71..7a8c5a0 100644
@property (nonatomic, assign) BOOL cachedMarkActive;
@property (nonatomic, copy) NSString *cachedCompletionAnnouncement;
diff --git a/src/nsterm.m b/src/nsterm.m
index 156dba9..a6fce74 100644
index d813274..9e089f3 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6884,11 +6884,154 @@ Accessibility virtual elements (macOS / Cocoa only)
@@ -6938,11 +6938,154 @@ Accessibility virtual elements (macOS / Cocoa only)
/* ---- Helper: extract buffer text for accessibility ---- */
@@ -220,7 +220,7 @@ index 156dba9..a6fce74 100644
static NSString *
ns_ax_buffer_text (struct window *w, ptrdiff_t *out_start,
ns_ax_visible_run **out_runs, NSUInteger *out_nruns)
@@ -6959,7 +7102,7 @@ Accessibility virtual elements (macOS / Cocoa only)
@@ -7013,7 +7156,7 @@ Accessibility virtual elements (macOS / Cocoa only)
/* Extract this visible run's text. Use
Fbuffer_substring_no_properties which correctly handles the
@@ -229,7 +229,7 @@ index 156dba9..a6fce74 100644
include garbage bytes when the run spans the gap position. */
Lisp_Object lstr = Fbuffer_substring_no_properties (
make_fixnum (pos), make_fixnum (run_end));
@@ -7040,7 +7183,7 @@ Mode lines using icon fonts (e.g. doom-modeline with nerd-font)
@@ -7094,7 +7237,7 @@ Mode lines using icon fonts (e.g. doom-modeline with nerd-font)
return NSZeroRect;
/* charpos_start and charpos_len are already in buffer charpos
@@ -238,7 +238,7 @@ index 156dba9..a6fce74 100644
charposForAccessibilityIndex which handles invisible text. */
ptrdiff_t cp_start = charpos_start;
ptrdiff_t cp_end = cp_start + charpos_len;
@@ -7519,6 +7662,7 @@ @implementation EmacsAccessibilityBuffer
@@ -7573,6 +7716,7 @@ @implementation EmacsAccessibilityBuffer
@synthesize cachedOverlayModiff;
@synthesize cachedTextStart;
@synthesize cachedModiff;
@@ -246,7 +246,7 @@ index 156dba9..a6fce74 100644
@synthesize cachedPoint;
@synthesize cachedMarkActive;
@synthesize cachedCompletionAnnouncement;
@@ -7616,7 +7760,7 @@ - (void)ensureTextCache
@@ -7670,7 +7814,7 @@ - (void)ensureTextCache
NSTRACE ("EmacsAccessibilityBuffer ensureTextCache");
/* This method is only called from the main thread (AX getters
dispatch_sync to main first). Reads of cachedText/cachedTextModiff
@@ -255,7 +255,7 @@ index 156dba9..a6fce74 100644
write section at the end needs synchronization to protect
against concurrent reads from AX server thread. */
eassert ([NSThread isMainThread]);
@@ -7629,16 +7773,15 @@ - (void)ensureTextCache
@@ -7683,16 +7827,15 @@ - (void)ensureTextCache
return;
ptrdiff_t modiff = BUF_MODIFF (b);
@@ -278,7 +278,7 @@ index 156dba9..a6fce74 100644
&& cachedTextStart == BUF_BEGV (b)
&& pt >= cachedTextStart
&& (textLen == 0
@@ -7655,7 +7798,6 @@ - (void)ensureTextCache
@@ -7709,7 +7852,6 @@ - (void)ensureTextCache
[cachedText release];
cachedText = [text retain];
cachedTextModiff = modiff;
@@ -286,7 +286,7 @@ index 156dba9..a6fce74 100644
cachedTextStart = start;
if (visibleRuns)
@@ -7720,7 +7862,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
@@ -7774,7 +7916,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
/* Binary search: runs are sorted by charpos (ascending). Find the
run whose [charpos, charpos+length) range contains the target,
or the nearest run after an invisible gap. O(log n) instead of
@@ -295,7 +295,7 @@ index 156dba9..a6fce74 100644
NSUInteger lo = 0, hi = visibleRunCount;
while (lo < hi)
{
@@ -7733,7 +7875,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
@@ -7787,7 +7929,7 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
else
{
/* Found: charpos is inside this run. Compute UTF-16 delta
@@ -304,7 +304,7 @@ index 156dba9..a6fce74 100644
NSUInteger chars_in = (NSUInteger)(charpos - r->charpos);
if (chars_in == 0 || !cachedText)
return r->ax_start;
@@ -7758,10 +7900,10 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
@@ -7812,10 +7954,10 @@ - (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos
/* Convert accessibility string index to buffer charpos.
Safe to call from any thread: uses only cachedText (NSString) and
@@ -317,7 +317,7 @@ index 156dba9..a6fce74 100644
@synchronized (self)
{
if (visibleRunCount == 0)
@@ -7795,7 +7937,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
@@ -7849,7 +7991,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
return cp;
}
}
@@ -326,7 +326,7 @@ index 156dba9..a6fce74 100644
if (lo > 0)
{
ns_ax_visible_run *last = &visibleRuns[visibleRunCount - 1];
@@ -7817,7 +7959,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
@@ -7871,7 +8013,7 @@ - (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx
deadlocking the AX server thread. This is prevented by:
1. validWindow checks WINDOW_LIVE_P and BUFFERP before every
@@ -335,7 +335,7 @@ index 156dba9..a6fce74 100644
2. All dispatch_sync blocks run on the main thread where no
concurrent Lisp code can modify state between checks.
3. block_input prevents timer events and process output from
@@ -8171,6 +8313,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
@@ -8225,6 +8367,50 @@ - (NSInteger)accessibilityInsertionPointLineNumber
return [self lineForAXIndex:point_idx];
}
@@ -386,7 +386,7 @@ index 156dba9..a6fce74 100644
- (NSRange)accessibilityRangeForLine:(NSInteger)line
{
if (![NSThread isMainThread])
@@ -8393,7 +8579,7 @@ - (NSRect)accessibilityFrame
@@ -8447,7 +8633,7 @@ - (NSRect)accessibilityFrame
/* ===================================================================
@@ -395,7 +395,7 @@ index 156dba9..a6fce74 100644
These methods notify VoiceOver of text and selection changes.
Called from the redisplay cycle (postAccessibilityUpdates).
@@ -8408,7 +8594,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
@@ -8462,7 +8648,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
if (point > self.cachedPoint
&& point - self.cachedPoint == 1)
{
@@ -404,7 +404,7 @@ index 156dba9..a6fce74 100644
[self invalidateTextCache];
[self ensureTextCache];
if (cachedText)
@@ -8427,7 +8613,7 @@ - (void)postTextChangedNotification:(ptrdiff_t)point
@@ -8481,7 +8667,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
@@ -413,7 +413,7 @@ index 156dba9..a6fce74 100644
self.cachedPoint = point;
NSDictionary *change = @{
@@ -8760,14 +8946,72 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
@@ -8814,14 +9000,72 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
BOOL markActive = !NILP (BVAR (b, mark_active));
/* --- Text changed (edit) --- */
@@ -488,7 +488,7 @@ index 156dba9..a6fce74 100644
per the WebKit/Chromium pattern. */
else if (point != self.cachedPoint || markActive != self.cachedMarkActive)
{
@@ -8937,7 +9181,7 @@ - (NSRect)accessibilityFrame
@@ -8991,7 +9235,7 @@ - (NSRect)accessibilityFrame
/* ===================================================================
@@ -497,7 +497,7 @@ index 156dba9..a6fce74 100644
=================================================================== */
/* Scan visible range of window W for interactive spans.
@@ -9145,7 +9389,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
@@ -9199,7 +9443,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
dispatch_async (dispatch_get_main_queue (), ^{
/* lwin is a Lisp_Object captured by value. This is GC-safe
because Lisp_Objects are tagged integers/pointers that
@@ -506,7 +506,7 @@ index 156dba9..a6fce74 100644
Emacs. The WINDOW_LIVE_P check below guards against the
window being deleted between capture and execution. */
if (!WINDOWP (lwin) || NILP (Fwindow_live_p (lwin)))
@@ -9171,7 +9415,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
@@ -9225,7 +9469,7 @@ - (void) setAccessibilityFocused: (BOOL) focused
@end
@@ -515,7 +515,7 @@ index 156dba9..a6fce74 100644
Methods are kept here (same .m file) so they access the ivars
declared in the @interface ivar block. */
@implementation EmacsAccessibilityBuffer (InteractiveSpans)
@@ -11893,7 +12137,7 @@ - (int) fullscreenState
@@ -11947,7 +12191,7 @@ - (int) fullscreenState
if (WINDOW_LEAF_P (w))
{
@@ -524,7 +524,7 @@ index 156dba9..a6fce74 100644
EmacsAccessibilityBuffer *elem
= [existing objectForKey:[NSValue valueWithPointer:w]];
if (!elem)
@@ -11927,7 +12171,7 @@ - (int) fullscreenState
@@ -11981,7 +12225,7 @@ - (int) fullscreenState
}
else
{
@@ -533,7 +533,7 @@ index 156dba9..a6fce74 100644
Lisp_Object child = w->contents;
while (!NILP (child))
{
@@ -12039,7 +12283,7 @@ - (void)postAccessibilityUpdates
@@ -12093,7 +12337,7 @@ - (void)postAccessibilityUpdates
accessibilityUpdating = YES;
/* Detect window tree change (split, delete, new buffer). Compare
@@ -542,7 +542,7 @@ index 156dba9..a6fce74 100644
Lisp_Object curRoot = FRAME_ROOT_WINDOW (emacsframe);
if (!EQ (curRoot, lastRootWindow))
{
@@ -12048,12 +12292,12 @@ - (void)postAccessibilityUpdates
@@ -12102,12 +12346,12 @@ - (void)postAccessibilityUpdates
}
/* If tree is stale, rebuild FIRST so we don't iterate freed