Subject: Re: bug#55362: 29.0.50; Super key no longer works on Wayland

From: Po Lu <[email-masked]>
Date: Wed, 11 May 2022 20:46:55 +0800

Thomas Jost <[email-masked]> writes:

> Hey folks,
>
> When using recent builds of Emacs with PGTK on Wayland (Sway), the Super
> key is no longer detected. I use it in a lot of shortcuts, but now
> typing e.g. `s-/' just inputs /.
>
> If I run an older build with the exact same config (or even with `emacs
> -Q'), I don't experience that issue, and shortcuts using Super still
> work. So, this seems to be an Emacs bug.
>
> Using git bisect, I was able to find that this started in commit
> 1c1ae6ba802cc5813fa6f8f90f21050aae6bb459. Further investigation revealed
> that when typing a shortcut with Super, the GDK_SUPER_MASK bit isn't
> set, but GDK_MOD4_MASK is.
>
> I'm not sure what the best option is: restoring the former
> x_find_modifier_meanings() function, or hard-coding that Mod4 is the
> same as Super (like Mod1 and Meta).

The bug is in GTK, not in Emacs.  It doesn't set the virtual modifier
masks corresponding to the Super key on some Wayland compositors, which
it is supposed to.

That patch (and the old code) is incorrect, and the code before its
removal was another example of the PGTK port haphazardly copying code
from xterm.c to do stuff GDK is supposed to do by itself.  Mod4 is a
real modifier and can correspond to any (number) of virtual modifiers,
which might or might not contain Super.

Please report the bug to the GTK developers.  Something along the lines
of "GDK_SUPER_MASK not set on keyboard events on wlroots-based
compositors when the Super key is held down".  After you do that, I'd
appreciate it if you gave us a link to the bug report, so we can at
least put it in etc/PROBLEMS.

Thanks in advance.