emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PGTK-related misconceptions


From: Trey Peacock
Subject: Re: PGTK-related misconceptions
Date: Tue, 19 Apr 2022 03:28:55 +0000

"Po Lu" <luangruo@yahoo.com> writes:

> Trey <gpg@treypeacock.com> writes:
>
>> Po Lu <luangruo@yahoo.com> writes:
>>
>>> Morgan Smith <morgan.j.smith@outlook.com> writes:
>>>
>>>> I'd like to report that my super key stopped registering.  I suspected
>>>> commit 1404e16975 caused it so I did a quick `git revert 1404e16975`
>>>> ontop of 807682de1e and that fixed it.
>>>
>>> Crystal ball says you are using X Windows, and have to put
>>>
>>>   remove mod4 = Hyper_L
>>>
>>> in your ~/.Xmodmap file, because GTK doesn't try as hard as regular X11
>>> Emacs to work around the common kind of virtual modifier
>>> misconfiguration.
>>>
>>
>> I'm experiencing the same issue here. My super key no longer registers,
>> even using emacs -Q. However, I find it begins from the commit changing
>> to GDK modifier masks 1c1ae6ba802cc5813fa6f8f90f21050aae6bb459. I've
>> tested this with the following specs:
>>
>> WMs: River & Sway
>> Emacs Version: Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
>> 3.24.33, cairo version 1.17.6) of 2022-04-18
>
> What about GNOME Shell, which this change was tested on?
>
> Anyway, if GTK is not setting the GDK_SUPER_MASK on Wayland, it is a bug
> in GDK, and should be reported to its developers.

Neither of the WMs I mentioned use GNOME Shell, but they do both use
wlroots. Looking into this, it seems that any wlroots based Wayland
compositor will use GDK_MOD4_MASK as Super. However, mutter (GNOME's WM)
uses GDK_SUPER_MASK. Rebuilding emacs with the below patch seems to have
fixed the issue. I'm not sure if there could be further implications for
pgtk_emacs_to_gtk_modifiers.


diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 2b04699fb3..d8ca89bbc0 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -5152,7 +5152,7 @@ pgtk_gtk_to_emacs_modifiers (struct pgtk_display_info 
*dpyinfo, int state)
     mod |= mod_ctrl;
   if (state & GDK_META_MASK || state & GDK_MOD1_MASK)
     mod |= mod_meta;
-  if (state & GDK_SUPER_MASK)
+  if (state & GDK_SUPER_MASK || state & GDK_MOD4_MASK)
     mod |= mod_super;
   if (state & GDK_HYPER_MASK)
     mod |= mod_hyper;
@@ -5285,7 +5285,7 @@ key_press_event (GtkWidget *widget, GdkEvent *event, 
gpointer *user_data)
       /* While super is pressed, the input method will always always
     resend the key events ignoring super.  As a workaround, don't
     filter key events with super or hyper pressed.  */
-      if (!(event->key.state & (GDK_SUPER_MASK | GDK_HYPER_MASK)))
+      if (!(event->key.state & (GDK_SUPER_MASK | GDK_HYPER_MASK | 
GDK_MOD4_MASK)))
    {
      if (pgtk_im_filter_keypress (f, &event->key))
        return TRUE;

Attachment: publickey - gpg@treypeacock.com - da008078.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]