-
I've been investigating a Firefox bug over the last week and have gotten stuck on one final issue: We need to know what the real mapping of the LevelThree / LevelFive vmods is, because GDK only sends us a GdkModifierType, which does not support those vmods. The legacy X11 code contains a setup routine utilizing the xmodmap to (afaics) solve this issue, but it seems to be impossible to do the same using the libxkbcommon API (or the GDK API respectively). Am I overlooking something or is it really not possible to somehow get this information? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
In order to find the vmod → rmod mapping, you may use the following: // Please use these named constants whenever possible
#include <xkbcommon/xkbcommon-names.h>
#ifndef XKB_VMOD_NAME_LEVEL3
#define XKB_VMOD_NAME_LEVEL3 "LevelThree"
#endif
const xkb_mod_index_t levelThree_idx = xkb_keymap_mod_get_index(keymap, XKB_VMOD_NAME_LEVEL3);
const xkb_mod_mask_t levelThree = UINT32_C(1) << levelThree_idx;
struct xkb_state *state = xkb_state_new(keymap);
assert(state); // TODO: handle error properly
xkb_state_update_mask(state, levelThree, 0, 0, 0, 0, 0);
const xkb_mod_mask_t levelThree_mapping = xkb_state_serialize_mods(state, XKB_STATE_MODS_EFFECTIVE);
xkb_state_unref(state); This should work will older versions of xkbcommon. There is no dedicated API because the vmod/rmod distinction is a X11 legacy and an implementation detail. @whot @bluetech The current use case is valid while niche. I opened #735 to document it “officially”. |
Beta Was this translation helpful? Give feedback.
In order to find the vmod → rmod mapping, you may use the following:
This should work wi…