-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
[Bug]: hardware keyboard does not work with IME #635
Comments
What exactly do you mean? Works fine on my devices. |
In the below video, I typed using hardware keyabord and tried with different input methods (e.g. simplified chinese, japanese and traditional chinese) but it only output English. Do you have different behaviour on your device? Screen_Recording_20240517_000326_TermuxX11.2.mp4 |
Toggle extra keys bar and swipe it to see the text input. |
Only with the help of EK bar text input, hardware keyboard + IME could work. They could not work directly with the LorieView. It is great and more natural to input into LorieView directly. I found RVNC Viewer seems to work well with hardware keyboard IME, perhaps they simply implement the TextView. By the way, during my test, I found that Termux App could enable direct hardware keyboard IME after tapping the EK bar text input and then tapping into the terminal, for unknown reason. Shown in below video. Screen_Recording_20240517_002454_Termux.mp4And this does not happen in Termux:X11. Shown in below video. Screen_Recording_20240517_001729_TermuxX11.mp4 |
For some reason on my device it works using real hardware keyboard but does not work with scrcpy in OTG mode. So actually I can not reproduce it on my device. |
And now it works with scrcpy too. Adorable. |
Ok, I got it. It works with scrcpy in OTG mode, but does not work scrcpy with regular input. It seems like scrcpy injects events as a virtual keyboard device and Samsung's IME does not want to treat this device as capable to use multi-layout input. |
I have no clues about which part of code causing the bug because IME in hardware keyboard never work with Termux:X11, neither Gboard, for me since day 1. My device is Samsung Z Fold5 running One UI 6.1 Android 14. Anything I can help debugging? Breakpoints? Logs? More test cases (I own a S21)? |
I think we can try to get symbols from IME using InputConnection, but that may break regular input mechanisms of X11 programs. I am not sure if they will work at all. |
Just tested and I don't think so. I applied breakpoints on any methods of BaseInputConnection in #620 . It does not trigger any InputConnection methods when typing in hardware keyboard. I also tested on my S21 and it's just the same. |
It should trigger |
No, I can confirm that hardware keyboard on my devices does not trigger |
Same no matter it is BT or USB (OTG) keyboard. |
Try to remove onKeyPreIme method. |
Where and how to? Searched and didn't find that method. Tried |
Sorry, forgot the exact name. termux-x11/app/src/main/java/com/termux/x11/LorieView.java Lines 205 to 209 in ee1bd84
|
Yes. By removing this method, the IME works perfectly! And tapping soft keyboard continues to work, not affected. |
Any reason to call |
I am not sure why but there some devices (or IMEs) which modify key event data. I can make it optional if it causes problems. |
Yes, please. That will be very helpful. |
3c8cc75 does not work without setting My previous test results are based on this PR #620 (cuz you mentioned BaseInputConnection at the beginning). If you don't want to merge PR #620 any time soon, may consider to add this to @Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
return super.onCreateInputConnection(outAttrs);
} |
Problem description
Not sure weather this counts as bug. However, hardware keyboard only types English characters and does not work with IME.
What steps will reproduce the bug?
Use any IME like Samsung keyboard with external keyboard to type.
What is the expected behavior?
I suppose users expect hardware keyboard to work with input methods.
A dumb approach might be reading the implementation in the source code of TextView in ASOP, but I don't find it easy.
The text was updated successfully, but these errors were encountered: