diff --git a/Limelight/Input/NativeTouchHandler.h b/Limelight/Input/NativeTouchHandler.h index f385a4ce..d4cad7af 100644 --- a/Limelight/Input/NativeTouchHandler.h +++ b/Limelight/Input/NativeTouchHandler.h @@ -14,8 +14,7 @@ NS_ASSUME_NONNULL_BEGIN @interface NativeTouchHandler : UIResponder -@property (nonatomic, assign) bool XBoundaryReached; -@property (nonatomic, assign) bool YBoundaryReached; +@property (nonatomic, assign) bool BoundaryReached; @property (nonatomic, assign) bool flipFlag; - (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings; diff --git a/Limelight/Input/NativeTouchHandler.m b/Limelight/Input/NativeTouchHandler.m index a8bf36b3..4daa4eb0 100644 --- a/Limelight/Input/NativeTouchHandler.m +++ b/Limelight/Input/NativeTouchHandler.m @@ -87,10 +87,12 @@ CGFloat normalizedY = location.y / videoSize.height; uint8_t pointerId = [self retrievePointerIdFromDict:touch]; - _XBoundaryReached = (normalizedX == 1.0f || normalizedX == 0.f); - _YBoundaryReached = (normalizedY == 1.0f || normalizedY == 0.f); + _BoundaryReached = (normalizedX == 1.0f || normalizedX == 0.f || normalizedY == 1.0f || normalizedY == 0.f); //if(_XBoundaryReached || _YBoundaryReached) LiSendTouchEvent(LI_TOUCH_EVENT_UP,pointerId, normalizedX, normalizedY, 0, 0, 0, 0); - if(_XBoundaryReached || _YBoundaryReached) LiSendTouchEvent(LI_TOUCH_EVENT_UP,pointerId, normalizedX, normalizedY, 0, 0, 0, 0); + if(_BoundaryReached){ + LiSendTouchEvent(LI_TOUCH_EVENT_UP, pointerId, normalizedX, normalizedY, 0, 0, 0, 0); + LiSendTouchEvent(LI_TOUCH_EVENT_MOVE, pointerId, 0.5, 0.5, 0, 0, 0, 0); + } else LiSendTouchEvent(touchType, pointerId, normalizedX, normalizedY,(touch.force / touch.maximumPossibleForce) / sin(touch.altitudeAngle),0.0f, 0.0f,[streamView getRotationFromAzimuthAngle:[touch azimuthAngleInView:streamView]]); } diff --git a/Limelight/Input/NativeTouchPointer.m b/Limelight/Input/NativeTouchPointer.m index 717b03db..08902616 100644 --- a/Limelight/Input/NativeTouchPointer.m +++ b/Limelight/Input/NativeTouchPointer.m @@ -53,13 +53,12 @@ StreamView *streamView; previousPoint = latestPoint; latestPoint = [touch locationInView:streamView]; previousRelativePoint = latestRelativePoint; - if(nativeTouchHandler.XBoundaryReached || nativeTouchHandler.YBoundaryReached){ // reset + if(nativeTouchHandler.BoundaryReached){ // reset previousRelativePoint.x = halfScreenWidthInPoints; previousRelativePoint.y = halfScreenHeightInPoints; } latestRelativePoint.x = previousRelativePoint.x + pointerVelocityFactor * (latestPoint.x - previousPoint.x); latestRelativePoint.y = previousRelativePoint.y + pointerVelocityFactor * (latestPoint.y - previousPoint.y); - } + (void)initContextWithView:(StreamView *)view andNativeTouchHandler:(NativeTouchHandler*)handler { diff --git a/Limelight/ViewControllers/MainFrameViewController.m b/Limelight/ViewControllers/MainFrameViewController.m index bcc7dab6..e2d9da22 100644 --- a/Limelight/ViewControllers/MainFrameViewController.m +++ b/Limelight/ViewControllers/MainFrameViewController.m @@ -307,9 +307,9 @@ static NSMutableSet* hostList; [self updateTitle]; [self disableUpButton]; + [self.collectionView removeFromSuperview]; // necessary for new scroll host view reloading mechanism + [self.view setBackgroundColor:[UIColor darkGrayColor]]; [self reloadScrollHostView]; // host view must be reloaded here - [self.collectionView reloadData]; - [self.view addSubview:hostScrollView]; } - (void) receivedAssetForApp:(TemporaryApp*)app { @@ -344,6 +344,9 @@ static NSMutableSet* hostList; Log(LOG_D, @"Clicked host: %@", host.name); _selectedHost = host; [self updateTitle]; + [self.collectionView reloadData]; //for new scroll host view reloading mechanism + [self.view addSubview:self.collectionView]; //for new scroll host view reloading mechanism + [self attachWaterMark]; [self enableUpButton]; [self disableNavigation]; @@ -881,8 +884,8 @@ static NSMutableSet* hostList; #if !TARGET_OS_TV // this method is deprecated -- (void)simulateSettingsButtonPressOpen { //force expand settings view to update resolution table, and all setting includes current fullscreen resolution will be updated. - if (currentPosition == FrontViewPositionLeft && _settingsButton.target && [_settingsButton.target respondsToSelector:_settingsButton.action]) { +- (void)simulateSettingsButtonPressClose { //force expand settings view to update resolution table, and all setting includes current fullscreen resolution will be updated. + if (currentPosition == FrontViewPositionRight && _settingsButton.target && [_settingsButton.target respondsToSelector:_settingsButton.action]) { [_settingsButton.target performSelector:_settingsButton.action withObject:_settingsButton]; } } @@ -895,6 +898,7 @@ static NSMutableSet* hostList; } - (void)handleOrientationChange { + if([self isIphone]) [self simulateSettingsButtonPressClose]; double delayInSeconds = 0.7; // Convert the delay into a dispatch_time_t value dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); @@ -996,6 +1000,7 @@ static NSMutableSet* hostList; - (void)attachWaterMark { // Create and configure the label + [self->waterMark removeFromSuperview]; self->waterMark = [[UILabel alloc] init]; self->waterMark.translatesAutoresizingMaskIntoConstraints = NO; self->waterMark.text = [LocalizationHelper localizedStringForKey:@"Modified by: True砖家 on Bilibili"]; @@ -1019,6 +1024,10 @@ static NSMutableSet* hostList; ]]; } +- (bool)isIphone{ + return ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone); +} + - (bool)isIPhonePortrait{ bool isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone); CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]); @@ -1032,7 +1041,6 @@ static NSMutableSet* hostList; { [super viewDidLoad]; //[OrientationHelper updateOrientationToLandscape]; - [self attachWaterMark]; #if !TARGET_OS_TV self.settingsExpandedInStreamView = false; // init this flag self.revealViewController.isStreaming = false; //init this flag for rvlVC @@ -1094,7 +1102,8 @@ static NSMutableSet* hostList; //recordedScreenWidth = CGRectGetWidth([[UIScreen mainScreen] bounds]); hostScrollView = [[ComputerScrollView alloc] init]; [self reloadScrollHostView]; - + if ([hostList count] == 1) [self hostClicked:[hostList anyObject] view:nil]; //move auto click here from reloadScrollHostView, resolving select new host bug. + //if([SettingsViewController isLandscapeNow] != _streamConfig.width > _streamConfig.height) //[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app. //[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app. @@ -1138,19 +1147,11 @@ static NSMutableSet* hostList; [self retrieveSavedHosts]; _discMan = [[DiscoveryManager alloc] initWithHosts:[hostList allObjects] andCallback:self]; - - if ([hostList count] == 1) { - [self hostClicked:[hostList anyObject] view:nil]; - } - else { - [self updateTitle]; - [self.view addSubview:hostScrollView]; - } + [self updateTitle]; + [self.view addSubview:hostScrollView]; } - - -(void)swapResolutionWidthHeightAccordingly{ DataManager* dataMan = [[DataManager alloc] init]; Settings *currentSettings = [dataMan retrieveSettings]; @@ -1255,7 +1256,8 @@ static NSMutableSet* hostList; - (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; + [super viewDidAppear:NO]; + //[self attachWaterMark]; #if !TARGET_OS_TV [[NSNotificationCenter defaultCenter] addObserver:self