diff --git a/Limelight/Database/DataManager.h b/Limelight/Database/DataManager.h index be6aba03..70299456 100644 --- a/Limelight/Database/DataManager.h +++ b/Limelight/Database/DataManager.h @@ -24,6 +24,7 @@ swipeToExitDistance:(CGFloat)swipeToExitDistance pointerVelocityModeDivider:(CGFloat)pointerVelocityModeDivider touchPointerVelocityFactor:(CGFloat)touchPointerVelocityFactor + mousePointerVelocityFactor:(CGFloat)mousePointerVelocityFactor liftStreamViewForKeyboard:(BOOL)liftStreamViewForKeyboard showKeyboardToolbar:(BOOL)showKeyboardToolbar optimizeGames:(BOOL)optimizeGames diff --git a/Limelight/Database/DataManager.m b/Limelight/Database/DataManager.m index 22436f09..1218e416 100644 --- a/Limelight/Database/DataManager.m +++ b/Limelight/Database/DataManager.m @@ -63,6 +63,7 @@ swipeToExitDistance:(CGFloat)swipeToExitDistance pointerVelocityModeDivider:(CGFloat)pointerVelocityModeDivider touchPointerVelocityFactor:(CGFloat)touchPointerVelocityFactor + mousePointerVelocityFactor:(CGFloat)mousePointerVelocityFactor liftStreamViewForKeyboard:(BOOL)liftStreamViewForKeyboard showKeyboardToolbar:(BOOL)showKeyboardToolbar optimizeGames:(BOOL)optimizeGames @@ -90,6 +91,7 @@ settingsToSave.swipeToExitDistance = [NSNumber numberWithFloat:swipeToExitDistance]; settingsToSave.pointerVelocityModeDivider = [NSNumber numberWithFloat:pointerVelocityModeDivider]; settingsToSave.touchPointerVelocityFactor = [NSNumber numberWithFloat:touchPointerVelocityFactor]; + settingsToSave.mousePointerVelocityFactor = [NSNumber numberWithFloat:mousePointerVelocityFactor]; settingsToSave.liftStreamViewForKeyboard = liftStreamViewForKeyboard; settingsToSave.showKeyboardToolbar = showKeyboardToolbar; settingsToSave.optimizeGames = optimizeGames; diff --git a/Limelight/Database/TemporarySettings.h b/Limelight/Database/TemporarySettings.h index ac3990a6..664a5232 100644 --- a/Limelight/Database/TemporarySettings.h +++ b/Limelight/Database/TemporarySettings.h @@ -26,6 +26,7 @@ @property (nonatomic, retain) NSNumber * swipeExitScreenEdge; @property (nonatomic, retain) NSNumber * swipeToExitDistance; @property (nonatomic, retain) NSNumber * touchPointerVelocityFactor; +@property (nonatomic, retain) NSNumber * mousePointerVelocityFactor; @property (nonatomic, retain) NSNumber * pointerVelocityModeDivider; @property (nonatomic, retain) NSString * uniqueId; @property (nonatomic) enum { diff --git a/Limelight/Database/TemporarySettings.m b/Limelight/Database/TemporarySettings.m index 5264fb0a..b10e5bb8 100644 --- a/Limelight/Database/TemporarySettings.m +++ b/Limelight/Database/TemporarySettings.m @@ -92,6 +92,7 @@ self.liftStreamViewForKeyboard = settings.liftStreamViewForKeyboard; self.showKeyboardToolbar = settings.showKeyboardToolbar; self.touchPointerVelocityFactor = settings.touchPointerVelocityFactor; + self.mousePointerVelocityFactor = settings.mousePointerVelocityFactor; self.pointerVelocityModeDivider = settings.pointerVelocityModeDivider; #endif self.uniqueId = settings.uniqueId; diff --git a/Limelight/Input/RelativeTouchHandler.h b/Limelight/Input/RelativeTouchHandler.h index 2f8d9dbd..ea4a16e8 100644 --- a/Limelight/Input/RelativeTouchHandler.h +++ b/Limelight/Input/RelativeTouchHandler.h @@ -7,12 +7,13 @@ // #import "StreamView.h" +#import "DataManager.h" NS_ASSUME_NONNULL_BEGIN @interface RelativeTouchHandler : UIResponder --(id)initWithView:(StreamView*)view; +- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings; @end diff --git a/Limelight/Input/RelativeTouchHandler.m b/Limelight/Input/RelativeTouchHandler.m index da3bac46..0e0ddffe 100644 --- a/Limelight/Input/RelativeTouchHandler.m +++ b/Limelight/Input/RelativeTouchHandler.m @@ -8,6 +8,7 @@ #import "RelativeTouchHandler.h" #import "CustomTapGestureRecognizer.h" +#import "DataManager.h" #include #define RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S 0.15 @@ -17,6 +18,7 @@ static const int REFERENCE_WIDTH = 1280; static const int REFERENCE_HEIGHT = 720; @implementation RelativeTouchHandler { + TemporarySettings* currentSettings; CGPoint touchLocation, originalLocation; BOOL touchMoved; BOOL isDragging; @@ -32,10 +34,10 @@ static const int REFERENCE_HEIGHT = 720; UIView* view; } -- (id)initWithView:(StreamView*)view { +- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings { self = [self init]; self->view = view; - + self->currentSettings = settings; // replace righclick recoginizing with my CustomTapGestureRecognizer for better experience, higher recoginizing rate. rightClickTapRecognizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(mouseRightClick)]; rightClickTapRecognizer.numberOfTouchesRequired = 2; @@ -112,8 +114,8 @@ static const int REFERENCE_HEIGHT = 720; if (touchLocation.x != currentLocation.x || touchLocation.y != currentLocation.y) { - int deltaX = (currentLocation.x - touchLocation.x) * (REFERENCE_WIDTH / view.bounds.size.width); - int deltaY = (currentLocation.y - touchLocation.y) * (REFERENCE_HEIGHT / view.bounds.size.height); + int deltaX = (currentLocation.x - touchLocation.x) * (REFERENCE_WIDTH / view.bounds.size.width) * currentSettings.mousePointerVelocityFactor.floatValue; + int deltaY = (currentLocation.y - touchLocation.y) * (REFERENCE_HEIGHT / view.bounds.size.height) * currentSettings.mousePointerVelocityFactor.floatValue; if (deltaX != 0 || deltaY != 0) { LiSendMouseMoveEvent(deltaX, deltaY); diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 349221c2..7261c58d 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -100,7 +100,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; case NATIVE_TOUCH_MODE: self->touchHandler = [[NativeTouchHandler alloc] initWithView:self andSettings:settings];break; case RELATIVE_TOUCH_MODE: - self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self]; + self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self andSettings:settings]; keyboardToggleRecognizer.immediateTriggering = true; //triggers signal in touchesBegan callback stage break; case ABSOLUTE_TOUCH_MODE: diff --git a/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents b/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents index e413b212..5d3dc987 100644 --- a/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents +++ b/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents @@ -30,6 +30,7 @@ + diff --git a/Limelight/ViewControllers/SettingsViewController.h b/Limelight/ViewControllers/SettingsViewController.h index 52005628..805782e5 100644 --- a/Limelight/ViewControllers/SettingsViewController.h +++ b/Limelight/ViewControllers/SettingsViewController.h @@ -38,6 +38,8 @@ @property (strong, nonatomic) IBOutlet UILabel *pointerVelocityModeDividerUILabel; @property (strong, nonatomic) IBOutlet UISlider *touchPointerVelocityFactorSlider; @property (strong, nonatomic) IBOutlet UILabel *touchPointerVelocityFactorUILabel; +@property (strong, nonatomic) IBOutlet UISlider *mousePointerVelocityFactorSlider; +@property (strong, nonatomic) IBOutlet UILabel *mousePointerVelocityFactorUILabel; diff --git a/Limelight/ViewControllers/SettingsViewController.m b/Limelight/ViewControllers/SettingsViewController.m index 066f0772..9869f806 100644 --- a/Limelight/ViewControllers/SettingsViewController.m +++ b/Limelight/ViewControllers/SettingsViewController.m @@ -305,9 +305,16 @@ BOOL isCustomResolution(CGSize res) { [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 Factor: %d%%", (uint16_t)self.touchPointerVelocityFactorSlider.value]]; // Initiate label display + [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. + [self.mousePointerVelocityFactorSlider setEnabled: currentSettings.touchMode.intValue == RELATIVE_TOUCH_MODE]; // mouse velocity scaling works only in relative touch mode. + + } - (void) pointerVelocityModeDividerSliderMoved { @@ -315,7 +322,11 @@ BOOL isCustomResolution(CGSize res) { } - (void) touchPointerVelocityFactorSliderMoved { - [self.touchPointerVelocityFactorUILabel setText:[NSString stringWithFormat:@"Touch Pointer Velocity Factor: %d%%", (uint16_t)self.touchPointerVelocityFactorSlider.value]]; // Initiate label display + [self.touchPointerVelocityFactorUILabel setText:[NSString stringWithFormat:@"Touch Pointer Velocity: %d%%", (uint16_t)self.touchPointerVelocityFactorSlider.value]]; // Update label display +} + +- (void) mousePointerVelocityFactorSliderMoved { + [self.mousePointerVelocityFactorUILabel setText:[NSString stringWithFormat:@"Mouse Pointer Velocity: %d%%", (uint16_t)self.mousePointerVelocityFactorSlider.value]]; // Update label display } - (uint32_t) getScreenEdgeFromSelector { @@ -343,6 +354,7 @@ BOOL isCustomResolution(CGSize res) { [self.onscreenControlSelector setEnabled:[self.touchModeSelector selectedSegmentIndex] == RELATIVE_TOUCH_MODE]; [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. } - (void) updateBitrate { @@ -618,6 +630,7 @@ BOOL isCustomResolution(CGSize res) { uint32_t swipeExitScreenEdge = [self getScreenEdgeFromSelector]; CGFloat pointerVelocityModeDivider = (CGFloat)(uint8_t)self.pointerVelocityModeDividerSlider.value/100; CGFloat touchPointerVelocityFactor =(CGFloat)(uint16_t)self.touchPointerVelocityFactorSlider.value/100; + CGFloat mousePointerVelocityFactor =(CGFloat)(uint16_t)self.mousePointerVelocityFactorSlider.value/100; BOOL liftStreamViewForKeyboard = [self.liftStreamViewForKeyboardSelector selectedSegmentIndex] == 1; BOOL showKeyboardToolbar = [self.showKeyboardToolbarSelector selectedSegmentIndex] == 1; BOOL optimizeGames = [self.optimizeSettingsSelector selectedSegmentIndex] == 1; @@ -642,6 +655,7 @@ BOOL isCustomResolution(CGSize res) { swipeToExitDistance:swipeToExitDistance pointerVelocityModeDivider:pointerVelocityModeDivider touchPointerVelocityFactor:touchPointerVelocityFactor + mousePointerVelocityFactor:mousePointerVelocityFactor liftStreamViewForKeyboard:liftStreamViewForKeyboard showKeyboardToolbar:showKeyboardToolbar optimizeGames:optimizeGames diff --git a/iPad.storyboard b/iPad.storyboard index 5bff5e90..253b0d45 100644 --- a/iPad.storyboard +++ b/iPad.storyboard @@ -109,25 +109,6 @@ - - - - - - - - - - - -