Skip to content
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

An attempt to make native multi-point touch & on-screen keyboard toggle both available to users #1364

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

TrueZhuangJia
Copy link

image
I re-enabled native touch, and try to resolve keyboard toggle by letting the user decide how many fingers to tap.
It's up to user to completely disable keyboard toggle in native-touch, or select number of fingers to tap from 3 to 10, by a seekbar.
The tap & toggle behaves exactly the same with trackpad mode, it only triggers toggling when user tap & quickly lift up their fingers. Only difference is the configurable finger number to prevent keyboard from being invoked unexpectly. For example, a 2-finger operated game like the Mihoyo ones, it's recommended to set 4 for tablet (some times your left palm touches the screen creating the 3rd pointer), and 3 for cellphone.
Further more, this finger number configuration only takes effect in native multi-point touch.


image
This is an option to disable view.requestUnbufferedDispatch in onTouch() callback if set true, it syncs touch event with display refresh... This one doesn't make too much sense, you feel better with it enabled in some cases.


image
This is an option to simulate iOS behavior. In iOS if you long press a location on the screen, it generates only 1 touch event on the moment of first contact, sunshine has to repeat it to Windows to prevent drop of touch. However it works better in cases where stability of long press is needed, like operating Scaramouche in Genshin Impact, iOS verion has a more stable view while he is flying.
User can define the size to supress long press by a seekbar, with a value of pixels. Flat region area is (pixelValue*2)^2.


image
This is an interesting feature to enhance native multi-point touch.
Screen will be divided to 2 areas by "Enhance touch zone divider":
the native touch zone (on the left by default), on which pointer coords are passed through to server;
the enhanced touch zone (on the right by defaut), on which pointer coords can be manipulated before sending to server.
This is particularly useful when view rotation is too sensitive by default in some game, by setting "pointer velocity factor" to less than 100%, the pointer with first contact located on the enhanced touch zone moves slower on server, and pointers initiated on the native touch zone are not affected.
To deal with this I write a NativeTouchHandler class, for handling additional pointer infos & functionality.



I'm not a programmer and this is my first Android project. I started this fork because I'm a Genshin Impact enthusiast who started the game on a tablet, and not getting used to mouse-keyboard or game controller playing. the game got a mobile UI on PC version discovered last December and I can't miss the opportunity to stream it from PC with the highest graphic quality, and play it just like on tablet.
My code could be rubbish but please consider the features I implemented, especially the first one I mentioned(enabling native touch with configurable keyboard toggle tap), it could help a lot of player as we got a big IM group chatting streaming Mihoyo game from PC.
It would be even better if the iOS version has native touch implemented officially, since it's such a pain in the S to sideload unsigned app on iOS...
By the way anybody who is interested in native-touch on iOS moonlight, check my fork:
https://github.com/TrueZhuangJia/moonlight-ios-NativeMultiTouchPassthrough


Thank you so much for your attention.

@zhoumother
Copy link

谢谢你,搓屏砖家

@TrueZhuangJia
Copy link
Author

谢谢你,搓屏砖家

感谢认可~

@fangxx3863
Copy link

感谢分享,这很有用👍

@kayakyakr
Copy link

Suggestions:

  1. Swapping the comments into English might make this more likely to be merge-ready
  2. May consider splitting the implementation up into more atomic units. One PR could contain the mouse select refactor, multitouch enable, and keyboard select. Second pr could contain some of the more controversial or complex qol features

@TrueZhuangJia
Copy link
Author

Suggestions:

  1. Swapping the comments into English might make this more likely to be merge-ready
  2. May consider splitting the implementation up into more atomic units. One PR could contain the mouse select refactor, multitouch enable, and keyboard select. Second pr could contain some of the more controversial or complex qol features

Thanks for the comment.

  • My comments(annotations) in codes are all English. The Chinese parts are localizations for the UI strings.
  • This PR is just a demonstration of the touch point velocity tweak feature I created. (Which was shamelessly stolen & imitated by Axixi without mentioning my credits in his Bilibili video)
  • Merge or not doesn't really matter for moonlight android. ‘cause there're no limitation on app installation.
  • I'm currently working on my moonlight-iOS fork, which has too much deviation from the original version. And I don't expect it to be merged either. Have a try by Altstore sideloading if you're interested:
    https://github.com/TrueZhuangJia/moonlight-ios-NativeMultiTouchPassthrough/releases/tag/betterGestureRecognizer

@TrueZhuangJia
Copy link
Author

TrueZhuangJia commented Jul 18, 2024

Suggestions:

  1. Swapping the comments into English might make this more likely to be merge-ready
  2. May consider splitting the implementation up into more atomic units. One PR could contain the mouse select refactor, multitouch enable, and keyboard select. Second pr could contain some of the more controversial or complex qol features

You know what, I was one of the followers of Axixi.

  • He started modifiying moonlight-android 12 months ago, gaining at least ten thousand followers. But his version was not "open-sourced" until I revealed him as a thief on Bilibili in recent days.

  • He asked me a lot of questions on QQ( IM-chat software) in order to understand how the feature I created works, then imitated that by his own coding and make the video as if it is created by himself

  • If anybody wanna upstream any of Axixi's features, be careful. You have no idea where they came from. Go to the Axixi's fork, He merged the whole-year coding into just 1 initial commit, for what? Have you seen any real open source developers did this?
    image
    What is Axixi trying to hide ? The true brilliant ideas & codings from other geniune developers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants