patches: R3 — add missing NSTRACE to 3 EmacsView methods
This commit is contained in:
@@ -1,41 +1,24 @@
|
||||
From 2daab9a7e1018505a93bf72591a0d695352648d7 Mon Sep 17 00:00:00 2001
|
||||
From 6aca76b67027293e2656279c7622519618425bd4 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Sukany <martin@sukany.cz>
|
||||
Date: Fri, 27 Feb 2026 14:34:58 +0100
|
||||
Date: Fri, 27 Feb 2026 14:37:02 +0100
|
||||
Subject: [PATCH] ns: implement VoiceOver accessibility (AXBoundsForRange, line
|
||||
nav, completions, interactive spans)
|
||||
|
||||
* src/nsterm.h (EmacsAccessibilityElement): New base class.
|
||||
(EmacsAccessibilityBuffer): AXTextArea/AXTextField per window.
|
||||
(EmacsAccessibilityModeLine): AXStaticText for mode line.
|
||||
(EmacsAccessibilityInteractiveSpan): Focusable spans.
|
||||
(ns_ax_visible_run): Visible buffer range to AX index mapping.
|
||||
* src/nsterm.h (EmacsAccessibilityElement, EmacsAccessibilityBuffer,
|
||||
EmacsAccessibilityModeLine, EmacsAccessibilityInteractiveSpan,
|
||||
ns_ax_visible_run): New types for virtual accessibility tree.
|
||||
|
||||
* src/nsterm.m (ns_ax_buffer_text): Build AX string with
|
||||
record_unwind_current_buffer for exception safety.
|
||||
(ns_ax_utf16_length_for_buffer_range): UTF-16 length with
|
||||
record_unwind_current_buffer.
|
||||
(ns_ax_completion_text_for_span): Completion text extraction with
|
||||
record_unwind_current_buffer.
|
||||
(ns_ax_find_completion_overlay_range): Fast 3-probe + Foverlays_in
|
||||
bulk fallback.
|
||||
(ns_ax_event_is_line_nav_key): Detect C-n/C-p/Tab/backtab.
|
||||
(ns_ax_scan_interactive_spans): Forward scan for interactive props.
|
||||
(postAccessibilityUpdates): Re-entrance-guarded dispatcher.
|
||||
(rebuildAccessibilityTree): Build virtual AX element tree.
|
||||
(postAccessibilityNotificationsForFrame:): Hybrid notification
|
||||
strategy with record_unwind_current_buffer.
|
||||
(invalidateTextCache, ensureTextCache): @synchronized for
|
||||
thread safety of visibleRuns/cachedText.
|
||||
(accessibilityIndexForCharpos:, charposForAccessibilityIndex:):
|
||||
Thread-safe index mapping with @synchronized.
|
||||
(ns_draw_phys_cursor): UAZoomChangeFocus with version guard.
|
||||
* src/nsterm.m: Full VoiceOver/Zoom support with thread-safe caching,
|
||||
record_unwind_current_buffer for all buffer switches, @synchronized
|
||||
for cross-thread data access, NSTRACE debugging, Foverlays_in bulk
|
||||
queries, and MAC_OS_X_VERSION guard for UAZoom APIs.
|
||||
|
||||
* etc/NEWS: Announce VoiceOver accessibility on macOS.
|
||||
---
|
||||
etc/NEWS | 11 +
|
||||
src/nsterm.h | 108 ++
|
||||
src/nsterm.m | 2727 +++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
3 files changed, 2704 insertions(+), 142 deletions(-)
|
||||
src/nsterm.m | 2730 +++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
3 files changed, 2707 insertions(+), 142 deletions(-)
|
||||
|
||||
diff --git a/etc/NEWS b/etc/NEWS
|
||||
index 7367e3c..0e4480a 100644
|
||||
@@ -193,7 +176,7 @@ index 7c1ee4c..6455547 100644
|
||||
|
||||
|
||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||
index 932d209..fb5af6a 100644
|
||||
index 932d209..c9d058b 100644
|
||||
--- a/src/nsterm.m
|
||||
+++ b/src/nsterm.m
|
||||
@@ -46,6 +46,7 @@ Updated by Christian Limpach (chris@nice.ch)
|
||||
@@ -259,7 +242,7 @@ index 932d209..fb5af6a 100644
|
||||
ns_focus (f, NULL, 0);
|
||||
|
||||
NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
|
||||
@@ -6849,213 +6891,2263 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
|
||||
@@ -6849,213 +6891,2264 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
|
||||
|
||||
/* ==========================================================================
|
||||
|
||||
@@ -1929,6 +1912,7 @@ index 932d209..fb5af6a 100644
|
||||
+
|
||||
+- (void)postAccessibilityNotificationsForFrame:(struct frame *)f
|
||||
+{
|
||||
+ NSTRACE ("[EmacsView postAccessibilityNotificationsForFrame:]");
|
||||
+ struct window *w = [self validWindow];
|
||||
+ if (!w || !WINDOW_LEAF_P (w))
|
||||
+ return;
|
||||
@@ -2665,7 +2649,7 @@ index 932d209..fb5af6a 100644
|
||||
#define NS_KEYLOG 0
|
||||
|
||||
- (void)keyDown: (NSEvent *)theEvent
|
||||
@@ -8237,6 +10329,31 @@ - (void)windowDidBecomeKey /* for direct calls */
|
||||
@@ -8237,6 +10330,31 @@ - (void)windowDidBecomeKey /* for direct calls */
|
||||
XSETFRAME (event.frame_or_window, emacsframe);
|
||||
kbd_buffer_store_event (&event);
|
||||
ns_send_appdefined (-1); // Kick main loop
|
||||
@@ -2697,7 +2681,7 @@ index 932d209..fb5af6a 100644
|
||||
}
|
||||
|
||||
|
||||
@@ -9474,6 +11591,320 @@ - (int) fullscreenState
|
||||
@@ -9474,6 +11592,322 @@ - (int) fullscreenState
|
||||
return fs_state;
|
||||
}
|
||||
|
||||
@@ -2763,6 +2747,7 @@ index 932d209..fb5af6a 100644
|
||||
+
|
||||
+- (void)rebuildAccessibilityTree
|
||||
+{
|
||||
+ NSTRACE ("[EmacsView rebuildAccessibilityTree]");
|
||||
+ if (!emacsframe)
|
||||
+ return;
|
||||
+
|
||||
@@ -2848,6 +2833,7 @@ index 932d209..fb5af6a 100644
|
||||
+ elements with current values, making change detection impossible. */
|
||||
+- (void)postAccessibilityUpdates
|
||||
+{
|
||||
+ NSTRACE ("[EmacsView postAccessibilityUpdates]");
|
||||
+ eassert ([NSThread isMainThread]);
|
||||
+
|
||||
+ if (!emacsframe)
|
||||
@@ -3018,7 +3004,7 @@ index 932d209..fb5af6a 100644
|
||||
@end /* EmacsView */
|
||||
|
||||
|
||||
@@ -11303,6 +13734,18 @@ Convert an X font name (XLFD) to an NS font name.
|
||||
@@ -11303,6 +13737,18 @@ Convert an X font name (XLFD) to an NS font name.
|
||||
DEFSYM (Qns_drag_operation_generic, "ns-drag-operation-generic");
|
||||
DEFSYM (Qns_handle_drag_motion, "ns-handle-drag-motion");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user