bool Shortcut::CheckModifiersKeyboardState()

in src/modules/keyboardmanager/common/Shortcut.cpp [496:592]


bool Shortcut::CheckModifiersKeyboardState(KeyboardManagerInput::InputInterface& ii) const
{
    // Check the win key state
    if (winKey == ModifierKey::Both)
    {
        // Since VK_WIN does not exist, we check both VK_LWIN and VK_RWIN
        if ((!(ii.GetVirtualKeyState(VK_LWIN))) && (!(ii.GetVirtualKeyState(VK_RWIN))))
        {
            return false;
        }
    }
    else if (winKey == ModifierKey::Left)
    {
        if (!(ii.GetVirtualKeyState(VK_LWIN)))
        {
            return false;
        }
    }
    else if (winKey == ModifierKey::Right)
    {
        if (!(ii.GetVirtualKeyState(VK_RWIN)))
        {
            return false;
        }
    }

    // Check the ctrl key state
    if (ctrlKey == ModifierKey::Left)
    {
        if (!(ii.GetVirtualKeyState(VK_LCONTROL)))
        {
            return false;
        }
    }
    else if (ctrlKey == ModifierKey::Right)
    {
        if (!(ii.GetVirtualKeyState(VK_RCONTROL)))
        {
            return false;
        }
    }
    else if (ctrlKey == ModifierKey::Both)
    {
        if (!(ii.GetVirtualKeyState(VK_CONTROL)))
        {
            return false;
        }
    }

    // Check the alt key state
    if (altKey == ModifierKey::Left)
    {
        if (!(ii.GetVirtualKeyState(VK_LMENU)))
        {
            return false;
        }
    }
    else if (altKey == ModifierKey::Right)
    {
        if (!(ii.GetVirtualKeyState(VK_RMENU)))
        {
            return false;
        }
    }
    else if (altKey == ModifierKey::Both)
    {
        if (!(ii.GetVirtualKeyState(VK_MENU)))
        {
            return false;
        }
    }

    // Check the shift key state
    if (shiftKey == ModifierKey::Left)
    {
        if (!(ii.GetVirtualKeyState(VK_LSHIFT)))
        {
            return false;
        }
    }
    else if (shiftKey == ModifierKey::Right)
    {
        if (!(ii.GetVirtualKeyState(VK_RSHIFT)))
        {
            return false;
        }
    }
    else if (shiftKey == ModifierKey::Both)
    {
        if (!(ii.GetVirtualKeyState(VK_SHIFT)))
        {
            return false;
        }
    }

    return true;
}