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

Consider adding more details and use cases in the --prefer-text section in README.md #1516

Closed
1 task done
LuRenJiasWorld opened this issue Jun 17, 2020 · 11 comments
Closed
1 task done

Comments

@LuRenJiasWorld
Copy link

Is your feature request related to a problem? Please describe.
When I used scrcpy, I found an issue with Chinese input, where the composited text was passed to the Android device.

Originally I thought It's a bug, and after hours of debugging, I've managed to fix it.

But before I made a pull request, I found the --prefer-text option in README.md, which just fixed the problem perfectly, and my previous job was completely redundant.

Describe the solution you'd like
Although these few hours of debugging gave me a better understanding of the details of the project, I didn't want other users to waste as much time as I did, so I thought it might be more intuitive to include some actual use cases in the --prefer-text option section.

Describe alternatives you've considered
I think the explanation below is more understandable:
If the language you are using relies on input methods (Chinese, Japanese, Korean, etc.), you may need to use this option, otherwise the input method function will not work properly.

Additional context
Actually, I don't know if most users need this option turned off by default, maybe it would be a good idea to have it enabled by default?

@rom1v
Copy link
Collaborator

rom1v commented Jun 17, 2020

When I used scrcpy, I found an issue with Chinese input, where the composited text was passed to the Android device.

Chinese input (the non-ASCII chars) are not expected to work, even with --prefer-text: https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#special-characters-do-not-work

What was your problem fixed by --prefer-text exactly?

If the language you are using relies on input methods (Chinese, Japanese, Korean, etc.), you may need to use this option, otherwise the input method function will not work properly.

AFAIK, --prefer-text is not expected to make non-ASCII chars work. It just pass the letters as text instead of key events, so it breaks keyboard behavior in games, but works better for "some" accented characters (like é, ô, etc. in French), but that's all.

Actually, I don't know if most users need this option turned off by default, maybe it would be a good idea to have it enabled by default?

That could be possible. But --prefer-text always break games, while not passing it does not always break text (typically for English language).

(Personally, I always pass --prefer-text because I'm French and I never play games on the device.)

@LuRenJiasWorld
Copy link
Author

LuRenJiasWorld commented Jun 17, 2020

Chinese input (the non-ASCII chars) are not expected to work, even with --prefer-text: https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#special-characters-do-not-work

What was your problem fixed by --prefer-text exactly?

But I built scrcpy using this branch: https://github.com/Genymobile/scrcpy/tree/d613b10efcdf0d1cf76e30871e136ba0ff444e6e , with --prefer-text,It actually works.

Here's the gif I recorded:

https://untitled.pw/wp-content/uploads/2020/06/test.gif

AFAIK, --prefer-text is not expected to make non-ASCII chars work. It just pass the letters as text instead of key events, so it breaks keyboard behavior in games, but works better for "some" accented characters (like é, ô, etc. in French), but that's all.

I think so, but It seems to work with that branch above and --prefer-text option. Without this option, I can still input Chinese, but with the composed characters(which should not be passed into):

https://untitled.pw/wp-content/uploads/2020/06/test2.gif

Actually, I don't know why It works.

That could be possible. But --prefer-text always break games, while not passing it does not always break text (typically for English language).

(Personally, I always pass --prefer-text because I'm French and I never play games on the device.)

You are right, but if this option does have other effects, it will be better to mention them in the documentation.

@LuRenJiasWorld
Copy link
Author

Maybe It works because of this pull request? #1426

I've no idea, and the released version(v1.14) didn't support Chinese character input yet.

@rom1v
Copy link
Collaborator

rom1v commented Jun 17, 2020

Oh, ok, it's was a separate branch (indeed PR #1426) which will not be merged, because it causes problems: #1426 (comment)

@LuRenJiasWorld
Copy link
Author

LuRenJiasWorld commented Jun 17, 2020

I see, maybe this method will break languages neither using IMEs nor English, and that's another issue, so merging it will cause some new problems.

Actually what I want to implement is to make a text input box (maybe bottom of the window?), where user can input the text here, and send it to the device. This can solve the text input and keystroke conflict problem, but adds a little inconvenient.

But then I realized that SDL didn't have the same built-in widgets as Qt did, so it took more effort to implement this.

What do you think? If you think it works, maybe I can do something about it: )

@rom1v
Copy link
Collaborator

rom1v commented Jun 17, 2020

A better solution would be to install an app on the device to add an IME: #431 (comment)

Such an app will also be useful for audio forwarding: https://blog.rom1v.com/2020/06/audio-forwarding-on-android-10/#integration-in-scrcpy

But then I realized that SDL didn't have the same built-in widgets as Qt did, so it took more effort to implement this.

Yes, that's a problem for many UI/UX features :)

@LuRenJiasWorld
Copy link
Author

It seems that installing an app is one of the best ways, and more suitable for the architecture that scrcpy is currently using (client/server architecture). I'm looking forward to it.

Unfortunately, I'm not familiar with Android development and I can't help scrcpy in this way, but I noticed there's a README file in Korean at the repository.

As far as I know, a large number of Chinese users need this type of software, as many Chinese apps can only be accessed through mobile phones, but using mobile phones for a long time can cause some health problems (especially cervical vertebra and fingers). So maybe a Chinese version README can make it more accessible for those who are not familiar with English.

What do you think? If possible, I will make a README.md file with simplified Chinese translation later and open a pull request then.

@rom1v
Copy link
Collaborator

rom1v commented Jun 17, 2020

Yes, you could add a README in Chinese 👍

If you are looking for something to implement on the client-side (in C), maybe you could look at #269 if you are interested (even if in the end, it will probably require minor changes on the server too).

@LuRenJiasWorld
Copy link
Author

Sure, I'm glad to help with this project. And I'll make translation now, then check that issue later.

@banduoba
Copy link

@LuRenJiasWorld 请问下这个中文输入法问题怎么解决呢

@david-shu
Copy link

android手机上安装qq输入法,可以在windows下正常输入中文。

Installing QQ input method on Android phones allows for normal Chinese input under Windows.

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

No branches or pull requests

4 participants