| @@ -227,6 +227,7 @@ public: | |||||
| static void showArrowCursorIfNeeded(); | static void showArrowCursorIfNeeded(); | ||||
| static void updateModifiers (NSEvent* e); | static void updateModifiers (NSEvent* e); | ||||
| static void updateModifiers (NSUInteger); | |||||
| static void updateKeysDown (NSEvent* ev, bool isKeyDown); | static void updateKeysDown (NSEvent* ev, bool isKeyDown); | ||||
| static int getKeyCodeFromEvent (NSEvent* ev) | static int getKeyCodeFromEvent (NSEvent* ev) | ||||
| @@ -918,18 +919,23 @@ bool KeyPress::isKeyCurrentlyDown (const int keyCode) | |||||
| return false; | return false; | ||||
| } | } | ||||
| void NSViewComponentPeer::updateModifiers (NSEvent* e) | |||||
| void NSViewComponentPeer::updateModifiers (const NSUInteger flags) | |||||
| { | { | ||||
| int m = 0; | int m = 0; | ||||
| if (([e modifierFlags] & NSShiftKeyMask) != 0) m |= ModifierKeys::shiftModifier; | |||||
| if (([e modifierFlags] & NSControlKeyMask) != 0) m |= ModifierKeys::ctrlModifier; | |||||
| if (([e modifierFlags] & NSAlternateKeyMask) != 0) m |= ModifierKeys::altModifier; | |||||
| if (([e modifierFlags] & NSCommandKeyMask) != 0) m |= ModifierKeys::commandModifier; | |||||
| if ((flags & NSShiftKeyMask) != 0) m |= ModifierKeys::shiftModifier; | |||||
| if ((flags & NSControlKeyMask) != 0) m |= ModifierKeys::ctrlModifier; | |||||
| if ((flags & NSAlternateKeyMask) != 0) m |= ModifierKeys::altModifier; | |||||
| if ((flags & NSCommandKeyMask) != 0) m |= ModifierKeys::commandModifier; | |||||
| currentModifiers = currentModifiers.withOnlyMouseButtons().withFlags (m); | currentModifiers = currentModifiers.withOnlyMouseButtons().withFlags (m); | ||||
| } | } | ||||
| void NSViewComponentPeer::updateModifiers (NSEvent* e) | |||||
| { | |||||
| updateModifiers ([e modifierFlags]); | |||||
| } | |||||
| void NSViewComponentPeer::updateKeysDown (NSEvent* ev, bool isKeyDown) | void NSViewComponentPeer::updateKeysDown (NSEvent* ev, bool isKeyDown) | ||||
| { | { | ||||
| updateModifiers (ev); | updateModifiers (ev); | ||||
| @@ -946,6 +952,7 @@ void NSViewComponentPeer::updateKeysDown (NSEvent* ev, bool isKeyDown) | |||||
| ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept | ModifierKeys ModifierKeys::getCurrentModifiersRealtime() noexcept | ||||
| { | { | ||||
| NSViewComponentPeer::updateModifiers ([NSEvent modifierFlags]); | |||||
| return NSViewComponentPeer::currentModifiers; | return NSViewComponentPeer::currentModifiers; | ||||
| } | } | ||||