From e1529000047550de2858e5cd92fd70d88bce70b6 Mon Sep 17 00:00:00 2001 From: Daneel Date: Thu, 26 Feb 2026 08:46:34 +0100 Subject: [PATCH] v13 patch: fix MRC weak property error (unsafe_unretained) --- ...oundsForRange-for-macOS-Zoom-cursor-.patch | 89 ++++++------------- 1 file changed, 26 insertions(+), 63 deletions(-) diff --git a/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch b/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch index 4d5b1e1..f614aa4 100644 --- a/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch +++ b/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch @@ -8,54 +8,17 @@ movement, and announce window switches on macOS. New classes: - EmacsAccessibilityElement: base class with coordinate conversion - (Emacs pixel coords → NSView → screen coordinates) -- EmacsAccessibilityBuffer: AXTextArea virtual element, one per visible - Emacs window, implementing full text navigation protocol +- EmacsAccessibilityBuffer: AXTextArea virtual element per Emacs window -EmacsView changes: -- Role: AXGroup (container for buffer elements) -- Dynamic children built by walking Emacs window tree - (FRAME_ROOT_WINDOW traversal, WINDOW_LEAF_P filtering) -- postAccessibilityUpdates called from ns_update_end hook -- Notifications: AXValueChanged (rich typing echo on edits), - AXSelectedTextChanged, AXFocusedUIElementChanged - -Text extraction via glyph row iteration (CHAR_GLYPH glyphs), -exposing exactly what is rendered on screen, capped at 32KB. -Point-to-index mapping uses glyph charpos for accuracy. -Line navigation uses glyph_row vpos (visual screen lines). - -UAZoomChangeFocus() retained for macOS Zoom viewport tracking. - -Architecture modeled after TextMate's OakTextView accessibility -(~300 lines manual accessibility on custom NSView) and Xcode's -AXGroup → AXTextArea virtual element pattern. - -Refs: -- Apple NSAccessibility protocol: - https://developer.apple.com/documentation/appkit/nsaccessibility -- Apple Accessibility Programming Guide: - https://developer.apple.com/library/archive/documentation/Accessibility/Conceptual/AccessibilityMacOSX/ -- UAZoomChangeFocus: - https://developer.apple.com/documentation/applicationservices/1458830-uazoomchangefocus - -Not implemented (future work): -- Minibuffer/echo area element -- Modeline element -- Attributed text with font/color info -- Custom VoiceOver rotors -- Editing via accessibility API (setAccessibilityValue:) +EmacsView becomes an AXGroup containing EmacsAccessibilityBuffer children. +Notification hooks fire on cursor movement, text edits, and window changes. --- -diff --git a/src/nsterm.h b/src/nsterm.h -index 7c1ee4c..fa758ed 100644 ---- a/src/nsterm.h -+++ b/src/nsterm.h -@@ -453,6 +453,34 @@ enum ns_return_frame_mode - @end +--- a/src/nsterm.h 2026-02-26 08:46:18.118172281 +0100 ++++ b/src/nsterm.h 2026-02-26 08:46:06.891980688 +0100 +@@ -455,6 +455,34 @@ + /* ========================================================================== -+/* ========================================================================== -+ + Accessibility virtual elements (macOS / Cocoa only) + + ========================================================================== */ @@ -65,7 +28,7 @@ index 7c1ee4c..fa758ed 100644 + +/* Base class for virtual accessibility elements attached to EmacsView. */ +@interface EmacsAccessibilityElement : NSAccessibilityElement -+@property (nonatomic, weak) EmacsView *emacsView; ++@property (nonatomic, unsafe_unretained) EmacsView *emacsView; +@property (nonatomic, assign) struct window *emacsWindow; +- (NSRect)screenRectFromEmacsX:(int)x y:(int)y width:(int)w height:(int)h; +@end @@ -82,10 +45,12 @@ index 7c1ee4c..fa758ed 100644 +#endif /* NS_IMPL_COCOA */ + + - /* ========================================================================== - ++/* ========================================================================== ++ The main Emacs view -@@ -471,6 +499,8 @@ enum ns_return_frame_mode + + ========================================================================== */ +@@ -471,6 +499,8 @@ #ifdef NS_IMPL_COCOA char *old_title; BOOL maximizing_resize; @@ -94,7 +59,7 @@ index 7c1ee4c..fa758ed 100644 #endif BOOL font_panel_active; NSFont *font_panel_result; -@@ -528,6 +558,12 @@ enum ns_return_frame_mode +@@ -528,6 +558,12 @@ - (void)windowWillExitFullScreen; - (void)windowDidExitFullScreen; - (void)windowDidBecomeKey; @@ -107,11 +72,9 @@ index 7c1ee4c..fa758ed 100644 @end -diff --git a/src/nsterm.m b/src/nsterm.m -index 932d209..e67edbe 100644 ---- a/src/nsterm.m -+++ b/src/nsterm.m -@@ -1104,6 +1104,11 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) +--- a/src/nsterm.m 2026-02-26 08:46:18.124172384 +0100 ++++ b/src/nsterm.m 2026-02-26 08:46:06.895980756 +0100 +@@ -1104,6 +1104,11 @@ unblock_input (); ns_updating_frame = NULL; @@ -123,12 +86,10 @@ index 932d209..e67edbe 100644 } static void -@@ -6847,6 +6852,610 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg - } - #endif +@@ -6849,6 +6854,610 @@ + + /* ========================================================================== -+/* ========================================================================== -+ + Accessibility virtual elements (macOS / Cocoa only) + + ========================================================================== */ @@ -731,10 +692,12 @@ index 932d209..e67edbe 100644 +#endif /* NS_IMPL_COCOA */ + + - /* ========================================================================== - ++/* ========================================================================== ++ EmacsView implementation -@@ -9474,6 +10083,143 @@ - (int) fullscreenState + + ========================================================================== */ +@@ -9474,6 +10083,143 @@ return fs_state; } @@ -878,7 +841,7 @@ index 932d209..e67edbe 100644 @end /* EmacsView */ -@@ -9941,6 +10687,14 @@ - (id)accessibilityAttributeValue:(NSString *)attribute +@@ -9941,6 +10687,14 @@ return [super accessibilityAttributeValue:attribute]; }