mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 17:05:38 +00:00
app/internal/window: [iOS] disable cursor support
Building an iOS results in errors about missing NSCursor: $ gogio -target ios -o app.app ./kitchen gogio: go build -ldflags=-s -w -X gioui.org/app/internal/log.appID=org.gioui.kitchen -buildmode=c-archive -o /var/folders/_7/lnt35k555hl2bs7fjygkhgx00000gp/T/gogio-770783182/gio-amd64 -tags ./kitchen failed: # gioui.org/app/internal/window os_darwin.m:26:10: error: use of undeclared identifier 'NSCursor' os_darwin.m:32:10: error: use of undeclared identifier 'NSCursor' os_darwin.m:40:14: error: use of undeclared identifier 'NSCursor' os_darwin.m:43:14: error: use of undeclared identifier 'NSCursor' os_darwin.m:46:14: error: use of undeclared identifier 'NSCursor' os_darwin.m:49:14: error: use of undeclared identifier 'NSCursor' os_darwin.m:52:14: error: use of undeclared identifier 'NSCursor' os_darwin.m:55:14: error: use of undeclared identifier 'NSCursor' os_darwin.m:58:14: error: use of undeclared identifier 'NSCursor' NSCursor is supported under mac catalyst; disable NSCursor support while figuring out how. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -20,43 +20,3 @@ void gio_nsstringGetCharacters(CFTypeRef cstr, unichar *chars, NSUInteger loc, N
|
||||
NSString *str = (__bridge NSString *)cstr;
|
||||
[str getCharacters:chars range:NSMakeRange(loc, length)];
|
||||
}
|
||||
|
||||
void gio_hideCursor() {
|
||||
@autoreleasepool {
|
||||
[NSCursor hide];
|
||||
}
|
||||
}
|
||||
|
||||
void gio_showCursor() {
|
||||
@autoreleasepool {
|
||||
[NSCursor unhide];
|
||||
}
|
||||
}
|
||||
|
||||
void gio_setCursor(NSUInteger curID) {
|
||||
@autoreleasepool {
|
||||
switch (curID) {
|
||||
case 1:
|
||||
[NSCursor.arrowCursor set];
|
||||
break;
|
||||
case 2:
|
||||
[NSCursor.IBeamCursor set];
|
||||
break;
|
||||
case 3:
|
||||
[NSCursor.pointingHandCursor set];
|
||||
break;
|
||||
case 4:
|
||||
[NSCursor.crosshairCursor set];
|
||||
break;
|
||||
case 5:
|
||||
[NSCursor.resizeLeftRightCursor set];
|
||||
break;
|
||||
case 6:
|
||||
[NSCursor.resizeUpDownCursor set];
|
||||
break;
|
||||
default:
|
||||
[NSCursor.arrowCursor set];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,3 +326,15 @@ void gio_releaseDisplayLink(CFTypeRef dlref) {
|
||||
void gio_setDisplayLinkDisplay(CFTypeRef dl, uint64_t did) {
|
||||
// Nothing to do on iOS.
|
||||
}
|
||||
|
||||
void gio_hideCursor() {
|
||||
// Not supported.
|
||||
}
|
||||
|
||||
void gio_showCursor() {
|
||||
// Not supported.
|
||||
}
|
||||
|
||||
void gio_setCursor(NSUInteger curID) {
|
||||
// Not supported.
|
||||
}
|
||||
|
||||
@@ -86,6 +86,46 @@ CGFloat gio_getViewBackingScale(CFTypeRef viewRef) {
|
||||
return [view.window backingScaleFactor];
|
||||
}
|
||||
|
||||
void gio_hideCursor() {
|
||||
@autoreleasepool {
|
||||
[NSCursor hide];
|
||||
}
|
||||
}
|
||||
|
||||
void gio_showCursor() {
|
||||
@autoreleasepool {
|
||||
[NSCursor unhide];
|
||||
}
|
||||
}
|
||||
|
||||
void gio_setCursor(NSUInteger curID) {
|
||||
@autoreleasepool {
|
||||
switch (curID) {
|
||||
case 1:
|
||||
[NSCursor.arrowCursor set];
|
||||
break;
|
||||
case 2:
|
||||
[NSCursor.IBeamCursor set];
|
||||
break;
|
||||
case 3:
|
||||
[NSCursor.pointingHandCursor set];
|
||||
break;
|
||||
case 4:
|
||||
[NSCursor.crosshairCursor set];
|
||||
break;
|
||||
case 5:
|
||||
[NSCursor.resizeLeftRightCursor set];
|
||||
break;
|
||||
case 6:
|
||||
[NSCursor.resizeUpDownCursor set];
|
||||
break;
|
||||
default:
|
||||
[NSCursor.arrowCursor set];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static CVReturn displayLinkCallback(CVDisplayLinkRef dl, const CVTimeStamp *inNow, const CVTimeStamp *inOutputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext) {
|
||||
gio_onFrameCallback(dl);
|
||||
return kCVReturnSuccess;
|
||||
|
||||
Reference in New Issue
Block a user