diff --git a/Limelight/Input/CommandManager.swift b/Limelight/Input/CommandManager.swift index a547c438..7ba17d1e 100644 --- a/Limelight/Input/CommandManager.swift +++ b/Limelight/Input/CommandManager.swift @@ -77,6 +77,7 @@ import UIKit @objc public static let touchPadCmds: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD", "MOUSEPAD", "DPAD", "WASDPAD", "ARROWPAD"] @objc public static let stickTouchPads: [String] = ["LSVPAD", "RSVPAD", "LSPAD", "RSPAD"] @objc public static let nonVectorStickPads: [String] = ["LSPAD", "RSPAD"] + @objc public static let specialOverlayButtonCmds: [String] = ["SETTINGS"] static let keyboardButtonMappings: [String: Int16] = [ // Windows Key Codes diff --git a/Limelight/Input/OnScreenButtonView.swift b/Limelight/Input/OnScreenButtonView.swift index 4637d399..12519898 100644 --- a/Limelight/Input/OnScreenButtonView.swift +++ b/Limelight/Input/OnScreenButtonView.swift @@ -120,7 +120,7 @@ import UIKit self.mousePointerMoved = false self.touchLockedForMoveEvent = UITouch() self.twoTouchesDetected = false - self.stickIndicatorXOffset = 120 + self.stickIndicatorXOffset = 95 self.sensitivityFactor = 1.0 super.init(frame: .zero) @@ -263,6 +263,11 @@ import UIKit } } + if CommandManager.specialOverlayButtonCmds.contains(self.keyString){ + self.layer.borderWidth = 0 + } + + // self.layer.shadowColor = UIColor.clear.cgColor // self.layer.shadowRadius = 8 // self.layer.shadowOpacity = 0.5 @@ -611,6 +616,7 @@ import UIKit CATransaction.begin() CATransaction.setDisableActions(true) // self.layer.borderWidth = 0 + buttonDownVisualEffectLayer.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)) // update position every time we press down the button buttonDownVisualEffectLayer.borderWidth = self.buttonDownVisualEffectWidth // this will show the visual effect buttonDownVisualEffectLayer.borderColor = moonlightPurple CATransaction.commit() @@ -734,11 +740,11 @@ import UIKit break } } - + if !CommandManager.touchPadCmds.contains(self.keyString) { self.buttonDownVisualEffect() } - + if CommandManager.oscButtonMappings.keys.contains(self.keyString) { let buttonFlag = CommandManager.oscButtonMappings[self.keyString] if buttonFlag != 0 {self.onScreenControls.pressDownControllerButton(buttonFlag!)} @@ -773,6 +779,15 @@ import UIKit } + private func moveByTouch(touch: UITouch){ + let currentLocation = touch.location(in: superview) + let offsetX = currentLocation.x - storedLocation.x + let offsetY = currentLocation.y - storedLocation.y + center = CGPoint(x: center.x + offsetX, y: center.y + offsetY) + //NSLog("x coord: %f, y coord: %f", self.frame.origin.x, self.frame.origin.y) + storedLocation = currentLocation // Update initial center for next movement + } + override func touchesMoved(_ touches: Set, with event: UIEvent?) { super.touchesMoved(touches, with: event) OnScreenButtonView.timestampOfButtonBeingDragged = self.timestamp @@ -781,20 +796,23 @@ import UIKit if CommandManager.touchPadCmds.contains(self.keyString){ handleTouchPadMoveEvent(touches, with: event) } + + if CommandManager.specialOverlayButtonCmds.contains(self.keyString){ + if let touch = touches.first { + NSLog("touchTapTimeStamp %f", self.touchTapTimeStamp) + if CACurrentMediaTime() - self.touchTapTimeStamp > 0.3 { // temporarily relocate special buttons + self.moveByTouch(touch: touch) + self.buttonUpVisualEffect() + } + } + } } // Move the buttonView based on touch movement in relocation mode if OnScreenButtonView.editMode { if let touch = touches.first { - let currentLocation = touch.location(in: superview) - let offsetX = currentLocation.x - storedLocation.x - let offsetY = currentLocation.y - storedLocation.y - - center = CGPoint(x: center.x + offsetX, y: center.y + offsetY) - //NSLog("x coord: %f, y coord: %f", self.frame.origin.x, self.frame.origin.y) - storedLocation = currentLocation // Update initial center for next movement + self.moveByTouch(touch: touch) } - if CommandManager.nonVectorStickPads.contains(self.keyString) { self.stickBallLayer.removeFromSuperlayer() self.crossMarkLayer.removeFromSuperlayer() @@ -894,6 +912,18 @@ import UIKit } } + if !OnScreenButtonView.editMode && CommandManager.specialOverlayButtonCmds.contains(self.keyString){ + if CACurrentMediaTime() - self.touchTapTimeStamp < 0.3 { + switch self.keyString { + case "SETTINGS": + NotificationCenter.default.post(name: Notification.Name("SettingsOverlayButtonPressedNotification"), object:nil) // inform layout tool controller to fetch button size factors. self will be passed as the object of the notification + default: + break + } + } + } + + self.buttonUpVisualEffect() self.l3r3Indicator.removeFromSuperlayer() diff --git a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m index 8a07f3a4..8f4b4506 100644 --- a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m +++ b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m @@ -349,7 +349,9 @@ bool noValidMouseButtonString = ![CommandManager.mouseButtonMappings.allKeys containsObject:cmdString]; bool noValidTouchPadString = ![CommandManager.touchPadCmds containsObject:cmdString]; bool noValidOscButtonString = ![CommandManager.oscButtonMappings.allKeys containsObject:cmdString]; - if(noValidKeyboardString && noValidMouseButtonString && noValidTouchPadString && noValidOscButtonString) return; + bool noValidSpecialButtonString = ![CommandManager.specialOverlayButtonCmds containsObject:cmdString]; + + if(noValidKeyboardString && noValidMouseButtonString && noValidTouchPadString && noValidOscButtonString && noValidSpecialButtonString) return; //saving & present the keyboard button: OnScreenButtonView* buttonView = [[OnScreenButtonView alloc] initWithKeyString:cmdString keyLabel:keyLabel]; @@ -467,6 +469,7 @@ [widgetHeightSliderLabel setText:[LocalizationHelper localizedStringForKey:@"Widget Height: %.2f", self.widgetHeightSlider.value]]; if(self->selectedButtonView != nil && self->buttonViewSelected){ self->selectedButtonView.translatesAutoresizingMaskIntoConstraints = true; // this is mandatory to prevent unexpected key view location change + if([CommandManager.oscButtonMappings.allKeys containsObject:selectedButtonView.keyString]) return; // don't change custom osc button height self->selectedButtonView.heightFactor = self.widgetHeightSlider.value; [self->selectedButtonView resizeButtonView]; } diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index 584368f2..fca44e3a 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -233,6 +233,12 @@ selector:@selector(sessionDisconnectedBySettingView) //quit session when exit button is press in setting view during streaming name:@"SessionDisconnectedBySettingsViewNotification" object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(expandSettingsView) // //force expand settings view to update resolution table, and all setting includes current fullscreen resolution will be updated. + name:@"SettingsOverlayButtonPressedNotification" + object:nil]; + #endif }