From 614d8d6c6325ddec9bd5eea0fbfdd52f3c50fccb Mon Sep 17 00:00:00 2001 From: farblos <43711228+farblos@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:30:53 +0200 Subject: [PATCH] MaskUsedModifiers: remove bits used for XKB group index According to section "Xkb State to Core Protocol State Transformation" of the "The X Keyboard Extension: Library Specification", the Xkb-aware server reports group index in bits 13 and 14 of XEvent.xkey.state or XEvent.xbutton.state. This interferes with FVWM's modifier handling as described in #861. --- fvwm/bindings.c | 2 +- libs/defaults.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fvwm/bindings.c b/fvwm/bindings.c index cea7efdf5..76b74bb1e 100644 --- a/fvwm/bindings.c +++ b/fvwm/bindings.c @@ -600,7 +600,7 @@ void print_bindings(void) /* Removes all unused modifiers from in_modifiers */ unsigned int MaskUsedModifiers(unsigned int in_modifiers) { - return in_modifiers & ~mods_unused; + return in_modifiers & ~mods_unused & ~DEFAULT_XKB_MODS_IGNORED; } unsigned int GetUnusedModifiers(void) diff --git a/libs/defaults.h b/libs/defaults.h index d9c871f4a..ac30a1079 100644 --- a/libs/defaults.h +++ b/libs/defaults.h @@ -38,6 +38,16 @@ ((Button1MotionMask * ((1 << NUMBER_OF_MOUSE_BUTTONS) - 1))) #define DEFAULT_MODS_UNUSED LockMask +/* Default modifier bits to ignore in XEvent.xkey.state or XEvent.xbutton.state. + * According to section "Xkb State to Core Protocol State Transformation" of the + * "The X Keyboard Extension: Library Specification", the Xkb-aware server + * reports group index in bits 13 and 14, which interferes with FVWM's modifier + * handling as described in https://github.com/fvwmorg/fvwm3/issues/861. */ +#ifdef HAVE_X11_XKBLIB_H +#define DEFAULT_XKB_MODS_IGNORED ((1 << 13) | (1 << 14)) +#else +#define DEFAULT_XKB_MODS_IGNORED 0 +#endif /* * These values may be adjusted to fine tune the menu looks.