fix: Add 'Hyper' key handling

In the X11 code, we mapped hyper to super, so perhaps it makes sense to do that here too:

`src/lib/platform/XWindowsUtil.cpp`
```
  case XK_Super_L:
  case XK_Super_R:
  case XK_Hyper_L:
  case XK_Hyper_R:
    return kKeyModifierBitSuper;
```
This commit is contained in:
Nick Bolton 2025-08-22 15:44:59 +01:00 committed by Chris Rizzitello
parent 927075688c
commit 07edccb469
2 changed files with 11 additions and 2 deletions

View file

@ -92,7 +92,9 @@
"Volker", "Volker",
"whot", "whot",
"winget", "winget",
"wismill",
"writef", "writef",
"xkbcommon",
"XWINDOWS" "XWINDOWS"
], ],
"ignoreWords": [], "ignoreWords": [],

View file

@ -140,11 +140,16 @@ std::uint32_t EiKeyState::convertModMask(xkb_mod_mask_t xkbModMaskIn) const
static const auto XKB_VMOD_NAME_NUM = "NumLock"; static const auto XKB_VMOD_NAME_NUM = "NumLock";
static const auto XKB_VMOD_NAME_SCROLL = "ScrollLock"; static const auto XKB_VMOD_NAME_SCROLL = "ScrollLock";
static const auto XKB_VMOD_NAME_SUPER = "Super"; static const auto XKB_VMOD_NAME_SUPER = "Super";
static const auto XKB_VMOD_NAME_HYPER = "Hyper";
static const auto XKB_MOD_NAME_MOD2 = "Mod2"; static const auto XKB_MOD_NAME_MOD2 = "Mod2";
static const auto XKB_MOD_NAME_MOD3 = "Mod3"; static const auto XKB_MOD_NAME_MOD3 = "Mod3";
static const auto XKB_MOD_NAME_MOD5 = "Mod5"; static const auto XKB_MOD_NAME_MOD5 = "Mod5";
#endif #endif
// From wismill (xkbcommon maintainer):
// Meta is usually encoded like Alt, i.e. to Mod1. In that case, both share the same state.
// Added to that, if KDE interprets Meta as Super (the logo key), then it might explain the mess.
if (strcmp(XKB_MOD_NAME_SHIFT, name) == 0) if (strcmp(XKB_MOD_NAME_SHIFT, name) == 0)
modMaskOut |= (1 << kKeyModifierBitShift); modMaskOut |= (1 << kKeyModifierBitShift);
else if (strcmp(XKB_MOD_NAME_CAPS, name) == 0) else if (strcmp(XKB_MOD_NAME_CAPS, name) == 0)
@ -153,7 +158,9 @@ std::uint32_t EiKeyState::convertModMask(xkb_mod_mask_t xkbModMaskIn) const
modMaskOut |= (1 << kKeyModifierBitControl); modMaskOut |= (1 << kKeyModifierBitControl);
else if (strcmp(XKB_MOD_NAME_ALT, name) == 0 || strcmp(XKB_VMOD_NAME_ALT, name) == 0) else if (strcmp(XKB_MOD_NAME_ALT, name) == 0 || strcmp(XKB_VMOD_NAME_ALT, name) == 0)
modMaskOut |= (1 << kKeyModifierBitAlt); modMaskOut |= (1 << kKeyModifierBitAlt);
else if (strcmp(XKB_MOD_NAME_LOGO, name) == 0 || strcmp(XKB_VMOD_NAME_SUPER, name) == 0) else if (strcmp(XKB_MOD_NAME_LOGO, name) == 0 || // aka windows/command key
strcmp(XKB_VMOD_NAME_SUPER, name) == 0 || // virtual; usually mapped to logo key
strcmp(XKB_VMOD_NAME_HYPER, name) == 0) // virtual; often mapped to caps lock key
modMaskOut |= (1 << kKeyModifierBitSuper); modMaskOut |= (1 << kKeyModifierBitSuper);
else if (strcmp(XKB_MOD_NAME_MOD5, name) == 0 || strcmp(XKB_VMOD_NAME_LEVEL3, name) == 0) else if (strcmp(XKB_MOD_NAME_MOD5, name) == 0 || strcmp(XKB_VMOD_NAME_LEVEL3, name) == 0)
modMaskOut |= (1 << kKeyModifierBitAltGr); modMaskOut |= (1 << kKeyModifierBitAltGr);
@ -163,7 +170,7 @@ std::uint32_t EiKeyState::convertModMask(xkb_mod_mask_t xkbModMaskIn) const
modMaskOut |= (1 << kKeyModifierBitNumLock); modMaskOut |= (1 << kKeyModifierBitNumLock);
else if (strcmp(XKB_VMOD_NAME_SCROLL, name) == 0) else if (strcmp(XKB_VMOD_NAME_SCROLL, name) == 0)
modMaskOut |= (1 << kKeyModifierBitScrollLock); modMaskOut |= (1 << kKeyModifierBitScrollLock);
else if ((strcmp(XKB_VMOD_NAME_META, name) == 0) || // possibly the old meta (not the new meta/super/logo key) else if ((strcmp(XKB_VMOD_NAME_META, name) == 0) || // virtual; the old meta (not the new meta/super/logo key)
(strcmp(XKB_MOD_NAME_MOD2, name) == 0) || // spare, sometimes mapped to num lock. (strcmp(XKB_MOD_NAME_MOD2, name) == 0) || // spare, sometimes mapped to num lock.
(strcmp(XKB_MOD_NAME_MOD3, name) == 0) // spare, could be mapped to alt_r, caps lock, scroll lock, etc. (strcmp(XKB_MOD_NAME_MOD3, name) == 0) // spare, could be mapped to alt_r, caps lock, scroll lock, etc.
) )