patches: fix all compile errors and review issues

- ZV_S -> BUF_ZV (undefined macro)
- cf->current_buffer -> XWINDOW(cf->selected_window)->contents
  (current_buffer is a thread macro, can't use as field name)
- find_newline: add record_unwind_current_buffer + set_buffer_internal_1
- ns_zoom_track_completion: add specpdl unwind protection
- ns_zoom_face_is_selected: replace with forward decl of ns_ax_face_is_selected
  (eliminates duplicate)
- childFrameLastBuffer: struct buffer * -> Lisp_Object (safe vs kill-buffer)
- EmacsView dealloc: xfree childFrameLastCandidate (memory leak)
- postCompletionAnnouncementForBuffer: add block_input/unblock_input
This commit is contained in:
2026-03-01 03:58:04 +01:00
parent b283068f82
commit 84eb777065
9 changed files with 134 additions and 132 deletions

View File

@@ -1,4 +1,4 @@
From be594f584a94e6fccd649be029c1af30242a12ee Mon Sep 17 00:00:00 2001
From 4c7ddcb5e6f5905efefa55cb7188667744bd3d0e 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,8 @@ block cursor, org-mode folded headings, indirect buffers.
Known limitations documented in patch 6 Texinfo node.
---
etc/NEWS | 13 ++
src/nsterm.m | 376 +++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 376 insertions(+), 13 deletions(-)
src/nsterm.m | 359 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 369 insertions(+), 3 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 80661a9..2b1f9e6 100644
@@ -51,50 +51,20 @@ index 80661a9..2b1f9e6 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 86bb7b6..2e8ae20 100644
index 4692a58..93da88a 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1343,13 +1343,16 @@ so the visual offset is (ov_line + 1) * line_h from
}
if (view)
view->zoomCursorUpdated = NO;
-#endif
/* Track completion candidates for Zoom (overlay and child frame).
Runs after cursor tracking so the selected candidate overrides
the default cursor position. */
@@ -1343,6 +1343,9 @@ so the visual offset is (ov_line + 1) * line_h from
if (view)
ns_zoom_track_completion (f, view);
+#endif
#endif /* NS_IMPL_COCOA */
+
+ /* Post accessibility notifications after each redisplay cycle. */
+ [view postAccessibilityUpdates];
#endif /* NS_IMPL_COCOA */
}
@@ -3480,15 +3483,12 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
r = NSIntersectionRect (r, ns_row_rect (w, glyph_row, TEXT_AREA));
#ifdef NS_IMPL_COCOA
- /* Zoom integration: inform macOS Zoom of the cursor position.
- Zoom (System Settings -> Accessibility -> Zoom) tracks a focus
- element to keep the zoomed viewport centered on the cursor.
-
- Coordinate conversion:
- EmacsView pixels (AppKit, flipped, top-left origin)
- -> NSWindow (convertRect:toView:nil)
- -> NSScreen (convertRectToScreen:)
- -> CGRect with y-flip for CoreGraphics top-left origin. */
+ /* Store cursor rect for Zoom and VoiceOver bounds queries.
+ Zoom: UAZoomChangeFocus below.
+ VoiceOver: accessibilityBoundsForRange: fallback.
+ Coordinate conversion for Zoom:
+ EmacsView (AppKit, flipped) -> NSWindow -> NSScreen
+ -> CGRect with y-flip for CoreGraphics top-left origin. */
{
EmacsView *view = FRAME_NS_VIEW (f);
if (view && on_p && active_p)
@@ -7566,7 +7566,6 @@ - (id)accessibilityTopLevelUIElement
static void
@@ -7558,7 +7561,6 @@ - (id)accessibilityTopLevelUIElement
@@ -102,7 +72,7 @@ index 86bb7b6..2e8ae20 100644
static BOOL
ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point,
ptrdiff_t *out_start,
@@ -8661,7 +8660,6 @@ - (NSRect)accessibilityFrame
@@ -8653,7 +8655,6 @@ - (NSRect)accessibilityFrame
@end
@@ -110,7 +80,7 @@ index 86bb7b6..2e8ae20 100644
/* ===================================================================
EmacsAccessibilityBuffer (Notifications) — AX event dispatch
@@ -9206,7 +9204,6 @@ - (NSRect)accessibilityFrame
@@ -9198,7 +9199,6 @@ - (NSRect)accessibilityFrame
@end
@@ -118,7 +88,7 @@ index 86bb7b6..2e8ae20 100644
/* ===================================================================
EmacsAccessibilityInteractiveSpan — helpers and implementation
=================================================================== */
@@ -9536,6 +9533,7 @@ - (void)dealloc
@@ -9528,6 +9528,7 @@ - (void)dealloc
[layer release];
#endif
@@ -126,7 +96,7 @@ index 86bb7b6..2e8ae20 100644
[[self menu] release];
[super dealloc];
}
@@ -10884,6 +10882,32 @@ - (void)windowDidBecomeKey /* for direct calls */
@@ -10876,6 +10877,32 @@ - (void)windowDidBecomeKey /* for direct calls */
XSETFRAME (event.frame_or_window, emacsframe);
kbd_buffer_store_event (&event);
ns_send_appdefined (-1); // Kick main loop
@@ -159,7 +129,7 @@ index 86bb7b6..2e8ae20 100644
}
@@ -12121,6 +12145,332 @@ - (int) fullscreenState
@@ -12116,6 +12143,332 @@ - (int) fullscreenState
return fs_state;
}