send dummy event to prevent stuttering

This commit is contained in:
TrueZhuanjia
2025-09-21 18:35:56 +08:00
parent 60dacdf05f
commit 689221f10e
13 changed files with 201 additions and 10 deletions
+21 -1
View File
@@ -998,7 +998,7 @@
</switch>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="6hG-dw-YSr" userLabel="renderingBackend Stack">
<stackView verifyAmbiguity="off" opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="6hG-dw-YSr" userLabel="renderingBackend Stack">
<rect key="frame" x="22" y="1204" width="380" height="56.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rendering Mode (Experimental)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v8l-hf-kiR">
@@ -1057,6 +1057,24 @@
</switch>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="20" id="RGd-TV-mkU" userLabel="sendDummyEvent">
<rect key="frame" x="432" y="2264" width="280" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Send Dummy Event" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Gus-CK-wpc" userLabel="uiLabel">
<rect key="frame" x="0.0" y="0.0" width="130" height="31"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eE4-oT-Gzb" userLabel="sendDummyEventSwitch">
<rect key="frame" x="150" y="0.0" width="132" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="130" id="bOP-xq-rYt"/>
</constraints>
</switch>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
@@ -1130,6 +1148,8 @@
<outlet property="reverseMouseWheelDirectionSelector" destination="mTM-NL-CcF" id="EYZ-Qg-OLu"/>
<outlet property="reverseMouseWheelDirectionStack" destination="2P0-Tg-zWd" id="Zz1-VC-0hC"/>
<outlet property="scrollView" destination="WRy-3f-gEP" id="V8B-oF-27B"/>
<outlet property="sendDummyEventStack" destination="RGd-TV-mkU" id="87h-08-4Og"/>
<outlet property="sendDummyEventSwitch" destination="eE4-oT-Gzb" id="q51-ds-zJC"/>
<outlet property="slideToMenuDistanceSlider" destination="8p6-FP-UWP" id="8z3-2I-oPd"/>
<outlet property="slideToSettingsDistanceStack" destination="pN7-bs-8yu" id="azp-qU-GnS"/>
<outlet property="slideToSettingsDistanceUILabel" destination="pMN-6T-aYE" id="If8-fO-rya"/>
+20
View File
@@ -1795,6 +1795,24 @@
</switch>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="20" id="6yl-Mb-0o6" userLabel="sendDummyEventStack">
<rect key="frame" x="437" y="1880" width="280" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Send Dummy Event" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.64999997615814209" adjustsLetterSpacingToFitWidth="YES" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vgl-rL-Ppi" userLabel="uiLabel">
<rect key="frame" x="0.0" y="0.0" width="130" height="31"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OlN-GM-xLT" userLabel="sendDummyEventSwitch">
<rect key="frame" x="150" y="0.0" width="132" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="130" id="hZt-X1-KU1"/>
</constraints>
</switch>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
@@ -1867,6 +1885,8 @@
<outlet property="reverseMouseWheelDirectionSelector" destination="Uca-fD-4AC" id="gLa-40-suX"/>
<outlet property="reverseMouseWheelDirectionStack" destination="iS2-99-oox" id="dl2-8e-idU"/>
<outlet property="scrollView" destination="Xq6-9l-Oey" id="nif-2O-JNf"/>
<outlet property="sendDummyEventStack" destination="6yl-Mb-0o6" id="KN5-ty-oTQ"/>
<outlet property="sendDummyEventSwitch" destination="OlN-GM-xLT" id="DQ8-Un-c5b"/>
<outlet property="slideToMenuDistanceSlider" destination="XNA-Kx-vqV" id="8oD-Sy-6k7"/>
<outlet property="slideToSettingsDistanceStack" destination="eom-7m-dH2" id="m43-tx-nAT"/>
<outlet property="slideToSettingsDistanceUILabel" destination="cti-T5-cSE" id="8Xz-vc-bO5"/>
+9 -8
View File
@@ -78,25 +78,25 @@ typedef NS_ENUM(NSInteger, WidgetSizeTransition) {
gyroSensitivity:(CGFloat)gyroSensitivity
touchMoveEventInterval:(NSInteger)touchMoveEventInterval
reverseMouseWheelDirection:(BOOL)reverseMouseWheelDirection
asyncNativeTouchPriority:(NSInteger)asyncNativeTouchPriority
asyncNativeTouchPriority:(NSInteger)asyncNativeTouchPriority
liftStreamViewForKeyboard:(BOOL)liftStreamViewForKeyboard
showKeyboardToolbar:(BOOL)showKeyboardToolbar
optimizeGames:(BOOL)optimizeGames
multiController:(BOOL)multiController
buttonVisualFeedback:(BOOL)buttonVisualFeedback
buttonVisualFeedback:(BOOL)buttonVisualFeedback
swapABXYButtons:(BOOL)swapABXYButtons
audioOnPC:(BOOL)audioOnPC
redirectMic:(BOOL)redirectMic
redirectMic:(BOOL)redirectMic
preferredCodec:(uint32_t)preferredCodec
enableYUV444:(BOOL)enableYUV444
enableYUV444:(BOOL)enableYUV444
enablePIP:(BOOL)enablePIP
enableHdr:(BOOL)enableHdr
btMouseSupport:(BOOL)btMouseSupport
// absoluteTouchMode:(BOOL)absoluteTouchMode
touchMode:(NSInteger)touchMode
statsOverlayLevel:(NSInteger)statsOverlayLevel
statsOverlayEnabled:(BOOL)statsOverlayEnabled
unlockDisplayOrientation:(BOOL)unlockDisplayOrientation
statsOverlayEnabled:(BOOL)statsOverlayEnabled
unlockDisplayOrientation:(BOOL)unlockDisplayOrientation
resolutionSelected:(NSInteger)resolutionSelected
externalDisplayMode:(NSInteger)externalDisplayMode
localMousePointerMode:(NSInteger)localMousePointerMode
@@ -104,8 +104,9 @@ typedef NS_ENUM(NSInteger, WidgetSizeTransition) {
enableGraphs:(BOOL)enableGraphs
graphOpacity:(NSInteger)graphOpacity
renderingBackend:(NSInteger)renderingBackend
framePacingMode:(NSInteger)framePacingMode
backgroundSessionTimer:(NSInteger)backgroundSessionTimer;
framePacingMode:(NSInteger)framePacingMode
sendDummyEvent:(BOOL)sendDummyEvent
backgroundSessionTimer:(NSInteger)backgroundSessionTimer;
- (NSArray*) getHosts;
- (void) updateHost:(TemporaryHost*)host;
+2
View File
@@ -100,6 +100,7 @@
graphOpacity:(NSInteger)graphOpacity
renderingBackend:(NSInteger)renderingBackend
framePacingMode:(NSInteger)framePacingMode
sendDummyEvent:(BOOL)sendDummyEvent
backgroundSessionTimer:(NSInteger)backgroundSessionTimer{
[_managedObjectContext performBlockAndWait:^{
@@ -151,6 +152,7 @@
settingsToSave.graphOpacity = [NSNumber numberWithInteger:graphOpacity];
settingsToSave.renderingBackend = [NSNumber numberWithInteger:renderingBackend];
settingsToSave.framePacingMode = [NSNumber numberWithInteger:framePacingMode];
settingsToSave.sendDummyEvent = sendDummyEvent;
[self saveData];
}];
}
+1
View File
@@ -70,6 +70,7 @@
@property (nonatomic, retain) NSNumber * frameQueueSize;
@property (nonatomic, retain) NSNumber * graphOpacity;
@property (nonatomic, retain) NSNumber * renderingBackend;
@property (nonatomic) BOOL sendDummyEvent;
@property (nonatomic, retain) NSNumber * framePacingMode;
- (id) initFromSettings:(Settings*)settings;
+1
View File
@@ -125,6 +125,7 @@
self.graphOpacity = settings.graphOpacity;
self.renderingBackend = settings.renderingBackend;
self.framePacingMode = settings.framePacingMode;
self.sendDummyEvent = settings.sendDummyEvent;
self.backgroundSessionTimer = settings.backroundSessionTimer;
#endif
self.uniqueId = settings.uniqueId;
@@ -56,6 +56,7 @@
<attribute name="renderingBackend" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
<attribute name="resolutionSelected" optional="YES" attributeType="Integer 16" defaultValueString="4" usesScalarValueType="NO" syncable="YES"/>
<attribute name="reverseMouseWheelDirection" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
<attribute name="sendDummyEvent" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
<attribute name="settingsMenuMode" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
<attribute name="settingsMenuWidth" attributeType="Float" defaultValueString="370" usesScalarValueType="NO" syncable="YES"/>
<attribute name="showKeyboardToolbar" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
@@ -4719,6 +4719,35 @@
}
}
},
"sendDummyEventStackTip" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "This fixes stuttering on some devices, particularly those on iPadOS 26."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "该选项解决了部分设备的串流卡顿问题, 尤其是升级了iPadOS 26的设备。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "該選項解決了部分裝置的串流卡頓問題,尤其是升級了 iPadOS 26 的裝置。"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "該選項解決了部分裝置的串流卡頓問題,尤其是升級了 iPadOS 26 的裝置。"
}
}
}
},
"SensitivityX: %.2f" : {
"extractionState" : "manual",
"localizations" : {
@@ -132,6 +132,9 @@
@property (strong, nonatomic) IBOutlet UIStackView *buttonVisualFeedbackStack;
@property (strong, nonatomic) IBOutlet UISwitch *buttonVisualFeedbackSwitch;
@property (strong, nonatomic) IBOutlet UIStackView *sendDummyEventStack;
@property (strong, nonatomic) IBOutlet UISwitch *sendDummyEventSwitch;
@property (nonatomic, strong) MicHandler *micHandler;
@@ -704,6 +704,8 @@ BOOL isCustomResolution(int resolutionSelected) {
[self addSetting:self.performanceGraphStack ofId:@"performanceGraphStack" withInfoTag:YES withDynamicLabel:NO to:experimentalSection];
[self addDynamicLabelForStack:self.graphOpacityStack];
[self addSetting:self.sendDummyEventStack ofId:@"sendDummyEventStack" withInfoTag:YES withDynamicLabel:NO to:experimentalSection];
[experimentalSection addToParentStack:_parentStack];
[experimentalSection setExpanded:YES];
}
@@ -1145,6 +1147,10 @@ BOOL isCustomResolution(int resolutionSelected) {
tipText = [LocalizationHelper localizedStringForKey:@"redirectMicStackTip"];
showOnlineDocAction = false;
}
if([sender.superview.accessibilityIdentifier isEqualToString: @"sendDummyEventStack"]){
tipText = [LocalizationHelper localizedStringForKey:@"sendDummyEventStackTip"];
showOnlineDocAction = false;
}
UIAlertController *tipsAlertController = [UIAlertController alertControllerWithTitle: [LocalizationHelper localizedStringForKey:@"Tips"] message:tipText preferredStyle:UIAlertControllerStyleAlert];
@@ -1683,6 +1689,8 @@ BOOL isCustomResolution(int resolutionSelected) {
[self.externalDisplayModeSelector setSelectedSegmentIndex:currentSettings.externalDisplayMode.integerValue];
[self.localMousePointerModeSelector setSelectedSegmentIndex:currentSettings.localMousePointerMode.integerValue];
[self.sendDummyEventSwitch setOn:currentSettings.sendDummyEvent];// Load old setting
settingsViewJustLoaded = false;
}
@@ -2476,6 +2484,7 @@ BOOL isCustomResolution(int resolutionSelected) {
}
NSInteger externalDisplayMode = [self.externalDisplayModeSelector selectedSegmentIndex];
NSInteger localMousePointerMode = [self.localMousePointerModeSelector selectedSegmentIndex];
BOOL sendDummyEvent = self.sendDummyEventSwitch.isOn;
NSInteger backgroundSessionTimer = self.backgroundSessionTimerSlider.value == self.backgroundSessionTimerSlider.maximumValue ? (uint32_t) INT16_MAX : (uint32_t)self.backgroundSessionTimerSlider.value;
[dataMan saveSettingsWithBitrate:_bitrate
@@ -2522,6 +2531,7 @@ BOOL isCustomResolution(int resolutionSelected) {
graphOpacity:graphOpacity
renderingBackend:renderingBackend
framePacingMode:framePacingMode
sendDummyEvent:sendDummyEvent
backgroundSessionTimer:backgroundSessionTimer];
}
@@ -82,6 +82,8 @@
dispatch_block_t _delayedRemoveExtScreen;
VideoDecoderRenderer *_videoRenderer;
BOOL _isRestoringFromPiP;
CADisplayLink *_displayLink;
#if !TARGET_OS_TV
CustomEdgeSlideGestureRecognizer *_slideToSettingsRecognizer;
CustomEdgeSlideGestureRecognizer *_slideToCmdToolRecognizer;
@@ -89,6 +91,7 @@
LayoutOnScreenControlsViewController *_layoutOnScreenControlsVC;
ToolboxViewController* toolBoxViewController;
MicHandler* micHandler;
#else
UITapGestureRecognizer *_menuTapGestureRecognizer;
UITapGestureRecognizer *_menuDoubleTapGestureRecognizer;
@@ -425,11 +428,24 @@
if (self.imguiView && self.imguiView.mtkView.superview) {
[self.view bringSubviewToFront:self.imguiView.mtkView];
}
if(_settings.sendDummyEvent){
[self setupDisplayLink];
[self startDisplayLink];
}
NSLog(@"frameview gestures: %d", (uint32_t)[self.view.gestureRecognizers count]);
NSLog(@"streamview gestures: %d", (uint32_t)[_streamView.gestureRecognizers count]);
}
- (void)viewWillAppear:(BOOL)animated {
if(_settings.sendDummyEvent) [self startDisplayLink];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self stopDisplayLink];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
@@ -1123,6 +1139,7 @@
- (void)expandSettingsView{
self.mainFrameViewcontroller.settingsExpandedInStreamView = true; //notify mainFrameViewContorller that this is a setting expansion in stream view, some settings shall be disabled.
[self stopDisplayLink];
[self.mainFrameViewcontroller expandSettingsView];
}
@@ -1592,4 +1609,30 @@
dispatch_after(delayTime, dispatch_get_main_queue(), block);
}
- (void)dealloc {
[self stopDisplayLink];
}
- (void)setupDisplayLink {
if (_displayLink != nil) return;
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLinkTick:)];
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
}
- (void)startDisplayLink {
_displayLink.paused = NO;
}
- (void)stopDisplayLink {
[_displayLink invalidate];
_displayLink = nil;
}
- (void)displayLinkTick:(CADisplayLink *)link {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
LiSendKeyboardEvent(0xFF, KEY_ACTION_UP, 0);
});
}
@end
+30
View File
@@ -1717,6 +1717,36 @@
}
}
},
"Gus-CK-wpc.text" : {
"comment" : "Class = \"UILabel\"; text = \"Send Dummy Event\"; ObjectID = \"Gus-CK-wpc\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Send Dummy Event"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "发送假事件"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "發送假事件"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "發送假事件"
}
}
}
},
"H8S-aI-EBo.segmentTitles[0]" : {
"comment" : "Class = \"UISegmentedControl\"; H8S-aI-EBo.segmentTitles[0] = \"hovering\"; ObjectID = \"H8S-aI-EBo\";",
"extractionState" : "extracted_with_value",
+30
View File
@@ -3631,6 +3631,36 @@
}
}
},
"Vgl-rL-Ppi.text" : {
"comment" : "Class = \"UILabel\"; text = \"Send Dummy Event\"; ObjectID = \"Vgl-rL-Ppi\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Send Dummy Event"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "发送假事件"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "發送假事件"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "發送假事件"
}
}
}
},
"wOV-Sp-UUE.segmentTitles[0]" : {
"comment" : "Class = \"UISegmentedControl\"; wOV-Sp-UUE.segmentTitles[0] = \"Slide From Left Edge\"; ObjectID = \"wOV-Sp-UUE\";",
"extractionState" : "extracted_with_value",