fixed: broken touch input caused by Absolute Touch

This commit is contained in:
TrueZhuanjia committed 2025-09-11 23:14:58 +08:00
1 parent c094d74d8e
commit daa4fc80eb
3 files changed
+12 -2

No files matched your search

@@ -25,6 +25,7 @@
@property (nonatomic, strong) IBOutlet UIBarButtonItem *settingsButton; @property (nonatomic, strong) IBOutlet UIBarButtonItem *settingsButton;
#if !TARGET_OS_TV #if !TARGET_OS_TV
@property (nonatomic, assign) bool settingsExpandedInStreamView; @property (nonatomic, assign) bool settingsExpandedInStreamView;
@property (nonatomic, assign) bool sessionLaunchedWithAbsoluteTouch;
@property (nonatomic, strong) HostCollectionViewController *hostCollectionVC; @property (nonatomic, strong) HostCollectionViewController *hostCollectionVC;
@property (weak, nonatomic) IBOutlet UINavigationItem *navigationItem; @property (weak, nonatomic) IBOutlet UINavigationItem *navigationItem;
@@ -1181,6 +1181,7 @@ static NSMutableSet* hostList;
// [settingsViewController widget:settingsViewController.bitrateSlider setEnabled:!self.settingsExpandedInStreamView]; // [settingsViewController widget:settingsViewController.bitrateSlider setEnabled:!self.settingsExpandedInStreamView];
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.optimizeGamesStack]; [settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.optimizeGamesStack];
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.audioOnPcStack]; [settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.audioOnPcStack];
[settingsViewController.touchModeSelector setEnabled:!_settingsExpandedInStreamView || !_sessionLaunchedWithAbsoluteTouch];
[settingsViewController.codecSelector setEnabled:!_settingsExpandedInStreamView]; [settingsViewController.codecSelector setEnabled:!_settingsExpandedInStreamView];
[settingsViewController.yuv444Switch setEnabled:!_settingsExpandedInStreamView]; [settingsViewController.yuv444Switch setEnabled:!_settingsExpandedInStreamView];
[settingsViewController.hdrSwitch setEnabled:!_settingsExpandedInStreamView && [settingsViewController hdrSupported]]; [settingsViewController.hdrSwitch setEnabled:!_settingsExpandedInStreamView && [settingsViewController hdrSupported]];
@@ -308,7 +308,7 @@
- (void)configZoomGestureAndAddStreamView{ - (void)configZoomGestureAndAddStreamView{
if (_settings.touchMode.intValue == AbsoluteTouch) { if (_settings.touchMode.intValue == AbsoluteTouch) {
_scrollView = [[UIScrollView alloc] initWithFrame:self.view.frame]; if(!_scrollView) _scrollView = [[UIScrollView alloc] initWithFrame:self.view.frame];
#if !TARGET_OS_TV #if !TARGET_OS_TV
[_scrollView.panGestureRecognizer setMinimumNumberOfTouches:2]; [_scrollView.panGestureRecognizer setMinimumNumberOfTouches:2];
[_scrollView.panGestureRecognizer setMaximumNumberOfTouches:2]; // reduce competing with keyboardToggleRecognizer in StreamView. [_scrollView.panGestureRecognizer setMaximumNumberOfTouches:2]; // reduce competing with keyboardToggleRecognizer in StreamView.
@@ -317,15 +317,21 @@
[_scrollView setShowsVerticalScrollIndicator:NO]; [_scrollView setShowsVerticalScrollIndicator:NO];
[_scrollView setDelegate:self]; [_scrollView setDelegate:self];
[_scrollView setMaximumZoomScale:10.0f]; [_scrollView setMaximumZoomScale:10.0f];
if(!_mainFrameViewcontroller.settingsExpandedInStreamView){
// Add StreamView inside a UIScrollView for absolute mode // Add StreamView inside a UIScrollView for absolute mode
[_scrollView addSubview:_streamView]; [_scrollView addSubview:_streamView];
// Insert at index 0 to ensure it doesn't cover OSC controls (CALayers) // Insert at index 0 to ensure it doesn't cover OSC controls (CALayers)
[self.view insertSubview:_scrollView atIndex:0]; [self.view insertSubview:_scrollView atIndex:0];
} }
}
else{ else{
// Add streamView directly to self.view in other touch modes // Add streamView directly to self.view in other touch modes
// Insert at index 0 to ensure it doesn't cover OSC controls (CALayers) // Insert at index 0 to ensure it doesn't cover OSC controls (CALayers)
if([_streamView.superview isKindOfClass:[UIScrollView class]]){
[_streamView removeFromSuperview];
NSLog(@"removeFromSuperview %f", CACurrentMediaTime());
}
[self.view insertSubview:_streamView atIndex:0]; [self.view insertSubview:_streamView atIndex:0];
} }
} }
@@ -728,6 +734,8 @@
[self.view insertSubview:self.metalViewController.view atIndex:0]; [self.view insertSubview:self.metalViewController.view atIndex:0];
[self.metalViewController didMoveToParentViewController:self]; [self.metalViewController didMoveToParentViewController:self];
} }
_mainFrameViewcontroller.sessionLaunchedWithAbsoluteTouch = _settings.touchMode.intValue == AbsoluteTouch;
} }
- (void)keyboardWillShow:(NSNotification *)notification{ - (void)keyboardWillShow:(NSNotification *)notification{