patches: fix VoiceOver rotor cursor sync on large jumps (LayoutChanged)

This commit is contained in:
2026-03-01 14:20:48 +01:00
parent 2402c50117
commit 0d4d874607

View File

@@ -1,4 +1,4 @@
From ff2517c8af798fd41f8ba7d33af7a5b4cb15d8a6 Mon Sep 17 00:00:00 2001
From 8d60434dd8fba2ca5f2bb25b2cc55fa046fbd1fb Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 16:01:29 +0100
Subject: [PATCH 8/8] ns: announce child frame completion candidates for
@@ -20,8 +20,8 @@ element when a child frame completion closes.
doc/emacs/macos.texi | 6 -
etc/NEWS | 4 +-
src/nsterm.h | 9 ++
src/nsterm.m | 276 +++++++++++++++++++++++++++++++++++++++++--
4 files changed, 277 insertions(+), 18 deletions(-)
src/nsterm.m | 290 +++++++++++++++++++++++++++++++++++++++++--
4 files changed, 291 insertions(+), 18 deletions(-)
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 6514dfc..f47929e 100644
@@ -97,7 +97,7 @@ index 21a93bc..bbce9fe 100644
@end
diff --git a/src/nsterm.m b/src/nsterm.m
index 8d44b5f..5dec999 100644
index 8d44b5f..818e0a0 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7415,6 +7415,112 @@ visual line index for Zoom (skip whitespace-only lines
@@ -274,7 +274,28 @@ index 8d44b5f..5dec999 100644
cachedTextStart = start;
if (visibleRuns)
@@ -9175,6 +9301,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
@@ -9072,6 +9198,20 @@ derive its own speech (it would read the wrong character
NSAccessibilitySelectedTextChangedNotification,
moveInfo);
+ /* For large programmatic jumps (not C-n/C-p arrow-key line moves),
+ also post LayoutChanged so VoiceOver synchronises its rotor browse
+ cursor with the new accessibilitySelectedTextRange.
+ SelectedTextChanged alone moves VoiceOver's reading cursor but
+ does not update the rotor browse cursor for multi-line jumps
+ (e.g. org ]] / [[ heading navigation, imenu, xref). */
+ if (granularity != ns_ax_text_selection_granularity_character
+ && direction != ns_ax_text_selection_direction_discontiguous
+ && !isCtrlNP)
+ NSAccessibilityPostNotificationWithUserInfo (
+ self,
+ NSAccessibilityLayoutChangedNotification,
+ @{ NSAccessibilityUIElementsKey: @[self] });
+
/* For character moves: explicit announcement of char AT point.
This is the ONLY speech source for character navigation.
Correct for evil block-cursor (cursor ON the character)
@@ -9175,6 +9315,7 @@ - (void)postCompletionAnnouncementForBuffer:(struct buffer *)b
ptrdiff_t currentOverlayStart = 0;
ptrdiff_t currentOverlayEnd = 0;
@@ -282,7 +303,7 @@ index 8d44b5f..5dec999 100644
specpdl_ref count2 = SPECPDL_INDEX ();
record_unwind_current_buffer ();
if (b != current_buffer)
@@ -9931,6 +10058,10 @@ - (void)dealloc
@@ -9931,6 +10072,10 @@ - (void)dealloc
#endif
[accessibilityElements release];
@@ -293,7 +314,7 @@ index 8d44b5f..5dec999 100644
[[self menu] release];
[super dealloc];
}
@@ -11380,6 +11511,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
@@ -11380,6 +11525,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
windowClosing = NO;
processingCompose = NO;
@@ -303,7 +324,7 @@ index 8d44b5f..5dec999 100644
scrollbarsNeedingUpdate = 0;
fs_state = FULLSCREEN_NONE;
fs_before_fs = next_maximized = -1;
@@ -12688,6 +12822,80 @@ - (id)accessibilityFocusedUIElement
@@ -12688,6 +12836,80 @@ - (id)accessibilityFocusedUIElement
The existing elements carry cached state (modiff, point) from the
previous redisplay cycle. Rebuilding first would create fresh
elements with current values, making change detection impossible. */
@@ -384,7 +405,7 @@ index 8d44b5f..5dec999 100644
- (void)postAccessibilityUpdates
{
NSTRACE ("[EmacsView postAccessibilityUpdates]");
@@ -12698,11 +12906,59 @@ - (void)postAccessibilityUpdates
@@ -12698,11 +12920,59 @@ - (void)postAccessibilityUpdates
/* Re-entrance guard: VoiceOver callbacks during notification posting
can trigger redisplay, which calls ns_update_end, which calls us