diff --git a/Limelight/Input/StreamView.h b/Limelight/Input/StreamView.h index c502f74..3ca1c9f 100644 --- a/Limelight/Input/StreamView.h +++ b/Limelight/Input/StreamView.h @@ -37,7 +37,6 @@ interactionDelegate:(id)interactionDelegate config:(StreamConfiguration*)streamConfig; - (void) showOnScreenControls; -- (void) setMouseDeltaFactors:(float)x y:(float)y; - (OnScreenControlsLevel) getCurrentOscState; @end diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index e80c100..f6df148 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -15,6 +15,9 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; +static const int REFERENCE_WIDTH = 1280; +static const int REFERENCE_HEIGHT = 720; + @implementation StreamView { CGPoint touchLocation, originalLocation; BOOL touchMoved; @@ -26,9 +29,6 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; NSTimer* dragTimer; float streamAspectRatio; - float xDeltaFactor; - float yDeltaFactor; - float screenFactor; NSInteger lastMouseButtonMask; double mouseX; @@ -46,19 +46,6 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; TextFieldKeyboardDelegate* textFieldDelegate; } -- (void) setMouseDeltaFactors:(float)x y:(float)y { - xDeltaFactor = x; - yDeltaFactor = y; - -#if TARGET_OS_TV - // The Apple TV uses indirect touch devices, so they should - // not be scaled by the screen scaling factor. - screenFactor = 1.0f; -#else - screenFactor = [[UIScreen mainScreen] scale]; -#endif -} - - (void) setupStreamView:(ControllerSupport*)controllerSupport swipeDelegate:(id)swipeDelegate interactionDelegate:(id)interactionDelegate @@ -156,9 +143,9 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; } } -- (Boolean)isConfirmedMove:(CGPoint)currentPoint from:(CGPoint)originalPoint { - // Movements of greater than 10 pixels are considered confirmed - return hypotf(originalPoint.x - currentPoint.x, originalPoint.y - currentPoint.y) >= 10; +- (BOOL)isConfirmedMove:(CGPoint)currentPoint from:(CGPoint)originalPoint { + // Movements of greater than 5 pixels are considered confirmed + return hypotf(originalPoint.x - currentPoint.x, originalPoint.y - currentPoint.y) >= 5; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { @@ -256,11 +243,8 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; if (touchLocation.x != currentLocation.x || touchLocation.y != currentLocation.y) { - int deltaX = currentLocation.x - touchLocation.x; - int deltaY = currentLocation.y - touchLocation.y; - - deltaX *= xDeltaFactor * screenFactor; - deltaY *= yDeltaFactor * screenFactor; + int deltaX = (currentLocation.x - touchLocation.x) * (REFERENCE_WIDTH / self.bounds.size.width); + int deltaY = (currentLocation.y - touchLocation.y) * (REFERENCE_HEIGHT / self.bounds.size.height); if (deltaX != 0 || deltaY != 0) { LiSendMouseMoveEvent(deltaX, deltaY); diff --git a/Limelight/Stream/StreamManager.m b/Limelight/Stream/StreamManager.m index b2f3589..5cacae8 100644 --- a/Limelight/Stream/StreamManager.m +++ b/Limelight/Stream/StreamManager.m @@ -77,13 +77,6 @@ return; } } - - // Set mouse delta factors from the screen resolution and stream size - CGFloat screenScale = [[UIScreen mainScreen] scale]; - CGRect screenBounds = [[UIScreen mainScreen] bounds]; - CGSize screenSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale); - [((StreamView*)_renderView) setMouseDeltaFactors:_config.width / screenSize.width - y:_config.height / screenSize.height]; // Populate the config's version fields from serverinfo _config.appVersion = appversion;