diff --git a/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm b/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm index 87b3c96d..0346f404 100644 --- a/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm +++ b/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm @@ -69,6 +69,7 @@ struct ModifiersState BOOL leftAlternateWasDown; BOOL leftControlWasDown; BOOL rightControlWasDown; + BOOL capsLockWasOn; }; @@ -140,6 +141,7 @@ void initialiseKeyboardHelper(void) state.rightAlternateWasDown = isKeyMaskActive(modifiers, NSRightAlternateKeyMask); state.leftControlWasDown = isKeyMaskActive(modifiers, NSLeftControlKeyMask); state.rightControlWasDown = isKeyMaskActive(modifiers, NSRightControlKeyMask); + state.capsLockWasOn = isKeyMaskActive(modifiers, NSEventModifierFlagCapsLock); isStateInitialized = YES; } @@ -202,6 +204,16 @@ void handleModifiersChanged(NSUInteger modifiers, sf::priv::WindowImplCocoa& req sf::Keyboard::Scan::LControl, sf::Keyboard::Scan::RControl, requester ); + + // Handle caps lock + processOneModifier( + modifiers, + NSEventModifierFlagCapsLock, + state.capsLockWasOn, + sf::Keyboard::Unknown, + sf::Keyboard::Scan::CapsLock, + requester + ); }