diff --git a/AerofoilSDL/GpDisplayDriver_SDL_GL2.cpp b/AerofoilSDL/GpDisplayDriver_SDL_GL2.cpp index f323d86..d627b65 100644 --- a/AerofoilSDL/GpDisplayDriver_SDL_GL2.cpp +++ b/AerofoilSDL/GpDisplayDriver_SDL_GL2.cpp @@ -1637,6 +1637,14 @@ static bool IdentifyVKey(const SDL_KeyboardEvent *keyEvt, GpKeyIDSubset_t &outSu return false; } break; + case SDLK_LGUI: + outSubset = GpKeyIDSubsets::kSpecial; + outKey.m_specialKey = GpKeySpecials::kLeftCommand; + break; + case SDLK_RGUI: + outSubset = GpKeyIDSubsets::kSpecial; + outKey.m_specialKey = GpKeySpecials::kRightCommand; + break; case SDLK_LCTRL: outSubset = GpKeyIDSubsets::kSpecial; outKey.m_specialKey = GpKeySpecials::kLeftCtrl; diff --git a/GpApp/Events.cpp b/GpApp/Events.cpp index b6f109c..657f1a8 100644 --- a/GpApp/Events.cpp +++ b/GpApp/Events.cpp @@ -145,7 +145,7 @@ void HandleKeyEvent (const KeyDownStates &keyStates, const GpKeyboardInputEvent { const intptr_t theChar = PackVOSKeyCode(theEvent); const bool shiftDown = keyStates.IsSet(PL_KEY_EITHER_SPECIAL(kShift)); - const bool commandDown = keyStates.IsSet(PL_KEY_EITHER_SPECIAL(kControl)); + const bool commandDown = keyStates.IsSet(PL_KEY_SHORTCUT); const bool optionDown = keyStates.IsSet(PL_KEY_EITHER_SPECIAL(kAlt)); if ((commandDown) && (!optionDown)) @@ -413,7 +413,7 @@ void HandleEvent (void) bool itHappened = true; const KeyDownStates *eventKeys = PortabilityLayer::InputManager::GetInstance()->GetKeys(); - if ((eventKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl))) && + if ((eventKeys->IsSet(PL_KEY_SHORTCUT)) && (eventKeys->IsSet(PL_KEY_EITHER_SPECIAL(kAlt)))) { HiliteAllObjects(); diff --git a/GpApp/GameOver.cpp b/GpApp/GameOver.cpp index d7e28da..dda06a9 100644 --- a/GpApp/GameOver.cpp +++ b/GpApp/GameOver.cpp @@ -228,7 +228,7 @@ void DoGameOverStarAnimation (void) { const KeyDownStates *theKeys = PortabilityLayer::InputManager::GetInstance()->GetKeys(); - if ((theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl))) || (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kAlt))) || (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kShift)))) + if ((theKeys->IsSet(PL_KEY_SHORTCUT)) || (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kAlt))) || (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kShift)))) noInteruption = false; if (PortabilityLayer::EventQueue::GetInstance()->Dequeue(&theEvent)) @@ -475,7 +475,7 @@ void DoDiedGameOver (void) { const KeyDownStates *theKeys = PortabilityLayer::InputManager::GetInstance()->GetKeys(); - if ((theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kAlt))) || (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl))) || (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kShift)))) + if ((theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kAlt))) || (theKeys->IsSet(PL_KEY_SHORTCUT)) || (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kShift)))) { pagesStuck = 8; userAborted = true; diff --git a/GpApp/Input.cpp b/GpApp/Input.cpp index b5e81ce..3e0c8d2 100644 --- a/GpApp/Input.cpp +++ b/GpApp/Input.cpp @@ -403,7 +403,7 @@ void DoPause (void) if ((isEscPauseKey && theKeys->IsSet(PL_KEY_SPECIAL(kEscape))) || (!isEscPauseKey && theKeys->IsSet(PL_KEY_SPECIAL(kTab)))) paused = false; - else if (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl))) + else if (theKeys->IsSet(PL_KEY_SHORTCUT)) DoCommandKey(); Delay(1, nullptr); @@ -513,7 +513,7 @@ void DoHeliumEngaged (gliderPtr thisGlider) #else - if (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl))) + if (theKeys->IsSet(PL_KEY_SHORTCUT)) DoCommandKey(); // Cheesy - Use touchscreen menu as quit @@ -601,7 +601,7 @@ void GetInput (gliderPtr thisGlider) { const KeyDownStates *theKeys = PortabilityLayer::InputManager::GetInstance()->GetKeys(); - if (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl))) + if (theKeys->IsSet(PL_KEY_SHORTCUT)) DoCommandKey(); } diff --git a/GpApp/ObjectEdit.cpp b/GpApp/ObjectEdit.cpp index 065e1df..11b9cd4 100644 --- a/GpApp/ObjectEdit.cpp +++ b/GpApp/ObjectEdit.cpp @@ -2664,7 +2664,7 @@ void HiliteAllObjects (void) { Delay(1, nullptr); } - while ((theseKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl))) && + while ((theseKeys->IsSet(PL_KEY_SHORTCUT)) && (theseKeys->IsSet(PL_KEY_EITHER_SPECIAL(kAlt)))); for (i = 0; i < kMaxRoomObs; i++) diff --git a/GpApp/Utilities.cpp b/GpApp/Utilities.cpp index 868bea9..21375b9 100644 --- a/GpApp/Utilities.cpp +++ b/GpApp/Utilities.cpp @@ -470,7 +470,7 @@ Boolean WaitForInputEvent (short seconds) { const KeyDownStates *theKeys = PortabilityLayer::InputManager::GetInstance()->GetKeys(); - if (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl)) || theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kAlt)) || theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kShift))) + if (theKeys->IsSet(PL_KEY_SHORTCUT) || theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kAlt)) || theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kShift))) waiting = false; if (PortabilityLayer::EventQueue::GetInstance()->Dequeue(&theEvent)) @@ -501,7 +501,7 @@ void WaitCommandQReleased (void) { const KeyDownStates *theKeys = PortabilityLayer::InputManager::GetInstance()->GetKeys(); - if (!theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl)) || !theKeys->IsSet(PL_KEY_ASCII('Q'))) + if (!theKeys->IsSet(PL_KEY_SHORTCUT) || !theKeys->IsSet(PL_KEY_ASCII('Q'))) waiting = false; PL_ASYNCIFY_PARANOID_DISARM_FOR_SCOPE(); diff --git a/GpCommon/GpVOSEvent.h b/GpCommon/GpVOSEvent.h index 4389d32..80f30a5 100644 --- a/GpCommon/GpVOSEvent.h +++ b/GpCommon/GpVOSEvent.h @@ -101,6 +101,8 @@ namespace GpKeySpecials kRightCtrl, kLeftAlt, kRightAlt, + kLeftCommand, + kRightCommand, kNumLock, kLeftArrow, kUpArrow, diff --git a/PortabilityLayer/PLKeyEncoding.cpp b/PortabilityLayer/PLKeyEncoding.cpp index f9199d9..c06e52b 100644 --- a/PortabilityLayer/PLKeyEncoding.cpp +++ b/PortabilityLayer/PLKeyEncoding.cpp @@ -12,6 +12,8 @@ static bool BitTestEitherSpecial(const KeyDownStates &keyMap, int eitherSpecial) return keyMap.m_special.Get(GpKeySpecials::kLeftShift) || keyMap.m_special.Get(GpKeySpecials::kRightShift); case KeyEventEitherSpecialCategories::kControl: return keyMap.m_special.Get(GpKeySpecials::kLeftCtrl) || keyMap.m_special.Get(GpKeySpecials::kRightCtrl); + case KeyEventEitherSpecialCategories::kCommand: + return keyMap.m_special.Get(GpKeySpecials::kLeftCommand) || keyMap.m_special.Get(GpKeySpecials::kRightCommand); default: assert(false); return false; diff --git a/PortabilityLayer/PLKeyEncoding.h b/PortabilityLayer/PLKeyEncoding.h index 796c57c..6f881c9 100644 --- a/PortabilityLayer/PLKeyEncoding.h +++ b/PortabilityLayer/PLKeyEncoding.h @@ -26,6 +26,7 @@ namespace KeyEventEitherSpecialCategories kControl, kAlt, kShift, + kCommand, }; } @@ -43,6 +44,7 @@ namespace KeyEventEitherSpecialCategories #define PL_KEY_NUMPAD_SPECIAL_ENCODE(k) ((KeyEventType_NumPadSpecial) | ((k) << PL_INPUT_TYPE_CODE_BITS)) #define PL_KEY_FKEY(k) ((KeyEventType_FKey) | ((k) << PL_INPUT_TYPE_CODE_BITS)) #define PL_KEY_EITHER_SPECIAL(k) ((KeyEventType_EitherSpecial) | ((KeyEventEitherSpecialCategories::k) << PL_INPUT_TYPE_CODE_BITS)) +#define PL_KEY_SHORTCUT (GetShortcutKeySpecial()) #define PL_KEY_GAMEPAD_BUTTON(k, pl) ((KeyEventType_GamepadButton) | (pl << PL_INPUT_TYPE_CODE_BITS) | ((GpGamepadButtons::k) << (PL_INPUT_TYPE_CODE_BITS + PL_INPUT_PLAYER_INDEX_BITS))) #define PL_KEY_GAMEPAD_BUTTON_ENCODE(k, pl) ((KeyEventType_GamepadButton) | (pl << PL_INPUT_TYPE_CODE_BITS) | ((k) << (PL_INPUT_TYPE_CODE_BITS + PL_INPUT_PLAYER_INDEX_BITS))) @@ -50,6 +52,7 @@ namespace KeyEventEitherSpecialCategories #define PL_KEY_GET_VALUE(k) ((k) >> PL_INPUT_TYPE_CODE_BITS) intptr_t PackVOSKeyCode(const GpKeyboardInputEvent &evt); +intptr_t GetShortcutKeySpecial(); struct KeyDownStates { diff --git a/PortabilityLayer/PLSysCalls.cpp b/PortabilityLayer/PLSysCalls.cpp index 54621ef..536ea34 100644 --- a/PortabilityLayer/PLSysCalls.cpp +++ b/PortabilityLayer/PLSysCalls.cpp @@ -1,5 +1,6 @@ #include "PLCore.h" #include "AppEventHandler.h" +#include "PLDrivers.h" #include "PLEventQueue.h" #include "PLKeyEncoding.h" #include "PLMovies.h" @@ -9,6 +10,7 @@ #include "GpVOSEvent.h" #include "IGpDisplayDriver.h" #include "IGpVOSEventQueue.h" +#include "IGpSystemServices.h" #include "InputManager.h" #include "HostSuspendCallArgument.h" #include "HostSuspendHook.h" @@ -131,6 +133,15 @@ intptr_t PackVOSKeyCode(const GpKeyboardInputEvent &vosEvent) return 0; } + +intptr_t GetShortcutKeySpecial() +{ + if (PLDrivers::GetSystemServices()->GetOperatingSystem() == GpOperatingSystems::kMacOS) + return PL_KEY_EITHER_SPECIAL(kCommand); + else + return PL_KEY_EITHER_SPECIAL(kControl); +} + static void TranslateVOSEvent(const GpVOSEvent *vosEvent, uint32_t timestamp, PortabilityLayer::EventQueue *queue) { switch (vosEvent->m_eventType)