mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 23:53:15 +00:00
Adds extra cursors for macOS
Before, plain arrow cursor or unsuitable ones were used.
(cherry picked from commit 8f881847c0
)
This commit is contained in:
parent
1898240af8
commit
0d8b3efeb7
@ -115,6 +115,20 @@ static Vector2 get_mouse_pos(NSPoint locationInWindow, CGFloat backingScaleFacto
|
||||
return Vector2(mouse_x, mouse_y);
|
||||
}
|
||||
|
||||
static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) {
|
||||
if ([NSCursor respondsToSelector:selector]) {
|
||||
id object = [NSCursor performSelector:selector];
|
||||
if ([object isKindOfClass:[NSCursor class]]) {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
if (fallback) {
|
||||
// Fallback should be a reasonable default, no need to check.
|
||||
return [NSCursor performSelector:fallback];
|
||||
}
|
||||
return [NSCursor arrowCursor];
|
||||
}
|
||||
|
||||
@interface GodotApplication : NSApplication
|
||||
@end
|
||||
|
||||
@ -1813,15 +1827,15 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) {
|
||||
case CURSOR_BUSY: [[NSCursor arrowCursor] set]; break;
|
||||
case CURSOR_DRAG: [[NSCursor closedHandCursor] set]; break;
|
||||
case CURSOR_CAN_DROP: [[NSCursor openHandCursor] set]; break;
|
||||
case CURSOR_FORBIDDEN: [[NSCursor arrowCursor] set]; break;
|
||||
case CURSOR_VSIZE: [[NSCursor resizeUpDownCursor] set]; break;
|
||||
case CURSOR_HSIZE: [[NSCursor resizeLeftRightCursor] set]; break;
|
||||
case CURSOR_BDIAGSIZE: [[NSCursor arrowCursor] set]; break;
|
||||
case CURSOR_FDIAGSIZE: [[NSCursor arrowCursor] set]; break;
|
||||
case CURSOR_FORBIDDEN: [[NSCursor operationNotAllowedCursor] set]; break;
|
||||
case CURSOR_VSIZE: [cursorFromSelector(@selector(_windowResizeNorthSouthCursor), @selector(resizeUpDownCursor)) set]; break;
|
||||
case CURSOR_HSIZE: [cursorFromSelector(@selector(_windowResizeEastWestCursor), @selector(resizeLeftRightCursor)) set]; break;
|
||||
case CURSOR_BDIAGSIZE: [cursorFromSelector(@selector(_windowResizeNorthEastSouthWestCursor)) set]; break;
|
||||
case CURSOR_FDIAGSIZE: [cursorFromSelector(@selector(_windowResizeNorthWestSouthEastCursor)) set]; break;
|
||||
case CURSOR_MOVE: [[NSCursor arrowCursor] set]; break;
|
||||
case CURSOR_VSPLIT: [[NSCursor resizeUpDownCursor] set]; break;
|
||||
case CURSOR_HSPLIT: [[NSCursor resizeLeftRightCursor] set]; break;
|
||||
case CURSOR_HELP: [[NSCursor arrowCursor] set]; break;
|
||||
case CURSOR_HELP: [cursorFromSelector(@selector(_helpCursor)) set]; break;
|
||||
default: {
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user