From 171ba00a6acafaef4044bfd7ca54548f5ec7d6e7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 13 Apr 2020 19:44:26 -0700 Subject: [PATCH] Hide the mouse cursor appropriately on iOS --- src/video/uikit/SDL_uikitview.h | 1 + src/video/uikit/SDL_uikitview.m | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/video/uikit/SDL_uikitview.h b/src/video/uikit/SDL_uikitview.h index faad0f8a6..89b68c22a 100644 --- a/src/video/uikit/SDL_uikitview.h +++ b/src/video/uikit/SDL_uikitview.h @@ -37,6 +37,7 @@ #if !TARGET_OS_TV && defined(__IPHONE_13_4) - (UIPointerRegion *)pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion API_AVAILABLE(ios(13.4)); +- (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region API_AVAILABLE(ios(13.4)); #endif - (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize; diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index 2fcb0ce65..5b42f63f1 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -155,6 +155,14 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; } return [UIPointerRegion regionWithRect:self.bounds identifier:nil]; } + +- (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region API_AVAILABLE(ios(13.4)){ + if (SDL_ShowCursor(-1)) { + return nil; + } else { + return [UIPointerStyle hiddenPointerStyle]; + } +} #endif /* !TARGET_OS_TV && __IPHONE_13_4 */ - (SDL_TouchDeviceType)touchTypeForTouch:(UITouch *)touch