patches: fix standalone compilation + accessibility default + perf

Three fixes:
1. Patch 0000 now compiles standalone: replaced forward declaration
   of ns_ax_face_is_selected (defined in VoiceOver patches) with
   self-contained ns_zoom_face_is_selected in the Zoom patch.

2. ns_accessibility_enabled defaults to nil: eliminates ALL VoiceOver
   overhead (text cache rebuild, AX notifications, Mach IPC to AX
   server) when VoiceOver is not in use. Zero per-redisplay cost.
   Enable with (setq ns-accessibility-enabled t).

3. UAZoomEnabled() cached for 1s + ns_zoom_track_completion rate-
   limited to 2Hz: eliminates 150-600µs/frame of IPC overhead.
This commit is contained in:
2026-03-01 05:51:03 +01:00
parent 6b3843e0c6
commit 256263343d
11 changed files with 231 additions and 82 deletions

View File

@@ -1,4 +1,4 @@
From 88bcf29875755897a3d3d4cef04e2c0044ac8b9d Mon Sep 17 00:00:00 2001
From 0f7896d526a9ad17fa34c75dd7eaf15f59e070cd Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 06/11] ns: integrate accessibility with EmacsView and
@@ -52,10 +52,10 @@ 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 217f4f8..9de92fb 100644
index a056c1b..92a0dde 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1350,6 +1350,9 @@ so the visual offset is (ov_line + 1) * line_h from
@@ -1370,6 +1370,9 @@ so the visual offset is (ov_line + 1) * line_h from
if (view)
ns_zoom_track_completion (f, view);
#endif /* NS_IMPL_COCOA */
@@ -65,7 +65,7 @@ index 217f4f8..9de92fb 100644
}
static void
@@ -7565,7 +7568,6 @@ - (id)accessibilityTopLevelUIElement
@@ -7585,7 +7588,6 @@ - (id)accessibilityTopLevelUIElement
@@ -73,7 +73,7 @@ index 217f4f8..9de92fb 100644
static BOOL
ns_ax_find_completion_overlay_range (struct buffer *b, ptrdiff_t point,
ptrdiff_t *out_start,
@@ -8660,7 +8662,6 @@ - (NSRect)accessibilityFrame
@@ -8680,7 +8682,6 @@ - (NSRect)accessibilityFrame
@end
@@ -81,7 +81,7 @@ index 217f4f8..9de92fb 100644
/* ===================================================================
EmacsAccessibilityBuffer (Notifications) — AX event dispatch
@@ -9205,7 +9206,6 @@ - (NSRect)accessibilityFrame
@@ -9225,7 +9226,6 @@ - (NSRect)accessibilityFrame
@end
@@ -89,7 +89,7 @@ index 217f4f8..9de92fb 100644
/* ===================================================================
EmacsAccessibilityInteractiveSpan — helpers and implementation
=================================================================== */
@@ -9535,6 +9535,7 @@ - (void)dealloc
@@ -9555,6 +9555,7 @@ - (void)dealloc
[layer release];
#endif
@@ -97,7 +97,7 @@ index 217f4f8..9de92fb 100644
[[self menu] release];
[super dealloc];
}
@@ -10883,6 +10884,32 @@ - (void)windowDidBecomeKey /* for direct calls */
@@ -10903,6 +10904,32 @@ - (void)windowDidBecomeKey /* for direct calls */
XSETFRAME (event.frame_or_window, emacsframe);
kbd_buffer_store_event (&event);
ns_send_appdefined (-1); // Kick main loop
@@ -130,7 +130,7 @@ index 217f4f8..9de92fb 100644
}
@@ -12123,6 +12150,332 @@ - (int) fullscreenState
@@ -12143,6 +12170,332 @@ - (int) fullscreenState
return fs_state;
}