Browse Source

Linux: Fixed an issue detecting alt as a modifier key

tags/2021-05-28
Tom Poole 7 years ago
parent
commit
40bf320a46
1 changed files with 10 additions and 5 deletions
  1. +10
    -5
      modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp

+ 10
- 5
modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp View File

@@ -2459,12 +2459,17 @@ private:
if (auto* mapping = XGetModifierMapping (display))
{
for (int i = 0; i < 8; i++)
for (int modifierIdx = 0; modifierIdx < 8; ++modifierIdx)
{
if (mapping->modifiermap [i << 1] == altLeftCode)
Keys::AltMask = 1 << i;
else if (mapping->modifiermap [i << 1] == numLockCode)
Keys::NumLockMask = 1 << i;
for (int keyIndex = 0; keyIndex < mapping->max_keypermod; ++keyIndex)
{
auto key = mapping->modifiermap[(modifierIdx * mapping->max_keypermod) + keyIndex];
if (key == altLeftCode)
Keys::AltMask = 1 << modifierIdx;
else if (key == numLockCode)
Keys::NumLockMask = 1 << modifierIdx;
}
}
XFreeModifiermap (mapping);


Loading…
Cancel
Save