mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-13 19:49:36 +00:00
Add command/meta key support
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user