Subject: bug#77099: 30.1; Feature Request: Handle Android Keyboard input with Ctrl and Meta Keys correctly

From: Po Lu <[email-masked]>
Date: Wed, 19 Mar 2025 09:09:32 +0800

tags 77099 notabug
close 77099
thanks

"Johannes C. Mayer" <[email-masked]> writes:

> Motivation: Having Meta and Ctrl available on the virtual keyboard
> seems much superior than showing control keys in the tab bar.
>
> There are Android keyboards that support Alt and Ctrl keys. The
> problem is that typing M-! on such a keyboard (I only tested
> Unexpected Keyboard) does not actually work as expected. However
> e.g. M-@ works as expected.
>
> Please see this github issue for more: https://github.com/Julow/Unexpected-Keyboard/issues/921
>
> Summary of the Issue so far:
> According to the author of Unexpected Keyboard this is due to a
> limitation in Android (and therefore likely any virtual keyboard with
> control keys would run into this issue). Iit seems to be the kind of
> limitation where you can work around the issue by adding a small bit
> of code to the input handling logic in Emacs.

The "bit of code" suggested by the author will interfere with the
reporting of keyboard meta state in keypresses generated from physical
keyboards, when a modifier key is depressed but only released after the
input focus is removed from Emacs--or the converse.  Please inform the
authors of this virtual keyboard that his program should generate
keycodes for keys that produce characters such as '!' (rather than
futilely searching for keycodes that produce these characters alone) and
any modifier bits necessary to produce them.  (E.g., M-!  should produce
M-S-1.)

This isn't a bug in Emacs, sorry.