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 a750bf8ae17dd0dd6c14a23376d012c61367227f Mon Sep 17 00:00:00 2001
From 09bb05d23a015757c7471a4b06ce8a2c852745dc Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 02/11] ns: add accessibility base classes and text extraction
@@ -29,9 +29,9 @@ ns-accessibility-enabled.
Tested on macOS 14 Sonoma with VoiceOver 10. Builds cleanly;
no functional change (dead code until patch 5/6 wires it in).
---
src/nsterm.h | 129 +++++++++++++++
src/nsterm.m | 456 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 585 insertions(+)
src/nsterm.h | 129 ++++++++++++++
src/nsterm.m | 462 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 588 insertions(+), 3 deletions(-)
diff --git a/src/nsterm.h b/src/nsterm.h
index ea6e7ba..6e830de 100644
@@ -188,7 +188,7 @@ index ea6e7ba..6e830de 100644
diff --git a/src/nsterm.m b/src/nsterm.m
index f7875b3..cbfcf23 100644
index 40b4bc9..96805b9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -46,6 +46,7 @@ Updated by Christian Limpach (chris@nice.ch)
@@ -199,7 +199,7 @@ index f7875b3..cbfcf23 100644
#include "systime.h"
#include "character.h"
#include "xwidget.h"
@@ -7140,6 +7141,430 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
@@ -7160,6 +7161,430 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
}
#endif
@@ -630,7 +630,7 @@ index f7875b3..cbfcf23 100644
/* ==========================================================================
EmacsView implementation
@@ -11599,6 +12024,28 @@ Convert an X font name (XLFD) to an NS font name.
@@ -11619,6 +12044,28 @@ 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");
@@ -659,7 +659,16 @@ index f7875b3..cbfcf23 100644
Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier));
@@ -11747,6 +12194,15 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
@@ -11751,7 +12198,7 @@ Convert an X font name (XLFD) to an NS font name.
doc: /* Non-nil means to use native fullscreen on Mac OS X 10.7 and later.
Nil means use fullscreen the old (< 10.7) way. The old way works better with
multiple monitors, but lacks tool bar. This variable is ignored on
-Mac OS X < 10.7. Default is t. */);
+Mac OS X < 10.7. Default is nil. Set to t to enable VoiceOver support. */);
ns_use_native_fullscreen = YES;
ns_last_use_native_fullscreen = ns_use_native_fullscreen;
@@ -11767,10 +12214,19 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
This variable is ignored on Mac OS X < 10.7 and GNUstep. */);
ns_use_srgb_colorspace = YES;
@@ -669,12 +678,26 @@ index f7875b3..cbfcf23 100644
+When nil, the accessibility virtual element tree is not built and no
+notifications are posted, eliminating the associated overhead.
+Requires the Cocoa (NS) build on macOS; ignored on GNUstep.
+Default is t. */);
+ ns_accessibility_enabled = YES;
+Default is nil. Set to t to enable VoiceOver support. */);
+ ns_accessibility_enabled = NO;
+
DEFVAR_BOOL ("ns-use-mwheel-acceleration",
ns_use_mwheel_acceleration,
doc: /* Non-nil means use macOS's standard mouse wheel acceleration.
-This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */);
+This variable is ignored on macOS < 10.7 and GNUstep. Default is nil. Set to t to enable VoiceOver support. */);
ns_use_mwheel_acceleration = YES;
DEFVAR_LISP ("ns-mwheel-line-height", ns_mwheel_line_height,
@@ -11781,7 +12237,7 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
DEFVAR_BOOL ("ns-use-mwheel-momentum", ns_use_mwheel_momentum,
doc: /* Non-nil means mouse wheel scrolling uses momentum.
-This variable is ignored on macOS < 10.7 and GNUstep. Default is t. */);
+This variable is ignored on macOS < 10.7 and GNUstep. Default is nil. Set to t to enable VoiceOver support. */);
ns_use_mwheel_momentum = YES;
/* TODO: Move to common code. */
--
2.43.0