mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
app: [macos] add missing cursors
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
@@ -237,6 +237,23 @@ func windowSetCursor(from, to pointer.CursorName) pointer.CursorName {
|
|||||||
curID = 6
|
curID = 6
|
||||||
case pointer.CursorGrab:
|
case pointer.CursorGrab:
|
||||||
curID = 7
|
curID = 7
|
||||||
|
case pointer.CursorTopLeftResize:
|
||||||
|
curID = 8
|
||||||
|
case pointer.CursorTopRightResize:
|
||||||
|
curID = 9
|
||||||
|
case pointer.CursorBottomLeftResize:
|
||||||
|
curID = 10
|
||||||
|
case pointer.CursorBottomRightResize:
|
||||||
|
curID = 11
|
||||||
|
case pointer.CursorLeftResize:
|
||||||
|
curID = 12
|
||||||
|
case pointer.CursorRightResize:
|
||||||
|
curID = 13
|
||||||
|
case pointer.CursorTopResize:
|
||||||
|
curID = 14
|
||||||
|
case pointer.CursorBottomResize:
|
||||||
|
curID = 15
|
||||||
|
|
||||||
case pointer.CursorNone:
|
case pointer.CursorNone:
|
||||||
C.gio_hideCursor()
|
C.gio_hideCursor()
|
||||||
return to
|
return to
|
||||||
|
|||||||
+44
-7
@@ -232,30 +232,67 @@ void gio_showCursor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// some cursors are not public, this tries to use a private cursor
|
||||||
|
// and uses fallback when the use of private cursor fails.
|
||||||
|
void gio_trySetPrivateCursor(SEL cursorName, NSCursor* fallback) {
|
||||||
|
if ([NSCursor respondsToSelector:cursorName]) {
|
||||||
|
id object = [NSCursor performSelector:cursorName];
|
||||||
|
if ([object isKindOfClass:[NSCursor class]]) {
|
||||||
|
[(NSCursor*)object set];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[fallback set];
|
||||||
|
}
|
||||||
|
|
||||||
void gio_setCursor(NSUInteger curID) {
|
void gio_setCursor(NSUInteger curID) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
switch (curID) {
|
switch (curID) {
|
||||||
case 1:
|
case 1: // pointer.CursorDefault
|
||||||
[NSCursor.arrowCursor set];
|
[NSCursor.arrowCursor set];
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: // pointer.CursorText
|
||||||
[NSCursor.IBeamCursor set];
|
[NSCursor.IBeamCursor set];
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3: // pointer.CursorPointer
|
||||||
[NSCursor.pointingHandCursor set];
|
[NSCursor.pointingHandCursor set];
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4: // pointer.CursorCrossHair
|
||||||
[NSCursor.crosshairCursor set];
|
[NSCursor.crosshairCursor set];
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5: // pointer.CursorColResize
|
||||||
[NSCursor.resizeLeftRightCursor set];
|
[NSCursor.resizeLeftRightCursor set];
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6: // pointer.CursorRowResize
|
||||||
[NSCursor.resizeUpDownCursor set];
|
[NSCursor.resizeUpDownCursor set];
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7: // pointer.CursorGrab
|
||||||
[NSCursor.openHandCursor set];
|
[NSCursor.openHandCursor set];
|
||||||
break;
|
break;
|
||||||
|
case 8: // pointer.CursorTopLeftResize
|
||||||
|
gio_trySetPrivateCursor(@selector(_windowResizeNorthWestCursor), NSCursor.resizeUpDownCursor);
|
||||||
|
break;
|
||||||
|
case 9: // pointer.CursorTopRightResize
|
||||||
|
gio_trySetPrivateCursor(@selector(_windowResizeNorthEastCursor), NSCursor.resizeUpDownCursor);
|
||||||
|
break;
|
||||||
|
case 10: // pointer.CursorBottomLeftResize
|
||||||
|
gio_trySetPrivateCursor(@selector(_windowResizeSouthWestCursor), NSCursor.resizeUpDownCursor);
|
||||||
|
break;
|
||||||
|
case 11: // pointer.CursorBottomRightResize
|
||||||
|
gio_trySetPrivateCursor(@selector(_windowResizeSouthEastCursor), NSCursor.resizeUpDownCursor);
|
||||||
|
break;
|
||||||
|
case 12: // pointer.CursorLeftResize
|
||||||
|
[NSCursor.resizeLeftCursor set];
|
||||||
|
break;
|
||||||
|
case 13: // pointer.CursorRightResize
|
||||||
|
[NSCursor.resizeRightCursor set];
|
||||||
|
break;
|
||||||
|
case 14: // pointer.CursorTopResize
|
||||||
|
[NSCursor.resizeUpCursor set];
|
||||||
|
break;
|
||||||
|
case 15: // pointer.CursorBottomResize
|
||||||
|
[NSCursor.resizeDownCursor set];
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
[NSCursor.arrowCursor set];
|
[NSCursor.arrowCursor set];
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user