From 8325e7f5e42abbfbff4f9ad0dc9ce3d4e21716a0 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Wed, 2 Apr 2025 01:30:13 +0200 Subject: [PATCH] UI: Use busyButClickableCursor for MacOS Wait Cursor MacOS is currently using one of our custom "hourglass" cursors during busy times. This PR changes it to an OS-supplied cursor, a pointer arrow with an animated blue spinner, meant for this purpose. Although undocumented it has been used by many applications for many years. Including Firefox for 11 years now. Pull Request: https://projects.blender.org/blender/blender/pulls/136735 --- intern/ghost/intern/GHOST_WindowCocoa.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 64298bf85d0..7c7db453029 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -1003,6 +1003,12 @@ static NSCursor *getImageCursor(GHOST_TStandardCursor shape, NSString *name, NSP return cursors[index]; } +/* busyButClickableCursor is an undocumented NSCursor API, but + * has been in use since at least OS X 10.4 and through 10.9. */ +@interface NSCursor (Undocumented) ++ (NSCursor *)busyButClickableCursor; +@end + NSCursor *GHOST_WindowCocoa::getStandardCursor(GHOST_TStandardCursor shape) const { @autoreleasepool { @@ -1046,6 +1052,11 @@ NSCursor *GHOST_WindowCocoa::getStandardCursor(GHOST_TStandardCursor shape) cons return [NSCursor pointingHandCursor]; case GHOST_kStandardCursorDefault: return [NSCursor arrowCursor]; + case GHOST_kStandardCursorWait: + if ([NSCursor respondsToSelector:@selector(busyButClickableCursor)]) { + return [NSCursor busyButClickableCursor]; + } + return nullptr; case GHOST_kStandardCursorKnife: return getImageCursor(shape, @"knife.pdf", NSMakePoint(6, 24)); case GHOST_kStandardCursorEraser: