termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
1.96k stars 301 forks source link

Modifier keys from virtual keyboards no longer detected in X11 #272

Closed Rhys-T closed 1 year ago

Rhys-T commented 1 year ago

The Control, Alt, and Windows[^win] keys in Hacker's Keyboard no longer seem to work in Termux:X11. I have also tried the Control keys in both the Samsung Keyboard and FlorisBoard, and they don't seem to be recognized either. I believe this may be the same problem mentioned in https://github.com/termux/termux-x11/issues/256#issuecomment-1455358773.

[^win]: Also known as Meta to Android, or Super to X11.

I understand that the keys by themselves don't cause HK to send any events, and thus can't be detected separately. However, previously if I pressed a normal key while one was down, X11 would at least get a key-down event for the modifier just before the main key, and a key-up for the modifier immediately afterwards, so that it knew those keys were active. This no longer appears to be happening for anything except the Shift key. xev -event keyboard no longer shows those events. i3 doesn't detect e.g. the Win-Shift-Q sequence to close a window. Firefox doesn't recognize Ctrl-C and Ctrl-V to copy/paste, and just types those letters.

These modifier keys were working in build #14 of twaik's fork (now gone as far as I can tell). The problem started after I ran into #256 and grabbed the latest successful build (#325) from this repository.

Edit: Forgot to mention - the Ctrl and Alt keys in the extra-keys bar work fine.

twaik commented 1 year ago

I'll check what I can do. It can brake some other functionality.

Rhys-T commented 1 year ago

Okay. Is there any way I can add a Super key to the extra-keys bar for now? I didn't see anything in the docs about it, or any support for it near the code that handles Ctrl/Alt/Shift extra keys, but I'm not that familiar with the codebase, and wanted to make sure I wasn't missing something.

emacs-newer commented 1 year ago

same to me using unexpected keyboard.

ivam3 commented 1 year ago

A same issue here

ivam3 commented 1 year ago

The issue is still opened ... is there any solution about it (extra keys[ctrl-alt-shifh] dont respond)??

ivam3 commented 1 year ago

We still are waiting for an update to fix it ... ... ...

Rhys-T commented 1 year ago

It turns out Hacker's Keyboard does have the ability to send events/keycodes for Ctrl, Alt, and Meta[^notshift] - it's just off by default. However, turning that on seems to have no effect on Termux:X11, whether I select the 'left' or 'right' versions of the keycodes - according to xev, the events for those keys still never appear, and the flags for any 'normal' keys pressed while holding the modifiers are still 0. (I've confirmed that the events are being sent by HK with those settings on, using xev under TigerVNC.) Not sure if this info helps at all, but I ran across those settings and figured they were worth testing.

[^notshift]: Not Shift though, for whatever reason. But Shift is already working in Termux:X11, so…

ivam3 commented 1 year ago

In my case I'm using a hardware keyboard and it worked fine in termux-x11 older versión but in all available releases doesn't work and I can't use a simple ctrl+c

ivam3 commented 1 year ago

Verificaré que puedo hacer. Puede frenar alguna otra funcionalidad.

Do you have any solution man? ... or any idea what I can do to fix it ?

Rhys-T commented 1 year ago

Just tried the x11-client-experimental branch, and it seems to be having the same issue there.

Upon closer examination, it's not entirely ignoring the modifier keys (in either branch) - if I press e.g. Alt-C, it doesn't show any modifiers pressed, but the keysym does change to one for 'ç' (keysym 0xe7, ccedilla). It looks like Termux:X11 is trying to pass through the characters that Android generates for a given key sequence, rather than the keys themselves, similar to AVNC.

As a temporary workaround, would it be possible to add support for the Meta/Super key to the extra-keys bar, so we can at least have a full set of modifier keys there?

MTSYuki commented 1 year ago

After I tried a few keyboards (that have CTRl, ALT, etc...) , the only one that works with termux-x11 is this (Although I'd recommend install from the website, as is more up to date). But, it need to tweak around a bit to make like a PC. I'm just make my own layout using this as tool. I don't think anyone will have the patience to make thier own. But at least, the default English layout have hidden "Terminal keys" that you have to use from.

twaik commented 1 year ago

Fixed by https://github.com/termux/termux-x11/commit/ee2224e474ce0c184de7a2c9c454c658f8afe249.