-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of Native Touch Passthrough and Better Gesture Recognizing #628
Closed
TrueZhuangJia
wants to merge
65
commits into
moonlight-stream:master
from
TrueZhuangJia:Moonlight-iOS-ZWM-Updated
Closed
Implementation of Native Touch Passthrough and Better Gesture Recognizing #628
TrueZhuangJia
wants to merge
65
commits into
moonlight-stream:master
from
TrueZhuangJia:Moonlight-iOS-ZWM-Updated
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…y exiting from remote desktop session in multi-touch mode.
…2_t touch pointer ID
…moonlight-ios into Moonlight-iOS-ZWM
Merge branch 'Moonlight-iOS-Official9.0.2' into Moonlight-iOS-ZWM2 * Moonlight-iOS-Official9.0.2: (29 commits) Update README.md Update README.md Update README.md Update README.md Update README.md Update README.md Update README.md Update README.md Update README.md Version 9.0.2 Update moonlight-common-c to resolve build warning Improve smooth scrolling precision mapped the Globe/Language key to Escape yes 0x0D is the correct code for Enter according to Microsoft's documentation Update moonlight-common-c with RTSP encryption and QoS improvements Remove xcpretty in CI Update AppVeyor images Remove CPU core count check Update moonlight-common-c with finalized encryption changes Opt in for video encryption on A10 and later SoCs ... # Conflicts: # Limelight/Input/StreamView.m # Moonlight-ZWM.xcodeproj/project.pbxproj
… 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).
…aps of 2 fingers.
…sconnect, and for future configuration
…better than UITapGestureRecognizer
…re equals the keyboard toggle is disabled
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello everyone,
I've been waiting for a true native-touch oriented version of moonlight-iOS for so long, that I have to fork it myself. Here's the changes made in my fork:
The native touch passthrough coded following the logic of moonlight-android.
![331657445-46af86e8-ef69-4923-a36b-0a7b54856b22](https://private-user-images.githubusercontent.com/78474576/331667339-2e676687-1927-47bf-bd8c-2040c3e71a31.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxNDI1NDgsIm5iZiI6MTcxOTE0MjI0OCwicGF0aCI6Ii83ODQ3NDU3Ni8zMzE2NjczMzktMmU2NzY2ODctMTkyNy00N2JmLWJkOGMtMjA0MGMzZTcxYTMxLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDExMzA0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMyMTA0NjAzYjViNjc1Nzc5MTRhZTUyZWIwMTcyYjMzYTUxNzNmNzA1NWQ1YmZjYTI3ZThiYTdhOTc2MTUzZWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0vwZVb-Uf3ngT9BkFsJiVA6JWWPldoBsqU7OtN6-jgw)
One of the key challenge is, iOS does not offer a pointerId attribute for UITouch object like android.
I use a dictionary & a set for mapping UITouch object memory address to pointerId, which was generated from arc4random(), with a mechanism to prevent collision.
Related codes are placed in NativeTouchHandler.m . Here's how native touch works out now:
Refactored Better Session Exit Gesture Recognition to Prevent Accidental Exits.
![image](https://private-user-images.githubusercontent.com/78474576/331599738-b2fec7b0-c82a-4bca-aec2-0620f5185b2e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxNDI1NDgsIm5iZiI6MTcxOTE0MjI0OCwicGF0aCI6Ii83ODQ3NDU3Ni8zMzE1OTk3MzgtYjJmZWM3YjAtYzgyYS00YmNhLWFlYzItMDYyMGY1MTg1YjJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDExMzA0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU2OWExNTIxZWU0MjFjOGY0MTNhOWQyMWVjMDBhNjQyYWE2OWU5ZWMyOGRhNTYyMGFkN2M3NTcwOTA1NjJjZjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.vOKGShe0HPUl1QJGUMbFPAScGPdbtOjhyt9stwyPxfI)
![longSwipeToExit](https://private-user-images.githubusercontent.com/78474576/331597639-a177b3e6-9b28-4274-b1b9-e4011a8caf86.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxNDI1NDgsIm5iZiI6MTcxOTE0MjI0OCwicGF0aCI6Ii83ODQ3NDU3Ni8zMzE1OTc2MzktYTE3N2IzZTYtOWIyOC00Mjc0LWIxYjktZTQwMTFhOGNhZjg2LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDExMzA0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwZDNkZmY1NGRkMGFjZTFkMDdmNTUzYTZmOGM1MDBjOWE0YTM5NjlmZGU2MmQ2NzYyZGNmNWU5ZTI4OTc0YzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._rxT0gk-CDP_ZBXAbxolutb0vfzcR6rqzjvrYvykkJk)
I suggest, if we implement native multi-touch on moonlight-iOS, preventing unexpected session exit is a must-have feature.
Unlike the official moonlight which serves as a streaming client for mainly game controller players, native touch player like me needs to perform intense touch operation on screen, which triggers the original exit gesture recognition unexpectedly, it's so frustrating if you suddenly exit the remote desktop during gameplay.
So I wrote a recognizer to replace the iOS native API, requiring a swipe from the screen edge to a certain distance to trigger the exit to the desktop. The trigger threshold for the swipe distance and which edge to start the swipe from have been added to the settings menu. For user who prefers the original way, just set distance to 0.
And this is how it works:
Related codes are placed in CustomEdgeSwipeGestureRecognizer.m, this custom defined recognizer is added to StreamFrameViewController.
Refactored Better Tap Gesture Recognition for Reliable Local Keyboard Toggle.
![image](https://private-user-images.githubusercontent.com/78474576/331600366-6d62fa86-5f89-42e2-8504-456bef04ba4c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxNDI1NDgsIm5iZiI6MTcxOTE0MjI0OCwicGF0aCI6Ii83ODQ3NDU3Ni8zMzE2MDAzNjYtNmQ2MmZhODYtNWY4OS00MmUyLTg1MDQtNDU2YmVmMDRiYTRjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDExMzA0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU3ODFkM2Y2Y2RhYWVjNDVhYzY0NWM1NzViZWMzZjRmYTZlOTY5ZDYzNzgzZDliMjczOTM0NWVmNDFkNjJjM2QmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.BHvuFs66Bwf24uMRUxkPBP2TXhKzqS5BEOjlRdezv7k)
![testt5](https://private-user-images.githubusercontent.com/78474576/331601810-747854af-d2aa-467c-9c94-eb07bdf52868.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxNDI1NDgsIm5iZiI6MTcxOTE0MjI0OCwicGF0aCI6Ii83ODQ3NDU3Ni8zMzE2MDE4MTAtNzQ3ODU0YWYtZDJhYS00NjdjLTljOTQtZWIwN2JkZjUyODY4LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDExMzA0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI0MGViNTdiYjdkMzUwM2EwYmRhM2RlYTBiNGE0MTJmNDY4ZTc4ZWNmNjE2ZGNmZjBjMWNmYWZhYTY4OTBjYmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0cZCgwhDcVOPMekb7tKnge8yYXWi8ZmTsKVJbnf05_o)
I read a comment from the maintainer that conflict between 3-finger keyboard toggling & android gesture is one of the reasons why native-touch is not enabled on official moonlight-android yet. My answer to that question is adding configurable finger number for the user to decide.
On iOS however, there're additional issues if you wanna implement the same multi-finger tap keyboard toggle:
The official version of Moonlight-iOS triggers the local keyboard switch when it detects three touch points on the screen, a mechanism that makes three-point dragging interrupted by the showing up of keyboard.
I also tried UITapGestureRecognizer provided by iOS native API: the success rate of gesture recognition would decrease, and even continuous failures could occur.
Therefore, I rewrote a TapGestureRecognizer with a recognition rate of almost 100% , and having no affect on multi-point dragging(keyboard invoked on all-fingers-up, with a down time threshold limitation, similar to moonlight-Android)
To prevent local keyboard from being invoked unexpectedly, I add the required number of fingers for tap recognizer to the setting menu like my android fork. It is recommended to set 3-finger triggering on phones and 4 or more on tablets (as your palm might touch the screen, forming a third touch point when using a tablet).
Here's a *.gif example of setting "Fingers to Tap" to 4 on my ipad mini6:
Related codes are placed in CustomTapGestureRecognizer.m, this custom defined recognizer is added to StreamView.
My ipad mini6 is on iOS 17.2, I missed the trollstore and there's no jailbreak yet. Please consider reviewing or even merging my implementation into the official version, Sideloading app on iOS and the 7 day refresh is just, painful.
Thank you for your attention~