scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

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

Open XayUp opened this issue 5 years ago • 20 comments

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.

XayUp avatar Nov 19 '20 18:11 XayUp

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

rom1v avatar Nov 19 '20 20:11 rom1v

(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.

XayUp avatar Nov 19 '20 21:11 XayUp

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

rom1v avatar Nov 19 '20 21:11 rom1v

so, but this in version 1.14 ...

XayUp avatar Nov 19 '20 21:11 XayUp

is there no workaround at the moment?

XayUp avatar Nov 19 '20 21:11 XayUp

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.

rom1v avatar Nov 21 '20 09:11 rom1v

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!!

XayUp avatar Nov 21 '20 14:11 XayUp

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.

rom1v avatar Nov 21 '20 14:11 rom1v

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

XayUp avatar Nov 21 '20 14:11 XayUp

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

rom1v avatar Nov 21 '20 14:11 rom1v

Oh ;-;

XayUp avatar Nov 21 '20 14:11 XayUp

I confirm, ç works for me on Linux.

My keyboard layout si French (alt.):

setxkbmap fr oss

Does it work with:

adb shell input text ç

?

rom1v avatar Nov 21 '20 17:11 rom1v

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

XayUp avatar Nov 25 '20 03:11 XayUp

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.

vcampitelli avatar Dec 15 '20 12:12 vcampitelli

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

rom1v avatar Dec 15 '20 12:12 rom1v

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

vcampitelli avatar Dec 16 '20 12:12 vcampitelli

@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 avatar Dec 16 '20 20:12 rom1v

Also, what's your Android keyboard?

rom1v avatar Dec 17 '20 17:12 rom1v

@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!

vcampitelli avatar Jan 14 '21 18:01 vcampitelli

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

SsuJojo avatar Apr 16 '23 04:04 SsuJojo