Adds extra cursors for macOS
Before, plain arrow cursor or unsuitable ones were used.
This commit is contained in:
parent
3c3ed67c39
commit
8f881847c0
1 changed files with 20 additions and 6 deletions
|
@ -115,6 +115,20 @@ static Vector2 get_mouse_pos(NSPoint locationInWindow, CGFloat backingScaleFacto
|
||||||
return Vector2(mouse_x, mouse_y);
|
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
|
@interface GodotApplication : NSApplication
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -1813,15 +1827,15 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) {
|
||||||
case CURSOR_BUSY: [[NSCursor arrowCursor] set]; break;
|
case CURSOR_BUSY: [[NSCursor arrowCursor] set]; break;
|
||||||
case CURSOR_DRAG: [[NSCursor closedHandCursor] set]; break;
|
case CURSOR_DRAG: [[NSCursor closedHandCursor] set]; break;
|
||||||
case CURSOR_CAN_DROP: [[NSCursor openHandCursor] set]; break;
|
case CURSOR_CAN_DROP: [[NSCursor openHandCursor] set]; break;
|
||||||
case CURSOR_FORBIDDEN: [[NSCursor arrowCursor] set]; break;
|
case CURSOR_FORBIDDEN: [[NSCursor operationNotAllowedCursor] set]; break;
|
||||||
case CURSOR_VSIZE: [[NSCursor resizeUpDownCursor] set]; break;
|
case CURSOR_VSIZE: [cursorFromSelector(@selector(_windowResizeNorthSouthCursor), @selector(resizeUpDownCursor)) set]; break;
|
||||||
case CURSOR_HSIZE: [[NSCursor resizeLeftRightCursor] set]; break;
|
case CURSOR_HSIZE: [cursorFromSelector(@selector(_windowResizeEastWestCursor), @selector(resizeLeftRightCursor)) set]; break;
|
||||||
case CURSOR_BDIAGSIZE: [[NSCursor arrowCursor] set]; break;
|
case CURSOR_BDIAGSIZE: [cursorFromSelector(@selector(_windowResizeNorthEastSouthWestCursor)) set]; break;
|
||||||
case CURSOR_FDIAGSIZE: [[NSCursor arrowCursor] set]; break;
|
case CURSOR_FDIAGSIZE: [cursorFromSelector(@selector(_windowResizeNorthWestSouthEastCursor)) set]; break;
|
||||||
case CURSOR_MOVE: [[NSCursor arrowCursor] set]; break;
|
case CURSOR_MOVE: [[NSCursor arrowCursor] set]; break;
|
||||||
case CURSOR_VSPLIT: [[NSCursor resizeUpDownCursor] set]; break;
|
case CURSOR_VSPLIT: [[NSCursor resizeUpDownCursor] set]; break;
|
||||||
case CURSOR_HSPLIT: [[NSCursor resizeLeftRightCursor] 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: {
|
default: {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue