bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#57825: 29.0.50; Superkey handling regression in pgtk


From: Po Lu
Subject: bug#57825: 29.0.50; Superkey handling regression in pgtk
Date: Mon, 19 Sep 2022 15:57:58 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Can't we check what compositor we're running under?

No, that is not really easy to do.

Kwin and Mutter apparently work correctly with GTK, but as I found out
earlier, the real problem lies in libxkbcommon, which is not working the
way XKB is supposed to, thus confusing GTK.

XKB_MOD_NAME_LOGO is not supposed to exist.  Instead, there should be
XKB_MOD_NAME_SUPER, defined to "Super".

Unfortunately, the libxkbcommon API is already set in stone, so the
easiest fix on the GTK side would be this:

diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c
index 35ac9e8..c104b5a 100644
--- a/gdk/wayland/gdkkeys-wayland.c
+++ b/gdk/wayland/gdkkeys-wayland.c
@@ -254,7 +254,8 @@ get_xkb_modifiers (struct xkb_keymap *xkb_keymap,
   if (state & GDK_ALT_MASK)
     mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT);
   if (state & GDK_SUPER_MASK)
-    mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Super");
+    mods |= (1 << xkb_keymap_mod_get_index (xkb_keymap, "Super")
+            | 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO));
   if (state & GDK_HYPER_MASK)
     mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Hyper");
   if (state & GDK_META_MASK)
@@ -277,6 +278,8 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
     state |= GDK_CONTROL_MASK;
   if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT)))
     state |= GDK_ALT_MASK;
+  if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO)))
+    state |= GDK_SUPER_MASK;
   if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Super")))
     state |= GDK_SUPER_MASK;
   if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Hyper")))




reply via email to

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