- touchpad gesture tweaks and improvements

- cancel realtime switch for single point touch gesture passthrough
- cancel remembering settings menu content offset
This commit is contained in:
TrueZhuanjia
2025-11-08 11:34:54 +08:00
parent f01d36d4a0
commit 5c646ef3d2
6 changed files with 20 additions and 17 deletions
+10 -5
View File
@@ -89,8 +89,8 @@
- (void)onLongPressStart:(NSTimer*)timer {
// Raise the left click and start a right click
if(currentTouchesCount>=2) return;
if(multiTouchesDetected) return;
if([self touchDidntMoveOnScreen:movingTouchLocation]){
if(_delayMouseLeftClick){
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
@@ -109,8 +109,11 @@
rightButtonClicked = false;
if([UITouchUtil touchesIn:streamView from:event].count>=2) multiTouchesDetected = true;
if([UITouchUtil touchesIn:streamView from:event].count>=2){
multiTouchesDetected = true;
[longPressTimer invalidate];
longPressTimer = nil;
}
CGPoint initialPoint = [[touches anyObject] locationInView:streamView];
if(initialPoint.y < slideGestureVerticalThreshold && (initialPoint.x < _edgeTolerance || initialPoint.x > screenWidthWithThreshold)) {
@@ -209,11 +212,13 @@
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[longPressTimer invalidate];
longPressTimer = nil;
if(TouchPadGestureHandler.ctrlDown) LiSendKeyboardEvent(CommandManager.keyboardButtonMappings[@"CTRL"].shortValue,KEY_ACTION_UP,0);
if(touchPointSpawnedAtUpperScreenEdge) return; // we're done here. this touch event will not be sent to the remote PC.
if(multiTouchesDetected) {
if([UITouchUtil touchesIn:streamView from:event].count == touches.count) multiTouchesDetected = false;
return;
+1 -1
View File
@@ -13,7 +13,7 @@
#import "DataManager.h"
#import "CustomTapGestureRecognizer.h"
#define RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S 0.15
#define RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S 0.1
NS_ASSUME_NONNULL_BEGIN
-4
View File
@@ -193,10 +193,6 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2;
if(TouchPadGestureHandler.ctrlDown) LiSendKeyboardEvent(CommandManager.keyboardButtonMappings[@"CTRL"].shortValue,KEY_ACTION_UP,0);
NSLog(@"testtttttt %lu, %lu, %f",[UITouchUtil touchesIn:streamView from:event].count, touches.count, CACurrentMediaTime());
NSLog(@"testtttttt666 %lu, %lu, %f",[event allTouches].count, touches.count, CACurrentMediaTime());
if(multiTouchesDetected){
if([UITouchUtil touchesIn:streamView from:event].count == touches.count){
@@ -1169,7 +1169,8 @@ static NSMutableSet* hostList;
// [settingsViewController widget:settingsViewController.bitrateSlider setEnabled:!self.settingsExpandedInStreamView];
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.optimizeGamesStack];
[settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.audioOnPcStack];
[settingsViewController.touchModeSelector1 setEnabled:!_settingsExpandedInStreamView || !_sessionLaunchedWithAbsoluteTouch];
[settingsViewController.touchModeSelector1 setEnabled:!_settingsExpandedInStreamView || !(settingsViewController.touchModeSelector1.selectedSegmentIndex == AbsoluteTouch && !settingsViewController.passthroughGesturesSwitch.isOn)];
[settingsViewController.touchModeSelector2 setEnabled:settingsViewController.touchModeSelector1.enabled];
[settingsViewController.codecSelector setEnabled:!_settingsExpandedInStreamView];
[settingsViewController.yuv444Switch setEnabled:!_settingsExpandedInStreamView];
[settingsViewController.hdrSwitch setEnabled:!_settingsExpandedInStreamView && [settingsViewController hdrSupported]];
@@ -1190,6 +1191,7 @@ static NSMutableSet* hostList;
if(_settingsExpandedInStreamView && !streamFrameViewController.micStreamInitialized) [settingsViewController.redirectMicSwitch setOn:false];
[settingsViewController setHidden:!settingsViewController.redirectMicSwitch.isOn forStack:settingsViewController.useBuiltinMicStack];
[settingsViewController.useBuiltinMicSwitch setEnabled:!_settingsExpandedInStreamView];
[settingsViewController.passthroughGesturesSwitch setEnabled:!_settingsExpandedInStreamView];
}
- (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:(FrontViewPosition)position {
@@ -457,15 +457,15 @@ BOOL isCustomResolution(int resolutionSelected) {
[self updateResolutionTable];
_scrollView.contentOffset = CGPointMake(_scrollView.contentOffset.x, tempSettings.settingsMenuOffset.floatValue);
// _scrollView.contentOffset = CGPointMake(_scrollView.contentOffset.x, tempSettings.settingsMenuOffset.floatValue);
/// cancel restoring contentOffset
[self.customResolutionSwitch addTarget:self action:@selector(customResolutionSwitched:) forControlEvents:UIControlEventValueChanged];
//CGSize currentResolution = CGSizeMake(currentSettings.width.intValue, currentSettings.height.intValue);
[self.customResolutionSwitch setOn: isCustomResolution(self->tempSettings.resolutionSelected.intValue)];
[self.resolutionSelector setEnabled:!self.customResolutionSwitch.isOn];
[self touchModeChanged:self.touchModeSelector1]; // a special fix for iOS 14 to set hidden for the "enableOswStack"
settingsViewJustExpanded = false;
}
@@ -1917,7 +1917,7 @@ BOOL isCustomResolution(int resolutionSelected) {
[self touchModeChanged:self.touchModeSelector1];
[self.touchModeSelector2 addTarget:self action:@selector(touchMode2Changed:) forControlEvents:UIControlEventValueChanged];
self.touchModeSelector2.selectedSegmentIndex = self.touchModeSelector1.selectedSegmentIndex;
// self.enableOswSwitchStack.hidden = !(self->tempSettings.touchMode.intValue == NativeTouch || self->tempSettings.touchMode.intValue == NativeTouchOnly); // do not use setHidden to stack wrapped by a settingStack
@@ -311,7 +311,7 @@
}
- (void)configZoomGestureAndAddStreamView{
if (_settings.touchMode.intValue == AbsoluteTouch) {
if (_settings.touchMode.intValue == AbsoluteTouch && !_settings.passthroughGestures) {
if(!_scrollView) _scrollView = [[UIScrollView alloc] initWithFrame:self.view.frame];
#if !TARGET_OS_TV
[_scrollView.panGestureRecognizer setMinimumNumberOfTouches:2];