patches: fix forward dependency (helpers moved to patch 1)

This commit is contained in:
2026-02-28 10:24:39 +01:00
parent 5016155c8a
commit fa28bb52e1
5 changed files with 197 additions and 192 deletions

View File

@@ -1,29 +1,34 @@
From 9ec896a226144676a36908938899fc90c2f5730b Mon Sep 17 00:00:00 2001
From a846de7dda7051a80f363b5f5db916db7868fde6 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 10:10:55 +0100
Date: Sat, 28 Feb 2026 10:24:31 +0100
Subject: [PATCH 4/5] ns: integrate accessibility with EmacsView and redisplay
Wire the accessibility infrastructure into EmacsView and the
redisplay cycle.
redisplay cycle. After this patch, VoiceOver and Zoom are active.
* src/nsterm.m (ns_update_end): Call [view postAccessibilityUpdates].
(ns_draw_phys_cursor): Store cursor rect; call UAZoomChangeFocus.
(EmacsView dealloc): Release accessibilityElements.
(EmacsView windowDidBecomeKey): Post FocusedUIElementChanged and
SelectedTextChanged.
(ns_ax_collect_windows): New function. Walk window tree creating
virtual elements.
(EmacsView windowDidBecomeKey): Post accessibility focus notification.
(ns_ax_collect_windows): New function.
(EmacsView rebuildAccessibilityTree): New method.
(EmacsView invalidateAccessibilityTree): New method.
(EmacsView accessibilityChildren): New method.
(EmacsView accessibilityFocusedUIElement): New method.
(EmacsView postAccessibilityUpdates): New method. Detect tree
change, window switch, per-buffer changes; re-entrance guard.
(EmacsView accessibilityBoundsForRange:): New method. Cursor rect
for Zoom with focused-element delegation.
(EmacsView postAccessibilityUpdates): New method.
(EmacsView accessibilityBoundsForRange:): New method.
(EmacsView accessibilityParameterizedAttributeNames): New method.
(EmacsView accessibilityAttributeValue:forParameter:): New method.
* etc/NEWS: Document VoiceOver accessibility support.
Tested on macOS 14 with VoiceOver and Zoom. Full end-to-end: buffer
navigation, cursor tracking, window switching, completions, evil-mode
block cursor, org-mode folded headings, indirect buffers.
Known limitations:
- Bidi: accessibilityRangeForPosition assumes LTR glyph layout.
- Mode-line icons: image/stretch glyphs not extracted.
- Text cap: buffers exceeding NS_AX_TEXT_CAP (100K) truncated.
---
etc/NEWS | 13 ++
src/nsterm.m | 397 ++++++++++++++++++++++++++++++++++++++++++++++++++-
@@ -54,7 +59,7 @@ index 7367e3c..608650e 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 db5e4b3..421a6a4 100644
index 10b63f4..d7ff6c3 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1105,6 +1105,11 @@ ns_update_end (struct frame *f)
@@ -113,7 +118,7 @@ index db5e4b3..421a6a4 100644
ns_focus (f, NULL, 0);
NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
@@ -7180,7 +7222,6 @@ enum {
@@ -7293,7 +7335,6 @@ ns_ax_post_notification_with_info (id element,
@@ -121,7 +126,7 @@ index db5e4b3..421a6a4 100644
static BOOL
ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point,
ptrdiff_t *out_start,
@@ -8798,7 +8839,6 @@ ns_ax_completion_text_for_span (EmacsAccessibilityBuffer *elem,
@@ -8911,7 +8952,6 @@ ns_ax_completion_text_for_span (EmacsAccessibilityBuffer *elem,
@end
@@ -129,7 +134,7 @@ index db5e4b3..421a6a4 100644
/* ===================================================================
EmacsAccessibilityInteractiveSpan — helpers and implementation
=================================================================== */
@@ -9245,6 +9285,7 @@ ns_ax_scan_interactive_spans (struct window *w,
@@ -9241,6 +9281,7 @@ ns_ax_scan_interactive_spans (struct window *w,
[layer release];
#endif
@@ -137,7 +142,7 @@ index db5e4b3..421a6a4 100644
[[self menu] release];
[super dealloc];
}
@@ -10593,6 +10634,32 @@ ns_in_echo_area (void)
@@ -10589,6 +10630,32 @@ ns_in_echo_area (void)
XSETFRAME (event.frame_or_window, emacsframe);
kbd_buffer_store_event (&event);
ns_send_appdefined (-1); // Kick main loop
@@ -170,7 +175,7 @@ index db5e4b3..421a6a4 100644
}
@@ -11830,6 +11897,332 @@ ns_in_echo_area (void)
@@ -11826,6 +11893,332 @@ ns_in_echo_area (void)
return fs_state;
}