From b79a762ce19654a5aec5fc0278077e382b7d80a2 Mon Sep 17 00:00:00 2001 From: True Zhuanjia Date: Wed, 26 Jun 2024 03:16:41 +0800 Subject: [PATCH] enhanced CustomOSC, allow users to rebase OSC in stream view --- Limelight/Input/StreamView.h | 3 + Limelight/Input/StreamView.m | 16 ++- .../LayoutOnScreenControlsViewController.h | 3 +- .../LayoutOnScreenControlsViewController.m | 36 ++++++- .../ToolBarContainerView.m | 2 - .../ViewControllers/SettingsViewController.h | 2 +- .../ViewControllers/SettingsViewController.m | 99 +++++++++++++------ .../StreamFrameViewController.h | 2 + .../StreamFrameViewController.m | 47 ++++++++- Limelight/iPad.storyboard | 12 +-- Limelight/iPhone.storyboard | 5 +- Moonlight.xcodeproj/project.pbxproj | 2 + 12 files changed, 181 insertions(+), 48 deletions(-) diff --git a/Limelight/Input/StreamView.h b/Limelight/Input/StreamView.h index 40d940e1..471eb43f 100644 --- a/Limelight/Input/StreamView.h +++ b/Limelight/Input/StreamView.h @@ -28,6 +28,9 @@ interactionDelegate:(id)interactionDelegate config:(StreamConfiguration*)streamConfig; - (void) showOnScreenControls; +- (void) disableOnScreenControls; +- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport + andConfig:(StreamConfiguration*)streamConfig; - (CGSize) getVideoAreaSize; - (CGPoint) adjustCoordinatesForVideoArea:(CGPoint)point; - (uint16_t)getRotationFromAzimuthAngle:(float)azimuthAngle; diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 7261c58d..c18cd396 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -74,7 +74,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; isInputingText = false; keyboardToggleRecognizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleKeyboard)]; - keyboardToggleRecognizer.numberOfTouchesRequired = settings.keyboardToggleFingers.intValue; + keyboardToggleRecognizer.numberOfTouchesRequired = settings.keyboardToggleFingers.intValue; //will be changed accordinly by touch modes. keyboardToggleRecognizer.tapDownTimeThreshold = 0.3; // tap down time threshold in seconds. keyboardToggleRecognizer.delaysTouchesBegan = NO; keyboardToggleRecognizer.delaysTouchesEnded = NO; @@ -101,7 +101,8 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; self->touchHandler = [[NativeTouchHandler alloc] initWithView:self andSettings:settings];break; case RELATIVE_TOUCH_MODE: self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self andSettings:settings]; - keyboardToggleRecognizer.immediateTriggering = true; //triggers signal in touchesBegan callback stage + keyboardToggleRecognizer.immediateTriggering = false; + keyboardToggleRecognizer.numberOfTouchesRequired = 3; //fixing keyboard taps to 3, in order to invoke OSC rebase in stream view by 4-finger tap. break; case ABSOLUTE_TOUCH_MODE: self->touchHandler = [[AbsoluteTouchHandler alloc] initWithView:self]; @@ -269,6 +270,17 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; [onScreenControls show]; #endif } +- (void) disableOnScreenControls { +#if !TARGET_OS_TV + [onScreenControls setLevel:OnScreenControlsLevelOff]; +#endif +} + +- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport + andConfig:(StreamConfiguration*)streamConfig { + onScreenControls = [[OnScreenControls alloc] initWithView:self controllerSup:controllerSupport streamConfig:streamConfig]; + [onScreenControls setLevel:OnScreenControlsCustom]; +} - (OnScreenControlsLevel) getCurrentOscState { if (onScreenControls == nil) { diff --git a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h index acbaa5d3..63d0e402 100644 --- a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h +++ b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.h @@ -29,8 +29,7 @@ NS_ASSUME_NONNULL_BEGIN @property (weak, nonatomic) IBOutlet UIImageView *chevronImageView; @property (weak, nonatomic) IBOutlet UIStackView *toolbarStackView; - - @end + NS_ASSUME_NONNULL_END diff --git a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m index da7dcb7f..f73003ab 100644 --- a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m +++ b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m @@ -31,6 +31,12 @@ @synthesize chevronView; @synthesize chevronImageView; + +- (void) viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + [[NSNotificationCenter defaultCenter] postNotificationName:@"OscLayoutCloseNotification" object:self]; +} + - (void) viewDidLoad { [super viewDidLoad]; @@ -57,7 +63,7 @@ [self.chevronView addGestureRecognizer:singleFingerTap]; self.layoutOSC = [[LayoutOnScreenControls alloc] initWithView:self.view controllerSup:nil streamConfig:nil oscLevel:OSCSegmentSelected]; - self.layoutOSC._level = 4; + self.layoutOSC._level = OnScreenControlsCustom; [self.layoutOSC show]; // draw on screen controls [self addInnerAnalogSticksToOuterAnalogLayers]; // allows inner and analog sticks to be dragged together around the screen together as one unit which is the expected behavior @@ -93,6 +99,7 @@ }]; }]; }); + [self profileRefresh]; } @@ -271,6 +278,33 @@ [self presentViewController:inputNameAlertController animated:YES completion:nil]; } + +/* Presents the view controller that lists all OSC profiles the user can choose from */ +- (void)profileRefresh{ + UIStoryboard *storyboard; + BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone); + if (isIPhone) { + storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil]; + } + else { + storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil]; + } + + OSCProfilesTableViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"OSCProfilesTableViewController"] ; + + vc.didDismissOSCProfilesTVC = ^() { // a block that will be called when the modally presented 'OSCProfilesTableViewController' VC is dismissed. By the time the 'OSCProfilesTableViewController' VC is dismissed the user would have potentially selected a different OSC profile with a different layout and they want to see this layout on this 'LayoutOnScreenControlsViewController.' This block of code will load the profile and then hide/show and move each OSC button to their appropriate position + [self.layoutOSC updateControls]; // creates and saves a 'Default' OSC profile or loads the one the user selected on the previous screen + + [self addInnerAnalogSticksToOuterAnalogLayers]; + + [self.layoutOSC.layoutChanges removeAllObjects]; // since a new OSC profile is being loaded, this will remove all previous layout changes made from the array + + [self OSCLayoutChanged]; // fades the 'Undo Button' out + }; + [self presentViewController:vc animated:YES completion:nil]; +} + + /* Presents the view controller that lists all OSC profiles the user can choose from */ - (IBAction) loadTapped:(id)sender { UIStoryboard *storyboard; diff --git a/Limelight/ViewControllers/CustomOSCViewControl/ToolBarContainerView.m b/Limelight/ViewControllers/CustomOSCViewControl/ToolBarContainerView.m index c08fc758..a21fa2de 100644 --- a/Limelight/ViewControllers/CustomOSCViewControl/ToolBarContainerView.m +++ b/Limelight/ViewControllers/CustomOSCViewControl/ToolBarContainerView.m @@ -11,9 +11,7 @@ @implementation ToolBarContainerView - (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *)event { - for (UIView *view in self.subviews) { - if (!view.hidden && view.alpha > 0 && view.userInteractionEnabled && [view pointInside:[self convertPoint:point toView:view] withEvent:event]) diff --git a/Limelight/ViewControllers/SettingsViewController.h b/Limelight/ViewControllers/SettingsViewController.h index a93f0fb2..0e910f4d 100644 --- a/Limelight/ViewControllers/SettingsViewController.h +++ b/Limelight/ViewControllers/SettingsViewController.h @@ -17,6 +17,7 @@ @property (strong, nonatomic) IBOutlet UISegmentedControl *resolutionSelector; @property (strong, nonatomic) IBOutlet UIView *resolutionDisplayView; @property (strong, nonatomic) IBOutlet UISegmentedControl *touchModeSelector; +@property (strong, nonatomic) IBOutlet UILabel *onscreenControllerLabel; @property (strong, nonatomic) IBOutlet UISegmentedControl *onscreenControlSelector; @property (strong, nonatomic) IBOutlet UISegmentedControl *optimizeSettingsSelector; @property (strong, nonatomic) IBOutlet UISegmentedControl *multiControllerSelector; @@ -43,7 +44,6 @@ @property (strong, nonatomic) IBOutlet UILabel *mousePointerVelocityFactorUILabel; @property (strong, nonatomic) LayoutOnScreenControlsViewController *layoutOnScreenControlsVC; - #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunguarded-availability" diff --git a/Limelight/ViewControllers/SettingsViewController.m b/Limelight/ViewControllers/SettingsViewController.m index ab511079..8fd2ad6c 100644 --- a/Limelight/ViewControllers/SettingsViewController.m +++ b/Limelight/ViewControllers/SettingsViewController.m @@ -288,10 +288,20 @@ BOOL isCustomResolution(CGSize res) { [self updateBitrateText]; [self updateResolutionDisplayViewText]; - [self.keyboardToggleFingerNumSlider setValue:(CGFloat)currentSettings.keyboardToggleFingers.intValue animated:YES]; // Load old setting. old setting was converted to uint16_t before saving. - if (self.keyboardToggleFingerNumSlider.value > 10.5f) [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"Tap-Toggle Local Keyboard Disabled"]]; // Initiate label display. Allow higher required finger number to completely disable keyboard toggle - else [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"To Toggle Local Keyboard: Tap %d Fingers", (uint16_t)self.keyboardToggleFingerNumSlider.value]]; // Initiate label display + + if(currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE){ + [self.keyboardToggleFingerNumSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] != RELATIVE_TOUCH_MODE]; + [self.keyboardToggleFingerNumSlider setValue:3.0]; + [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"To Toggle Local Keyboard: Tap %d Fingers", (uint16_t)self.keyboardToggleFingerNumSlider.value]]; + } + else{ + [self.keyboardToggleFingerNumSlider setValue:(CGFloat)currentSettings.keyboardToggleFingers.intValue animated:YES]; // Load old setting. old setting was converted to uint16_t before saving. + if (self.keyboardToggleFingerNumSlider.value > 10.5f) [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"Tap-Toggle Local Keyboard Disabled"]]; // Initiate label display. Allow higher required finger number to completely disable keyboard toggle + else [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"To Toggle Local Keyboard: Tap %d Fingers", (uint16_t)self.keyboardToggleFingerNumSlider.value]]; // Initiate label display + } [self.keyboardToggleFingerNumSlider addTarget:self action:@selector(keyboardToggleFingerNumSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved. + + [self.liftStreamViewForKeyboardSelector setSelectedSegmentIndex:currentSettings.liftStreamViewForKeyboard ? 1 : 0];// Load old setting [self.showKeyboardToolbarSelector setSelectedSegmentIndex:currentSettings.showKeyboardToolbar ? 1 : 0];// Load old setting [self.swipeExitScreenEdgeSelector setSelectedSegmentIndex:[self getSelectorIndexFromScreenEdge:(uint32_t)currentSettings.swipeExitScreenEdge.integerValue]]; // Load old setting @@ -299,16 +309,19 @@ BOOL isCustomResolution(CGSize res) { [self.swipeToExitDistanceUILabel setText:[NSString stringWithFormat:@"Swipe & Exit Distance: %.2f * screen-width", self.swipeToExitDistanceSlider.value]]; // Initiate label display [self.swipeToExitDistanceSlider addTarget:self action:@selector(swipeToExitDistanceSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved. + [self.pointerVelocityModeDividerSlider setValue:currentSettings.pointerVelocityModeDivider.floatValue * 100 animated:YES]; // Load old setting. [self.pointerVelocityModeDividerUILabel setText:[NSString stringWithFormat:@"Touch Pointer Velocity: Scaled on %d%% of Right Screen", 100 - (uint8_t)self.pointerVelocityModeDividerSlider.value]]; // Initiate label display [self.pointerVelocityModeDividerSlider addTarget:self action:@selector(pointerVelocityModeDividerSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved. [self.pointerVelocityModeDividerSlider setEnabled: currentSettings.touchMode.intValue == NATIVE_TOUCH_MODE]; // pointer velocity scaling works only in native touch mode. + [self.touchPointerVelocityFactorSlider setValue:currentSettings.touchPointerVelocityFactor.floatValue * 100 animated:YES]; // Load old setting. [self.touchPointerVelocityFactorUILabel setText:[NSString stringWithFormat:@"Touch Pointer Velocity: %d%%", (uint16_t)self.touchPointerVelocityFactorSlider.value]]; // Initiate label display [self.touchPointerVelocityFactorSlider addTarget:self action:@selector(touchPointerVelocityFactorSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved. [self.touchPointerVelocityFactorSlider setEnabled: currentSettings.touchMode.intValue == NATIVE_TOUCH_MODE]; // pointer velocity scaling works only in native touch mode. + [self.mousePointerVelocityFactorSlider setValue:currentSettings.mousePointerVelocityFactor.floatValue * 100 animated:YES]; // Load old setting. [self.mousePointerVelocityFactorUILabel setText:[NSString stringWithFormat:@"Mouse Pointer Velocity: %d%%", (uint16_t)self.mousePointerVelocityFactorSlider.value]]; // Initiate label display [self.mousePointerVelocityFactorSlider addTarget:self action:@selector(mousePointerVelocityFactorSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved. @@ -329,45 +342,57 @@ BOOL isCustomResolution(CGSize res) { self.layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"]; self.layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen; } - /* - if(currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE && currentSettings.onscreenControls.intValue == 4){ // load old settings - if (self.layoutOnScreenControlsVC.isBeingPresented == NO) { - [self presentViewController:self.layoutOnScreenControlsVC animated:YES completion:nil]; - } - }*/ + if(currentSettings.onscreenControls.intValue == OnScreenControlsCustom && currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE) { + [self.onscreenControllerLabel setText:@"Tap 4 Fingers to Change OSC Layout in Stream View"]; + //if (self.layoutOnScreenControlsVC.isBeingPresented == NO) + } + else{ + [self.onscreenControllerLabel setText:@"On-Screen Controls"]; + } } + +- (void)showCustomOSCTip { + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Rebase in Stream View" + message:@"Tap 4 fingers to change on-screen controller layout in stream view ~" + preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Got it!" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction *action) { + // Continue execution after the alert is dismissed + [self invokeOscLayout]; + NSLog(@"OK button tapped"); + }]; + [alertController addAction:okAction]; + [self presentViewController:alertController animated:YES completion:nil]; +} + + + - (void)onscreenControlChanged{ - - LayoutOnScreenControlsViewController *vc = [[LayoutOnScreenControlsViewController alloc] init]; BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone); if (isIPhone) { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil]; - vc = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"]; + self.layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"]; } else { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil]; - vc = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"]; - vc.modalPresentationStyle = UIModalPresentationFullScreen; + self.layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"]; + self.layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen; } - switch ([self.onscreenControlSelector selectedSegmentIndex]) { - case 0: - break; - case 1: - break; - case 2: - break; - case 3: - break; - case 4: - if (self.layoutOnScreenControlsVC.isBeingPresented == NO) { - [self presentViewController:self.layoutOnScreenControlsVC animated:YES completion:nil]; - } - break; - } + if([self.onscreenControlSelector selectedSegmentIndex] == OnScreenControlsCustom && [self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE) { + [self.onscreenControllerLabel setText:@"Tap 4 Fingers to Change OSC Layout in Stream View"]; + [self showCustomOSCTip]; + //if (self.layoutOnScreenControlsVC.isBeingPresented == NO) + } + else{ + [self.onscreenControllerLabel setText:@"On-Screen Controls"]; + } +} - +- (void)invokeOscLayout{ + [self presentViewController:self.layoutOnScreenControlsVC animated:YES completion:nil]; } @@ -409,6 +434,20 @@ BOOL isCustomResolution(CGSize res) { [self.pointerVelocityModeDividerSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] == NATIVE_TOUCH_MODE]; // pointer velocity scaling works only in native touch mode. [self.touchPointerVelocityFactorSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] == NATIVE_TOUCH_MODE]; // pointer velocity scaling works only in native touch mode. [self.mousePointerVelocityFactorSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE]; // mouse velocity scaling works only in relative touch mode. + // number of touches required to toggle keyboard in relative touch mode will be fixed to 3. + [self.keyboardToggleFingerNumSlider setEnabled:[self.touchModeSelector selectedSegmentIndex] != RELATIVE_TOUCH_MODE]; + if([self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE) { + [self.keyboardToggleFingerNumSlider setValue:3.0]; + [self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"To Toggle Local Keyboard: Tap %d Fingers", (uint16_t)self.keyboardToggleFingerNumSlider.value]]; + } + + if([self.onscreenControlSelector selectedSegmentIndex] == OnScreenControlsCustom && [self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE) { + [self.onscreenControllerLabel setText:@"Tap 4 Fingers to Change OSC Layout in Stream View"]; + //if (self.layoutOnScreenControlsVC.isBeingPresented == NO) + } + else{ + [self.onscreenControllerLabel setText:@"On-Screen Controls"]; + } } - (void) updateBitrate { diff --git a/Limelight/ViewControllers/StreamFrameViewController.h b/Limelight/ViewControllers/StreamFrameViewController.h index dc9e5a82..417b1664 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.h +++ b/Limelight/ViewControllers/StreamFrameViewController.h @@ -9,6 +9,7 @@ #import "Connection.h" #import "StreamConfiguration.h" #import "StreamView.h" +#import "LayoutOnScreenControlsViewController.h" #import @@ -18,6 +19,7 @@ @interface StreamFrameViewController : GCEventViewController #else @interface StreamFrameViewController : UIViewController + #endif @property (nonatomic) StreamConfiguration* streamConfig; diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index fee96e2e..8d38b68b 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -12,12 +12,13 @@ #import "StreamManager.h" #import "ControllerSupport.h" #import "DataManager.h" +#import "CustomEdgeSwipeGestureRecognizer.h" +#import "CustomTapGestureRecognizer.h" #include #include #include #include -#import "CustomEdgeSwipeGestureRecognizer.h" #if TARGET_OS_TV #import @@ -53,6 +54,8 @@ #if !TARGET_OS_TV CustomEdgeSwipeGestureRecognizer *_exitSwipeRecognizer; + CustomTapGestureRecognizer *_oscLayoutTapRecoginizer; + LayoutOnScreenControlsViewController *_layoutOnScreenControlsVC; #endif } @@ -139,6 +142,30 @@ _exitSwipeRecognizer.delaysTouchesEnded = NO; [self.view addGestureRecognizer:_exitSwipeRecognizer]; + + if(_settings.touchMode.intValue == RELATIVE_TOUCH_MODE && _settings.onscreenControls.intValue == OnScreenControlsCustom){ + _oscLayoutTapRecoginizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(layoutOSC)]; + _oscLayoutTapRecoginizer.numberOfTouchesRequired = 4; //tap 4 fingers to invoke OSC rebase + _oscLayoutTapRecoginizer.tapDownTimeThreshold = 1; + _oscLayoutTapRecoginizer.delaysTouchesBegan = NO; + _oscLayoutTapRecoginizer.delaysTouchesEnded = NO; + [self.view addGestureRecognizer:_oscLayoutTapRecoginizer]; + /* sets a reference to the correct 'LayoutOnScreenControlsViewController' depending on whether the user is on an iPhone or iPad */ + _layoutOnScreenControlsVC = [[LayoutOnScreenControlsViewController alloc] init]; + BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone); + if (isIPhone) { + UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil]; + _layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"]; + } + else { + UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil]; + _layoutOnScreenControlsVC = [storyboard instantiateViewControllerWithIdentifier:@"LayoutOnScreenControlsViewController"]; + _layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationFullScreen; + } + _layoutOnScreenControlsVC.view.backgroundColor = UIColor.clearColor; + _layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationOverCurrentContext; + } + #endif _tipLabel = [[UILabel alloc] init]; @@ -175,6 +202,11 @@ selector: @selector(applicationDidEnterBackground:) name: UIApplicationDidEnterBackgroundNotification object: nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(oscLayoutClosed) + name:@"OscLayoutCloseNotification" + object:nil]; #if 0 // FIXME: This doesn't work reliably on iPad for some reason. Showing and hiding the keyboard @@ -216,6 +248,19 @@ [self.view addSubview:_tipLabel]; } +- (void)layoutOSC{ + [self->_streamView disableOnScreenControls]; + [self presentViewController:_layoutOnScreenControlsVC animated:YES completion:nil]; +} + +- (void)oscLayoutClosed{ + // Handle the callback + [self->_streamView reloadOnScreenControlsWith:(ControllerSupport*)_controllerSupport + andConfig:(StreamConfiguration*)_streamConfig]; + [self->_streamView showOnScreenControls]; +} + + - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return _streamView; } diff --git a/Limelight/iPad.storyboard b/Limelight/iPad.storyboard index cf1dcbe2..5de6a4a8 100644 --- a/Limelight/iPad.storyboard +++ b/Limelight/iPad.storyboard @@ -198,8 +198,8 @@ -