Skip to content

Commit

Permalink
MaskUsedModifiers: remove bits used for XKB group index
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
farblos authored and ThomasAdam committed Sep 4, 2023
1 parent 0a27988 commit 686ffe2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fvwm/bindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions libs/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 686ffe2

Please sign in to comment.