display(visionOS): disable GCMouse due to it not working

This commit is contained in:
osy 2024-02-24 19:43:58 -08:00
parent 3a57588ca5
commit 7b94235416
3 changed files with 11 additions and 1 deletions

View File

@ -153,11 +153,13 @@ NS_AVAILABLE_IOS(13.4)
- (UIPointerRegion *)pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion {
#if !TARGET_OS_VISION
if (@available(iOS 14.0, *)) {
if (self.prefersPointerLocked) {
return nil;
}
}
#endif
// Requesting region for the VM display?
if (interaction.view == self.mtkView && self.hasTouchpadPointer) {
// Then we need to find out if the pointer is in the actual display area or outside

View File

@ -181,11 +181,15 @@ const CGFloat kScrollResistance = 10.0f;
}
- (VMMouseType)indirectMouseType {
#if TARGET_OS_VISION
return VMMouseTypeAbsolute;
#else
if (@available(iOS 14.0, *)) {
return VMMouseTypeRelative;
} else {
return VMMouseTypeAbsolute; // legacy iOS 13.4 mouse handling requires absolute
}
#endif
}
#pragma mark - Converting view points to VM display points
@ -635,7 +639,7 @@ static CGRect CGRectClipToBounds(CGRect rect1, CGRect rect2) {
VMMouseType type = [self touchTypeToMouseType:touch.type];
#if TARGET_OS_VISION
if ([self isTouchGazeGesture:touch]) {
type = self.indirectMouseType;
type = VMMouseTypeRelative;
}
#endif
if ([self switchMouseType:type]) {

View File

@ -121,13 +121,17 @@ static const NSInteger kResizeTimeoutSecs = 5;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.prefersHomeIndicatorAutoHidden = YES;
#if !TARGET_OS_VISION
[self startGCMouse];
#endif
[self.vmDisplay addRenderer:self.renderer];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
#if !TARGET_OS_VISION
[self stopGCMouse];
#endif
[self.vmDisplay removeRenderer:self.renderer];
[self removeObserver:self forKeyPath:@"vmDisplay.displaySize"];
}