Subject: bug#66040: 30.0.50; The XF86AudioLowerVolume on keyboard cannot be detected correctly

From: Mauro Aranda <[email-masked]>
Date: Mon, 2 Oct 2023 18:20:02 -0300

On 1/10/23 06:11, Po Lu via Bug reports for GNU Emacs, the Swiss army 
knife of text editors wrote:
> Stefan Kangas <[email-masked]> writes:
> 
>>> No idea.  But I've yet to encounter such a phone in practice, so I have
>>> no objection to defaulting x-quit-keysym to nil, if they are indeed left
>>> ungrabbed by window managers on ordinary computers.
>>
>> Thanks.  Could you please install a change along those lines?
> 
> Now done.
> 

Po Lu <[email-masked]> writes:

 > Stefan Kangas <[email-masked]> writes:
 >
 >>> No idea.  But I've yet to encounter such a phone in practice, so I have
 >>> no objection to defaulting x-quit-keysym to nil, if they are indeed 
left
 >>> ungrabbed by window managers on ordinary computers.
 >>
 >> Thanks.  Could you please install a change along those lines?
 >
 > Now done.
 >

I've found through bisecting that the following commit, which references
this Bug Report, has affected input of some characters for me.

commit 12aca0f90d7aeaa8444508245e7596a64f2e8dce
Author: Po Lu <[email-masked]>
Date:   Sun Oct 1 17:07:58 2023 +0800

   Update Android port

   * doc/emacs/input.texi (On-Screen Keyboards): Revise
   documentation to reflect changes.

   * src/keyboard.c (lispy_function_keys) <KEYCODE_DPAD_CENTER>:
   Define select key absent out of negligence.

   * src/xterm.c (syms_of_xterm) <x-quit-keysym>: Default to nil.
   (bug#66040)

---

In a working checkout, I do:
emacs -Q
Hit the keys that would insert '^' twice, and I see ^ in the buffer.

I'm used to hit those keys twice, that's not a problem.  The first time
I type I see an indication, in case I want to type something like â.

After the cited commit, I do:
emacs -Q
Hit the keys that would insert '^' once, and I see that indication.  But
then, if I hit it again, Emacs says 'Quit'.  And there's no way for me
to insert ^, or â, or anything like that.

In case it helps, when I try to input ^ xev says:
KeyPress event, serial 37, synthetic NO, window 0x1200001,
     root 0x3c6, subw 0x0, time 109901302, (866,325), root:(1076,529),
     state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), 
same_screen YES,
     XKeysymToKeycode returns keycode: 92
     XLookupString gives 0 bytes:
     XmbLookupString gives 0 bytes:
     XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x1200001,
     root 0x3c6, subw 0x0, time 109901366, (866,325), root:(1076,529),
     state 0x90, keycode 48 (keysym 0xfe52, dead_circumflex), 
same_screen YES,
     XLookupString gives 1 bytes: (5e) "^"
     XmbLookupString gives 0 bytes:
     XFilterEvent returns: True

KeyRelease event, serial 37, synthetic NO, window 0x1200001,
     root 0x3c6, subw 0x0, time 109901494, (866,325), root:(1076,529),
     state 0x90, keycode 48 (keysym 0xfe52, dead_circumflex), 
same_screen YES,
     XLookupString gives 1 bytes: (5e) "^"
     XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x1200001,
     root 0x3c6, subw 0x0, time 109901526, (866,325), root:(1076,529),
     state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), 
same_screen YES,
     XKeysymToKeycode returns keycode: 92
     XLookupString gives 0 bytes:
     XFilterEvent returns: False

And here's the info from report-emacs-bug from the affected session:

In GNU Emacs 30.0.50 (build 45, x86_64-pc-linux-gnu, GTK+ Version
  3.24.33, cairo version 1.16.0) of 2023-10-02 built on tbb-desktop
Repository revision: ad2bb3e9f36d1a4f25e1e2228586331b40a30a46
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12201001
System Description: Ubuntu 22.04.3 LTS

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
   value of $LC_MONETARY: es_AR.UTF-8
   value of $LC_NUMERIC: es_AR.UTF-8
   value of $LC_TIME: es_AR.UTF-8
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
   tooltip-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   minibuffer-regexp-mode: t
   line-number-mode: t
   indent-tabs-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo gtk
x-toolkit xinput2 x multi-tty move-toolbar make-network-process emacs)

Memory information:
((conses 16 37547 9201) (symbols 48 5213 0) (strings 32 13197 2675)
  (string-bytes 1 373504) (vectors 16 10299)
  (vector-slots 8 156179 13963) (floats 8 21 23) (intervals 56 222 0)
  (buffers 992 10))