patches: fix ObjC category declaration warnings

Move postAccessibilityNotificationsForFrame: declaration from
primary @interface to (Notifications) category.
Add invalidateInteractiveSpans to (InteractiveSpans) category.
Fixes 3 compiler warnings (-Wobjc-method-access,
-Wincomplete-implementation, -Wobjc-protocol-method-implementation).
This commit is contained in:
2026-02-28 12:58:18 +01:00
parent 6da6f7c90f
commit 9130268ff0
6 changed files with 44 additions and 50 deletions

View File

@@ -1,6 +1,6 @@
From 69b3f939764d4a7e5e9dc7bcb882b654364d7ca9 Mon Sep 17 00:00:00 2001 From 3bb5a0bed12de424e79a24228e6ae2b4a6e0ecf1 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 10:35:35 +0100 Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 1/6] ns: add accessibility base classes and text extraction Subject: [PATCH 1/6] ns: add accessibility base classes and text extraction
Add the foundation for macOS VoiceOver accessibility in the NS Add the foundation for macOS VoiceOver accessibility in the NS
@@ -10,19 +10,18 @@ Add the foundation for macOS VoiceOver accessibility in the NS
(EmacsAccessibilityElement): New base class. (EmacsAccessibilityElement): New base class.
(EmacsAccessibilityBuffer, EmacsAccessibilityModeLine) (EmacsAccessibilityBuffer, EmacsAccessibilityModeLine)
(EmacsAccessibilityInteractiveSpan): Forward declarations. (EmacsAccessibilityInteractiveSpan): Forward declarations.
(EmacsAccessibilityBuffer(Notifications)): New category interface.
(EmacsAccessibilityBuffer(InteractiveSpans)): New category interface.
(EmacsAXSpanType): New enum. (EmacsAXSpanType): New enum.
(EmacsView): New ivars for accessibility state. (EmacsView): New ivars for accessibility state.
* src/nsterm.m: Include intervals.h for TEXT_PROP_MEANS_INVISIBLE. * src/nsterm.m: Include intervals.h for TEXT_PROP_MEANS_INVISIBLE.
(NS_AX_TEXT_CAP): New macro, 100000. (NS_AX_TEXT_CAP): New macro, 100000.
(ns_ax_buffer_text): New function. (ns_ax_buffer_text, ns_ax_mode_line_text, ns_ax_frame_for_range)
(ns_ax_mode_line_text): New function. (ns_ax_completion_string_from_prop, ns_ax_window_buffer_object)
(ns_ax_frame_for_range): New function. (ns_ax_window_end_charpos, ns_ax_text_prop_at)
(ns_ax_completion_string_from_prop): New function. (ns_ax_next_prop_change, ns_ax_get_span_label)
(ns_ax_window_buffer_object, ns_ax_window_end_charpos)
(ns_ax_text_prop_at, ns_ax_next_prop_change)
(ns_ax_get_span_label): New utility functions.
(ns_ax_post_notification, ns_ax_post_notification_with_info): New (ns_ax_post_notification, ns_ax_post_notification_with_info): New
functions. dispatch_async wrappers preventing VoiceOver deadlock. functions.
(EmacsAccessibilityElement): Implement base class. (EmacsAccessibilityElement): Implement base class.
(syms_of_nsterm): Register accessibility DEFSYM and DEFVAR (syms_of_nsterm): Register accessibility DEFSYM and DEFVAR
ns-accessibility-enabled. ns-accessibility-enabled.
@@ -30,15 +29,15 @@ ns-accessibility-enabled.
Tested on macOS 14 Sonoma with VoiceOver 10. Builds cleanly; Tested on macOS 14 Sonoma with VoiceOver 10. Builds cleanly;
no functional change (dead code until patch 5/6 wires it in). no functional change (dead code until patch 5/6 wires it in).
--- ---
src/nsterm.h | 119 +++++++++++++ src/nsterm.h | 127 ++++++++++++++
src/nsterm.m | 468 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/nsterm.m | 468 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 587 insertions(+) 2 files changed, 595 insertions(+)
diff --git a/src/nsterm.h b/src/nsterm.h diff --git a/src/nsterm.h b/src/nsterm.h
index 7c1ee4c..393fc4c 100644 index 7c1ee4c..51c30ca 100644
--- a/src/nsterm.h --- a/src/nsterm.h
+++ b/src/nsterm.h +++ b/src/nsterm.h
@@ -453,6 +453,110 @@ enum ns_return_frame_mode @@ -453,6 +453,118 @@ enum ns_return_frame_mode
@end @end
@@ -103,11 +102,19 @@ index 7c1ee4c..393fc4c 100644
+@property (nonatomic, assign) ptrdiff_t cachedCompletionOverlayEnd; +@property (nonatomic, assign) ptrdiff_t cachedCompletionOverlayEnd;
+@property (nonatomic, assign) ptrdiff_t cachedCompletionPoint; +@property (nonatomic, assign) ptrdiff_t cachedCompletionPoint;
+- (void)invalidateTextCache; +- (void)invalidateTextCache;
+- (void)postAccessibilityNotificationsForFrame:(struct frame *)f;
+- (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx; +- (ptrdiff_t)charposForAccessibilityIndex:(NSUInteger)ax_idx;
+- (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos; +- (NSUInteger)accessibilityIndexForCharpos:(ptrdiff_t)charpos;
+@end +@end
+ +
+@interface EmacsAccessibilityBuffer (Notifications)
+- (void)postTextChangedNotification:(ptrdiff_t)point;
+- (void)postAccessibilityNotificationsForFrame:(struct frame *)f;
+@end
+
+@interface EmacsAccessibilityBuffer (InteractiveSpans)
+- (void)invalidateInteractiveSpans;
+@end
+
+/* Virtual AXStaticText element — one per mode line. */ +/* Virtual AXStaticText element — one per mode line. */
+@interface EmacsAccessibilityModeLine : EmacsAccessibilityElement +@interface EmacsAccessibilityModeLine : EmacsAccessibilityElement
+@end +@end
@@ -149,7 +156,7 @@ index 7c1ee4c..393fc4c 100644
/* ========================================================================== /* ==========================================================================
The main Emacs view The main Emacs view
@@ -471,6 +575,14 @@ enum ns_return_frame_mode @@ -471,6 +583,14 @@ enum ns_return_frame_mode
#ifdef NS_IMPL_COCOA #ifdef NS_IMPL_COCOA
char *old_title; char *old_title;
BOOL maximizing_resize; BOOL maximizing_resize;
@@ -164,7 +171,7 @@ index 7c1ee4c..393fc4c 100644
#endif #endif
BOOL font_panel_active; BOOL font_panel_active;
NSFont *font_panel_result; NSFont *font_panel_result;
@@ -528,6 +640,13 @@ enum ns_return_frame_mode @@ -528,6 +648,13 @@ enum ns_return_frame_mode
- (void)windowWillExitFullScreen; - (void)windowWillExitFullScreen;
- (void)windowDidExitFullScreen; - (void)windowDidExitFullScreen;
- (void)windowDidBecomeKey; - (void)windowDidBecomeKey;

View File

@@ -1,6 +1,6 @@
From 51b6682ecdd088835b36462caf0a94b6a4ca1aea Mon Sep 17 00:00:00 2001 From b448ae7e4c129a12a4a5485f26f706614c0da1cd Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 10:35:35 +0100 Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 2/6] ns: implement buffer accessibility element (core Subject: [PATCH 2/6] ns: implement buffer accessibility element (core
protocol) protocol)

View File

@@ -1,6 +1,6 @@
From dc701c1028f8fa4f043127564de0b3c276021327 Mon Sep 17 00:00:00 2001 From 8163e04dbc948ff24633bed534a8c66b9bc1b187 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 10:35:35 +0100 Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 3/6] ns: add buffer notification dispatch and mode-line Subject: [PATCH 3/6] ns: add buffer notification dispatch and mode-line
element element
@@ -11,14 +11,11 @@ category.
(postTextChangedNotification:): ValueChanged with edit details. (postTextChangedNotification:): ValueChanged with edit details.
(postFocusedCursorNotification:direction:granularity:markActive: (postFocusedCursorNotification:direction:granularity:markActive:
oldMarkActive:): Hybrid SelectedTextChanged / AnnouncementRequested oldMarkActive:): Hybrid SelectedTextChanged / AnnouncementRequested
per WebKit pattern. Deduplicates notification storms from per WebKit pattern.
redisplay.
(postCompletionAnnouncementForBuffer:point:): Announce completion (postCompletionAnnouncementForBuffer:point:): Announce completion
candidates in non-focused buffers. candidates in non-focused buffers.
(postAccessibilityNotificationsForFrame:): Main dispatch entry (postAccessibilityNotificationsForFrame:): Main dispatch entry point.
point: edit vs cursor-move vs no-change. (EmacsAccessibilityModeLine): Implement AXStaticText element.
(EmacsAccessibilityModeLine): Implement AXStaticText element for
mode-line readout.
Tested on macOS 14. Verified: cursor movement announcements, Tested on macOS 14. Verified: cursor movement announcements,
region selection feedback, completion popups, mode-line reading. region selection feedback, completion popups, mode-line reading.

View File

@@ -1,12 +1,9 @@
From 74f5b0e286fd771457a2d9bcb1fa455c6bb4a5e0 Mon Sep 17 00:00:00 2001 From 6626fa801e94c693d0027c3d7b02e750def95df9 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 10:35:35 +0100 Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 4/6] ns: add interactive span elements for Tab navigation Subject: [PATCH 4/6] ns: add interactive span elements for Tab navigation
* src/nsterm.m (ns_ax_scan_interactive_spans): New function. Scan * src/nsterm.m (ns_ax_scan_interactive_spans): New function.
visible range with O(n/skip) property-skip optimization. Priority:
widget > button > follow-link > org-link > completion-candidate >
keymap-overlay.
(EmacsAccessibilityInteractiveSpan): Implement AXButton/AXLink (EmacsAccessibilityInteractiveSpan): Implement AXButton/AXLink
elements with AXPress action. elements with AXPress action.
(EmacsAccessibilityBuffer(InteractiveSpans)): New category. (EmacsAccessibilityBuffer(InteractiveSpans)): New category.

View File

@@ -1,6 +1,6 @@
From 2de08fd21b94d2eec8271b162a6bbfa94576356c Mon Sep 17 00:00:00 2001 From 72a0b8bad2d200cf093d9e0c60d937032784bd74 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 10:35:35 +0100 Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 5/6] ns: integrate accessibility with EmacsView and redisplay Subject: [PATCH 5/6] ns: integrate accessibility with EmacsView and redisplay
Wire the accessibility infrastructure into EmacsView and the Wire the accessibility infrastructure into EmacsView and the
@@ -11,25 +11,18 @@ redisplay cycle. After this patch, VoiceOver and Zoom are active.
(EmacsView dealloc): Release accessibilityElements. (EmacsView dealloc): Release accessibilityElements.
(EmacsView windowDidBecomeKey): Post accessibility focus notification. (EmacsView windowDidBecomeKey): Post accessibility focus notification.
(ns_ax_collect_windows): New function. (ns_ax_collect_windows): New function.
(EmacsView rebuildAccessibilityTree): New method. (EmacsView rebuildAccessibilityTree, invalidateAccessibilityTree)
(EmacsView invalidateAccessibilityTree): New method. (accessibilityChildren, accessibilityFocusedUIElement)
(EmacsView accessibilityChildren): New method. (postAccessibilityUpdates, accessibilityBoundsForRange:)
(EmacsView accessibilityFocusedUIElement): New method. (accessibilityParameterizedAttributeNames)
(EmacsView postAccessibilityUpdates): New method. (accessibilityAttributeValue:forParameter:): New methods.
(EmacsView accessibilityBoundsForRange:): New method.
(EmacsView accessibilityParameterizedAttributeNames): New method.
(EmacsView accessibilityAttributeValue:forParameter:): New method.
* etc/NEWS: Document VoiceOver accessibility support. * etc/NEWS: Document VoiceOver accessibility support.
Tested on macOS 14 with VoiceOver and Zoom. End-to-end: buffer Tested on macOS 14 with VoiceOver and Zoom. End-to-end: buffer
navigation, cursor tracking, window switching, completions, evil-mode navigation, cursor tracking, window switching, completions, evil-mode
block cursor, org-mode folded headings, indirect buffers. block cursor, org-mode folded headings, indirect buffers.
Known limitations: Known limitations documented in patch 6 Texinfo node.
- Bidi: accessibilityRangeForPosition assumes LTR glyph layout.
- Mode-line icons: image/stretch glyphs not extracted (TODO).
- Text cap: buffers exceeding NS_AX_TEXT_CAP (100K) truncated.
- Non-ASCII: tested with CJK (UTF-16 surrogates) and combining chars.
--- ---
etc/NEWS | 13 ++ etc/NEWS | 13 ++
src/nsterm.m | 398 ++++++++++++++++++++++++++++++++++++++++++++++++++- src/nsterm.m | 398 ++++++++++++++++++++++++++++++++++++++++++++++++++-

View File

@@ -1,6 +1,6 @@
From e78b534524fec76d257db2c590a87ef61ea4f291 Mon Sep 17 00:00:00 2001 From 2865a2fccc26e339a4f649b65ab07cf323acf0d1 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz> From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 10:35:36 +0100 Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 6/6] doc: add VoiceOver accessibility section to macOS Subject: [PATCH 6/6] doc: add VoiceOver accessibility section to macOS
appendix appendix