v13 patch: fix MRC weak property error (unsafe_unretained)
This commit is contained in:
@@ -8,54 +8,17 @@ movement, and announce window switches on macOS.
|
|||||||
|
|
||||||
New classes:
|
New classes:
|
||||||
- EmacsAccessibilityElement: base class with coordinate conversion
|
- EmacsAccessibilityElement: base class with coordinate conversion
|
||||||
(Emacs pixel coords → NSView → screen coordinates)
|
- EmacsAccessibilityBuffer: AXTextArea virtual element per Emacs window
|
||||||
- EmacsAccessibilityBuffer: AXTextArea virtual element, one per visible
|
|
||||||
Emacs window, implementing full text navigation protocol
|
|
||||||
|
|
||||||
EmacsView changes:
|
EmacsView becomes an AXGroup containing EmacsAccessibilityBuffer children.
|
||||||
- Role: AXGroup (container for buffer elements)
|
Notification hooks fire on cursor movement, text edits, and window changes.
|
||||||
- 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:)
|
|
||||||
---
|
---
|
||||||
diff --git a/src/nsterm.h b/src/nsterm.h
|
--- a/src/nsterm.h 2026-02-26 08:46:18.118172281 +0100
|
||||||
index 7c1ee4c..fa758ed 100644
|
+++ b/src/nsterm.h 2026-02-26 08:46:06.891980688 +0100
|
||||||
--- a/src/nsterm.h
|
@@ -455,6 +455,34 @@
|
||||||
+++ b/src/nsterm.h
|
|
||||||
@@ -453,6 +453,34 @@ enum ns_return_frame_mode
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
|
||||||
+/* ==========================================================================
|
|
||||||
+
|
|
||||||
+ Accessibility virtual elements (macOS / Cocoa only)
|
+ Accessibility virtual elements (macOS / Cocoa only)
|
||||||
+
|
+
|
||||||
+ ========================================================================== */
|
+ ========================================================================== */
|
||||||
@@ -65,7 +28,7 @@ index 7c1ee4c..fa758ed 100644
|
|||||||
+
|
+
|
||||||
+/* Base class for virtual accessibility elements attached to EmacsView. */
|
+/* Base class for virtual accessibility elements attached to EmacsView. */
|
||||||
+@interface EmacsAccessibilityElement : NSAccessibilityElement
|
+@interface EmacsAccessibilityElement : NSAccessibilityElement
|
||||||
+@property (nonatomic, weak) EmacsView *emacsView;
|
+@property (nonatomic, unsafe_unretained) EmacsView *emacsView;
|
||||||
+@property (nonatomic, assign) struct window *emacsWindow;
|
+@property (nonatomic, assign) struct window *emacsWindow;
|
||||||
+- (NSRect)screenRectFromEmacsX:(int)x y:(int)y width:(int)w height:(int)h;
|
+- (NSRect)screenRectFromEmacsX:(int)x y:(int)y width:(int)w height:(int)h;
|
||||||
+@end
|
+@end
|
||||||
@@ -82,10 +45,12 @@ index 7c1ee4c..fa758ed 100644
|
|||||||
+#endif /* NS_IMPL_COCOA */
|
+#endif /* NS_IMPL_COCOA */
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
/* ==========================================================================
|
+/* ==========================================================================
|
||||||
|
+
|
||||||
The main Emacs view
|
The main Emacs view
|
||||||
@@ -471,6 +499,8 @@ enum ns_return_frame_mode
|
|
||||||
|
========================================================================== */
|
||||||
|
@@ -471,6 +499,8 @@
|
||||||
#ifdef NS_IMPL_COCOA
|
#ifdef NS_IMPL_COCOA
|
||||||
char *old_title;
|
char *old_title;
|
||||||
BOOL maximizing_resize;
|
BOOL maximizing_resize;
|
||||||
@@ -94,7 +59,7 @@ index 7c1ee4c..fa758ed 100644
|
|||||||
#endif
|
#endif
|
||||||
BOOL font_panel_active;
|
BOOL font_panel_active;
|
||||||
NSFont *font_panel_result;
|
NSFont *font_panel_result;
|
||||||
@@ -528,6 +558,12 @@ enum ns_return_frame_mode
|
@@ -528,6 +558,12 @@
|
||||||
- (void)windowWillExitFullScreen;
|
- (void)windowWillExitFullScreen;
|
||||||
- (void)windowDidExitFullScreen;
|
- (void)windowDidExitFullScreen;
|
||||||
- (void)windowDidBecomeKey;
|
- (void)windowDidBecomeKey;
|
||||||
@@ -107,11 +72,9 @@ index 7c1ee4c..fa758ed 100644
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
--- a/src/nsterm.m 2026-02-26 08:46:18.124172384 +0100
|
||||||
index 932d209..e67edbe 100644
|
+++ b/src/nsterm.m 2026-02-26 08:46:06.895980756 +0100
|
||||||
--- a/src/nsterm.m
|
@@ -1104,6 +1104,11 @@
|
||||||
+++ b/src/nsterm.m
|
|
||||||
@@ -1104,6 +1104,11 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
|
|
||||||
|
|
||||||
unblock_input ();
|
unblock_input ();
|
||||||
ns_updating_frame = NULL;
|
ns_updating_frame = NULL;
|
||||||
@@ -123,12 +86,10 @@ index 932d209..e67edbe 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -6847,6 +6852,610 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
|
@@ -6849,6 +6854,610 @@
|
||||||
}
|
|
||||||
#endif
|
/* ==========================================================================
|
||||||
|
|
||||||
+/* ==========================================================================
|
|
||||||
+
|
|
||||||
+ Accessibility virtual elements (macOS / Cocoa only)
|
+ Accessibility virtual elements (macOS / Cocoa only)
|
||||||
+
|
+
|
||||||
+ ========================================================================== */
|
+ ========================================================================== */
|
||||||
@@ -731,10 +692,12 @@ index 932d209..e67edbe 100644
|
|||||||
+#endif /* NS_IMPL_COCOA */
|
+#endif /* NS_IMPL_COCOA */
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
/* ==========================================================================
|
+/* ==========================================================================
|
||||||
|
+
|
||||||
EmacsView implementation
|
EmacsView implementation
|
||||||
@@ -9474,6 +10083,143 @@ - (int) fullscreenState
|
|
||||||
|
========================================================================== */
|
||||||
|
@@ -9474,6 +10083,143 @@
|
||||||
return fs_state;
|
return fs_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -878,7 +841,7 @@ index 932d209..e67edbe 100644
|
|||||||
@end /* EmacsView */
|
@end /* EmacsView */
|
||||||
|
|
||||||
|
|
||||||
@@ -9941,6 +10687,14 @@ - (id)accessibilityAttributeValue:(NSString *)attribute
|
@@ -9941,6 +10687,14 @@
|
||||||
|
|
||||||
return [super accessibilityAttributeValue:attribute];
|
return [super accessibilityAttributeValue:attribute];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user