patches: fix all review issues from Opus core maintainer review

BLOCKERS fixed:
- #1: add missing skip_overlay_scan: label (goto without target)
- #2: move accessibilityLineForIndex: to patch 0002 (used in 0002/0003,
  was defined in 0007 — forward reference crash risk)
- #3: move BOOL singleLineMove to patch 0008 (declared in 0007, unused
  until 0008 — -Werror build failure)

WARNINGS fixed:
- #1: block_input ordering at 5 sites (record_unwind_protect_void must
  come AFTER block_input to avoid unmatched unblock_input on error)
- #2: deduplicate ns_ax_face_is_selected (move to patch 0001, remove
  from patch 0007 where it was duplicated)
- #4: improve childFrameLastBuffer comment (document rename edge case)
- #5: complete ChangeLog for patch 0007 (add 3 missing method entries)
- #6: document lastSelectedWindow/lastRootWindow GC safety in nsterm.h

MINOR fixed:
- #2: wrap ns_zoom_track_completion call in MAC_OS_X_VERSION >= 101000
  guard (consistent with the function definition)
- #3: @cindex Zoom verified present in VoiceOver section (already OK)
- #4: raise line_starts/line_ends bound from 128 to 512 (consistent
  with ns_ax_selected_overlay_text)
- #5: add echo_area_buffer[] lifetime comment referencing xdisp.c

All 9 patches apply cleanly (git apply verified sequentially).
This commit is contained in:
2026-03-03 20:43:56 +01:00
parent f42e799991
commit 97c14a3bd9
8 changed files with 320 additions and 144 deletions

View File

@@ -1,4 +1,4 @@
From 3f894218b771f2aa098f19dfb4bdc8b13408c8c8 Mon Sep 17 00:00:00 2001
From 411c0c3f06ad4c2d5aae2b17b809e8899ea892ba Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 6/9] ns: integrate accessibility with EmacsView and redisplay
@@ -23,8 +23,9 @@ com.apple.accessibility.api distributed notification.
(accessibilityAttributeValue:forParameter:): New methods.
---
etc/NEWS | 13 ++
src/nsterm.h | 7 +-
src/nsterm.m | 474 +++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 477 insertions(+), 10 deletions(-)
3 files changed, 483 insertions(+), 11 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 4c149e41d6..7f917f93b2 100644
@@ -50,8 +51,26 @@ 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.h b/src/nsterm.h
index f245675513..4bf79a9adb 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -590,7 +590,12 @@ typedef NS_ENUM(NSInteger, EmacsAXSpanType)
char *old_title;
BOOL maximizing_resize;
NSMutableArray *accessibilityElements;
- /* See GC safety comment on EmacsAccessibilityElement.lispWindow. */
+ /* Lisp_Object ivars not visible to GC. Both objects are always
+ reachable via the frame's live window tree, so GC cannot collect
+ them. After a window-tree rebuild (delete-window, split-window)
+ a stale EQ match would merely skip a focus notification --- the
+ worst case is one spurious VoiceOver focus event per rebuild.
+ No staticpro() needed: the window tree holds a strong reference. */
Lisp_Object lastSelectedWindow;
Lisp_Object lastRootWindow;
BOOL accessibilityTreeValid;
diff --git a/src/nsterm.m b/src/nsterm.m
index d65609cc79..4ba9b41b3b 100644
index f5e5cea074..c3cd83b774 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1393,7 +1393,8 @@ so the visual offset is (ov_line + 1) * line_h from
@@ -131,7 +150,7 @@ index d65609cc79..4ba9b41b3b 100644
- (void)antialiasThresholdDidChange:(NSNotification *)notification
{
#ifdef NS_IMPL_COCOA
@@ -7628,7 +7679,6 @@ - (id)accessibilityTopLevelUIElement
@@ -7656,7 +7707,6 @@ - (id)accessibilityTopLevelUIElement
@@ -139,7 +158,7 @@ index d65609cc79..4ba9b41b3b 100644
static BOOL
ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point,
ptrdiff_t *out_start,
@@ -8741,7 +8791,6 @@ - (NSRect)accessibilityFrame
@@ -8789,7 +8839,6 @@ - (NSRect)accessibilityFrame
@end
@@ -147,7 +166,7 @@ index d65609cc79..4ba9b41b3b 100644
/* ===================================================================
EmacsAccessibilityBuffer (Notifications) — AX event dispatch
@@ -9235,6 +9284,54 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
@@ -9283,6 +9332,54 @@ - (void)postAccessibilityNotificationsForFrame:(struct frame *)f
granularity = ns_ax_text_selection_granularity_line;
}
@@ -202,7 +221,7 @@ index d65609cc79..4ba9b41b3b 100644
/* Post notifications for focused and non-focused elements. */
if ([self isAccessibilityFocused])
[self postFocusedCursorNotification:point
@@ -9347,7 +9444,6 @@ - (NSRect)accessibilityFrame
@@ -9395,7 +9492,6 @@ - (NSRect)accessibilityFrame
@end
@@ -210,7 +229,7 @@ index d65609cc79..4ba9b41b3b 100644
/* ===================================================================
EmacsAccessibilityInteractiveSpan --- helpers and implementation
=================================================================== */
@@ -9684,6 +9780,7 @@ - (void)dealloc
@@ -9733,6 +9829,7 @@ - (void)dealloc
[layer release];
#endif
@@ -218,7 +237,7 @@ index d65609cc79..4ba9b41b3b 100644
[[self menu] release];
[super dealloc];
}
@@ -11032,6 +11129,32 @@ - (void)windowDidBecomeKey /* for direct calls */
@@ -11081,6 +11178,32 @@ - (void)windowDidBecomeKey /* for direct calls */
XSETFRAME (event.frame_or_window, emacsframe);
kbd_buffer_store_event (&event);
ns_send_appdefined (-1); // Kick main loop
@@ -251,7 +270,7 @@ index d65609cc79..4ba9b41b3b 100644
}
@@ -12269,6 +12392,332 @@ - (int) fullscreenState
@@ -12318,6 +12441,332 @@ - (int) fullscreenState
return fs_state;
}
@@ -584,7 +603,7 @@ index d65609cc79..4ba9b41b3b 100644
@end /* EmacsView */
@@ -14265,12 +14714,17 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
@@ -14314,12 +14763,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,