Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.55k stars 10.69k forks source link

(1.16) (Linux) the "--prefer-text" parameter does not work #1920

Open XayUp opened 3 years ago

XayUp commented 3 years ago

To start scrcpy, on linux, I use the following command: scrcpy -S -b2M -m800 --prefer-text however, "--prefer-text" doesn't work, it's like I didn't add it there, so when I want to put an accent, it doesn't work ... for example: instead of being "ã", he writes "~ a". I don't know if it is a bug or not in this version but this is the first time I use Scrcpy on Linux.

rom1v commented 3 years ago

Yes, accented characters are very limited: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-accented-characters

It works for ^a which gives â for example (while it does not work correctly without --prefer-text).

Ref #1751

XayUp commented 3 years ago

(sorry my english) ok ... but is this due to the system? cuz, on windows, the last version I used was 1.14 and the accentuation worked, but ... ok ... this is kind of boring.

rom1v commented 3 years ago

Oh if it works on Windows it's probably related to how SDL generates text events.

XayUp commented 3 years ago

so, but this in version 1.14 ...

XayUp commented 3 years ago

is there no workaround at the moment?

rom1v commented 3 years ago

In fact, that's not surprising, on Linux if you press ^a it generates â, but if you press ~a it generates ~a (for example, in a terminal).

The opposite would be annoying on Linux (~ is interpreted as $HOME in many shells).

That's probably configurable somewhere.

XayUp commented 3 years ago

from what I could see, the "ç" key doesn't work .... I press "ç" but he doesn't write "ç" ... nor does "´" work either ... but I'll look for a solution ... maybe I think thanks for listening!!

rom1v commented 3 years ago

Yes, ç is not an ASCII character and cannot be composed as a diacretical character. This is a known limitation of Android text injection (which could be solved by implementing an IME installed as an Android app, but it's not done yet).

Anyway, it is independant of --prefer-text, which injects letters as text events instead of key events.

XayUp commented 3 years ago

ok .... funny that on windows everything works perfectly ... but that's ok

rom1v commented 3 years ago

Oh but now you say it, I think that ç works correctly for me on Linux (I'm on the phone so I cannot test).

XayUp commented 3 years ago

Oh ;-;

rom1v commented 3 years ago

I confirm, ç works for me on Linux.

My keyboard layout si French (alt.):

setxkbmap fr oss

Does it work with:

adb shell input text ç

?

XayUp commented 3 years ago

I don't know, friend, but I think I won't depend on it too much, I even use your soft to control a cell phone here that has a broken display

vcampitelli commented 3 years ago

I'm using Linux with "English - International with dead keys" keyboard layout and the --prefer-text stopped working in version 1.16 for me too. Everything worked correctly when I was using 1.14, but now the behavior is the same with or without the parameter.

Combination Expected (1.14) Now (1.16)
' + e é e
' + c ç c
~ + a ã ~a
^ + e ê ^e

adb shell input text ç correctly sends ç, but every other letter I wrote on the above table doesn't, unfortunately.

rom1v commented 3 years ago

Could you retry v1.14 now and confirms that it still behave as you expect?

vcampitelli commented 3 years ago

@rom1v Yep, I've just reinstalled v1.14 and all combinations work as expected with --prefer-text

rom1v commented 3 years ago

@vcampitelli Thank you for the details.

I changed the language on my desktop to English (US, intl., with dead keys), and I sometimes get the behavior you describe (but regardless of v1.14 vs v1.16, it seems more related to the fact that the virtual keyboard is visible when I type or not yet).

If you can reproduce the problem 100% on v1.16 and 0% on v1.14, could you git bisect to find the commit where the problem appears for you, please?

rom1v commented 3 years ago

Also, what's your Android keyboard?

vcampitelli commented 3 years ago

@rom1v sorry for the late reply. I'm using the default Gboard app.

So, the strangest thing happened. I manually build scrcpy using several commits and everything works! But I don't know why, actually.

I used the same dependencies versions that comes with the snap package (SDL 2.0.8, libavcodec 57.107.100, libavformat 57.83.100 and libavutil 55.78.100) and used docker (my own image instead of the one provided by pierlon/scrcpy-docker). Maybe another dependency or some kind of environment configuration while building the package?

Until I figure it out, I'm going to use the one I build instead of the package. Thanks!

@XayUp maybe you should do it too, it's very simple!

1049731887 commented 1 year ago

And cannot input any Chinese words, but it can be input in Vysor if you turn on the button of "International Keyboard"