From f3e67d7d6e2957fbfe0287d447d8e83cd4e26e93 Mon Sep 17 00:00:00 2001 From: dijunkun Date: Tue, 15 Sep 2026 16:44:19 +0800 Subject: [PATCH] [fix] recognize macOS window resize cursors --- .../gui/runtime/cursor_state_provider_mac.mm | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/platform/macos/gui/runtime/cursor_state_provider_mac.mm b/apps/desktop/src/platform/macos/gui/runtime/cursor_state_provider_mac.mm index 739aa7ff..381b498d 100644 --- a/apps/desktop/src/platform/macos/gui/runtime/cursor_state_provider_mac.mm +++ b/apps/desktop/src/platform/macos/gui/runtime/cursor_state_provider_mac.mm @@ -95,7 +95,7 @@ void AddKnownCursor(std::vector* cursors, NSCursor* cursor, std::vector BuildKnownCursors() { std::vector cursors; - cursors.reserve(16); + cursors.reserve(40); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" @@ -129,6 +129,55 @@ std::vector BuildKnownCursors() { RemoteCursorShape::w_resize); #pragma clang diagnostic pop +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 150000 + if (@available(macOS 15.0, *)) { + // Window-frame resize artwork differs from the legacy divider cursors + // above. Include every edge/corner and both one-way variants. Inward + // arrows point toward the frame's center; outward arrows point away. + struct FrameResizeCursorMapping { + NSCursorFrameResizePosition position; + RemoteCursorShape bidirectional; + RemoteCursorShape inward; + RemoteCursorShape outward; + }; + constexpr FrameResizeCursorMapping mappings[] = { + {NSCursorFrameResizePositionTop, RemoteCursorShape::ns_resize, + RemoteCursorShape::s_resize, RemoteCursorShape::n_resize}, + {NSCursorFrameResizePositionLeft, RemoteCursorShape::ew_resize, + RemoteCursorShape::e_resize, RemoteCursorShape::w_resize}, + {NSCursorFrameResizePositionBottom, RemoteCursorShape::ns_resize, + RemoteCursorShape::n_resize, RemoteCursorShape::s_resize}, + {NSCursorFrameResizePositionRight, RemoteCursorShape::ew_resize, + RemoteCursorShape::w_resize, RemoteCursorShape::e_resize}, + {NSCursorFrameResizePositionTopLeft, RemoteCursorShape::nwse_resize, + RemoteCursorShape::se_resize, RemoteCursorShape::nw_resize}, + {NSCursorFrameResizePositionTopRight, RemoteCursorShape::nesw_resize, + RemoteCursorShape::sw_resize, RemoteCursorShape::ne_resize}, + {NSCursorFrameResizePositionBottomLeft, RemoteCursorShape::nesw_resize, + RemoteCursorShape::ne_resize, RemoteCursorShape::sw_resize}, + {NSCursorFrameResizePositionBottomRight, RemoteCursorShape::nwse_resize, + RemoteCursorShape::nw_resize, RemoteCursorShape::se_resize}, + }; + for (const FrameResizeCursorMapping& mapping : mappings) { + AddKnownCursor( + &cursors, + [NSCursor frameResizeCursorFromPosition:mapping.position + inDirections:NSCursorFrameResizeDirectionsAll], + mapping.bidirectional); + AddKnownCursor( + &cursors, + [NSCursor frameResizeCursorFromPosition:mapping.position + inDirections:NSCursorFrameResizeDirectionsInward], + mapping.inward); + AddKnownCursor( + &cursors, + [NSCursor frameResizeCursorFromPosition:mapping.position + inDirections:NSCursorFrameResizeDirectionsOutward], + mapping.outward); + } + } +#endif + return cursors; }