Add a custom gesture recognizer to trigger session disconnection when user swipe with a horizontal distance that exceeds half screen width, this works better in native-touch passthrough.

Original ios-moonlight triggers session disconnection with a short swipe from left edge, which happens frequently & unexpectedly in an intense native-touch passthrough gaming condition (like GenshinImpact).
This commit is contained in:
ZWM
2024-04-30 23:41:58 +08:00
parent fd8cc416ab
commit 616238e847
3 changed files with 85 additions and 4 deletions
@@ -17,6 +17,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <Limelight.h>
#import "CustomEdgeSwipeGestureRecognizer.h"
#if TARGET_OS_TV
#import <AVFoundation/AVDisplayCriteria.h>
@@ -30,6 +31,8 @@
- (id)initWithRefreshRate:(float)arg1 videoDynamicRange:(int)arg2;
@end
@implementation StreamFrameViewController {
ControllerSupport *_controllerSupport;
StreamManager *_streamMan;
@@ -49,7 +52,7 @@
CGSize _keyboardSize;
#if !TARGET_OS_TV
UIScreenEdgePanGestureRecognizer *_exitSwipeRecognizer;
CustomEdgeSwipeGestureRecognizer *_exitSwipeRecognizer;
#endif
}
@@ -129,12 +132,13 @@
[self.view addGestureRecognizer:_playPauseTapGestureRecognizer];
#else
_exitSwipeRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(edgeSwiped)];
_exitSwipeRecognizer.edges = UIRectEdgeLeft;
_exitSwipeRecognizer = [[CustomEdgeSwipeGestureRecognizer alloc] initWithTarget:self action:@selector(edgeSwiped)];
//_exitSwipeRecognizer.edges = UIRectEdgeLeft;
//_exitSwipeRecognizer.edges = UIRectEdgeLeft;
_exitSwipeRecognizer.delaysTouchesBegan = NO;
_exitSwipeRecognizer.delaysTouchesEnded = NO;
// [self.view addGestureRecognizer:_exitSwipeRecognizer];
[self.view addGestureRecognizer:_exitSwipeRecognizer];
#endif
_tipLabel = [[UILabel alloc] init];