Use a nested struct instead of a prefix

This commit is contained in:
Lukas Dürrenberger 2021-11-30 15:10:05 +01:00
parent 08d1095314
commit 5dbe85bfec
10 changed files with 1472 additions and 1467 deletions

View File

@ -176,165 +176,170 @@ public:
/// keyboard can be used as reference for the physical position of the keys. /// keyboard can be used as reference for the physical position of the keys.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
enum Scancode struct Scan
{ {
ScanUnknown = -1, //!< Represents any scancode not present in this enum enum Scancode
ScanA = 0, //!< Keyboard a and A key {
ScanB, //!< Keyboard b and B key Unknown = -1, //!< Represents any scancode not present in this enum
ScanC, //!< Keyboard c and C key A = 0, //!< Keyboard a and A key
ScanD, //!< Keyboard d and D key B, //!< Keyboard b and B key
ScanE, //!< Keyboard e and E key C, //!< Keyboard c and C key
ScanF, //!< Keyboard f and F key D, //!< Keyboard d and D key
ScanG, //!< Keyboard g and G key E, //!< Keyboard e and E key
ScanH, //!< Keyboard h and H key F, //!< Keyboard f and F key
ScanI, //!< Keyboard i and I key G, //!< Keyboard g and G key
ScanJ, //!< Keyboard j and J key H, //!< Keyboard h and H key
ScanK, //!< Keyboard k and K key I, //!< Keyboard i and I key
ScanL, //!< Keyboard l and L key J, //!< Keyboard j and J key
ScanM, //!< Keyboard m and M key K, //!< Keyboard k and K key
ScanN, //!< Keyboard n and N key L, //!< Keyboard l and L key
ScanO, //!< Keyboard o and O key M, //!< Keyboard m and M key
ScanP, //!< Keyboard p and P key N, //!< Keyboard n and N key
ScanQ, //!< Keyboard q and Q key O, //!< Keyboard o and O key
ScanR, //!< Keyboard r and R key P, //!< Keyboard p and P key
ScanS, //!< Keyboard s and S key Q, //!< Keyboard q and Q key
ScanT, //!< Keyboard t and T key R, //!< Keyboard r and R key
ScanU, //!< Keyboard u and U key S, //!< Keyboard s and S key
ScanV, //!< Keyboard v and V key T, //!< Keyboard t and T key
ScanW, //!< Keyboard w and W key U, //!< Keyboard u and U key
ScanX, //!< Keyboard x and X key V, //!< Keyboard v and V key
ScanY, //!< Keyboard y and Y key W, //!< Keyboard w and W key
ScanZ, //!< Keyboard z and Z key X, //!< Keyboard x and X key
ScanNum1, //!< Keyboard 1 and ! key Y, //!< Keyboard y and Y key
ScanNum2, //!< Keyboard 2 and @ key Z, //!< Keyboard z and Z key
ScanNum3, //!< Keyboard 3 and # key Num1, //!< Keyboard 1 and ! key
ScanNum4, //!< Keyboard 4 and $ key Num2, //!< Keyboard 2 and @ key
ScanNum5, //!< Keyboard 5 and % key Num3, //!< Keyboard 3 and # key
ScanNum6, //!< Keyboard 6 and ^ key Num4, //!< Keyboard 4 and $ key
ScanNum7, //!< Keyboard 7 and & key Num5, //!< Keyboard 5 and % key
ScanNum8, //!< Keyboard 8 and * key Num6, //!< Keyboard 6 and ^ key
ScanNum9, //!< Keyboard 9 and ) key Num7, //!< Keyboard 7 and & key
ScanNum0, //!< Keyboard 0 and ) key Num8, //!< Keyboard 8 and * key
ScanEnter, //!< Keyboard Enter/Return key Num9, //!< Keyboard 9 and ) key
ScanEscape, //!< Keyboard Escape key Num0, //!< Keyboard 0 and ) key
ScanBackspace, //!< Keyboard Backspace key Enter, //!< Keyboard Enter/Return key
ScanTab, //!< Keyboard Tab key Escape, //!< Keyboard Escape key
ScanSpace, //!< Keyboard Space key Backspace, //!< Keyboard Backspace key
ScanHyphen, //!< Keyboard - and _ key Tab, //!< Keyboard Tab key
ScanEqual, //!< Keyboard = and + Space, //!< Keyboard Space key
ScanLBracket, //!< Keyboard [ and { key Hyphen, //!< Keyboard - and _ key
ScanRBracket, //!< Keyboard ] and } key Equal, //!< Keyboard = and +
// For US keyboards mapped to key 29 (Microsoft Keyboard Scan Code Specification) LBracket, //!< Keyboard [ and { key
// For Non-US keyboards mapped to key 42 (Microsoft Keyboard Scan Code Specification) RBracket, //!< Keyboard ] and } key
// Typical language mappings: Belg:£µ` FrCa:<>} Dan:*' Dutch:`´ Fren:µ* Ger:'# Ital:§ù LatAm:[}` Nor:*@ Span:ç} Swed:*' Swiss:$£} UK:~# Brazil:}] // For US keyboards mapped to key 29 (Microsoft Keyboard Scan Code Specification)
ScanBackslash, //!< Keyboard \ and | key OR various keys for Non-US keyboards // For Non-US keyboards mapped to key 42 (Microsoft Keyboard Scan Code Specification)
ScanSemicolon, //!< Keyboard ; and : key // Typical language mappings: Belg:£µ` FrCa:<>} Dan:*' Dutch:`´ Fren:µ* Ger:'# Ital:§ù LatAm:[}` Nor:*@ Span:ç} Swed:*' Swiss:$£} UK:~# Brazil:}]
ScanApostrophe, //!< Keyboard ' and " key Backslash, //!< Keyboard \ and | key OR various keys for Non-US keyboards
ScanGrave, //!< Keyboard ` and ~ key Semicolon, //!< Keyboard ; and : key
ScanComma, //!< Keyboard , and < key Apostrophe, //!< Keyboard ' and " key
ScanPeriod, //!< Keyboard . and > key Grave, //!< Keyboard ` and ~ key
ScanSlash, //!< Keyboard / and ? key Comma, //!< Keyboard , and < key
ScanF1, //!< Keyboard F1 key Period, //!< Keyboard . and > key
ScanF2, //!< Keyboard F2 key Slash, //!< Keyboard / and ? key
ScanF3, //!< Keyboard F3 key F1, //!< Keyboard F1 key
ScanF4, //!< Keyboard F4 key F2, //!< Keyboard F2 key
ScanF5, //!< Keyboard F5 key F3, //!< Keyboard F3 key
ScanF6, //!< Keyboard F6 key F4, //!< Keyboard F4 key
ScanF7, //!< Keyboard F7 key F5, //!< Keyboard F5 key
ScanF8, //!< Keyboard F8 key F6, //!< Keyboard F6 key
ScanF9, //!< Keyboard F9 key F7, //!< Keyboard F7 key
ScanF10, //!< Keyboard F10 key F8, //!< Keyboard F8 key
ScanF11, //!< Keyboard F11 key F9, //!< Keyboard F9 key
ScanF12, //!< Keyboard F12 key F10, //!< Keyboard F10 key
ScanF13, //!< Keyboard F13 key F11, //!< Keyboard F11 key
ScanF14, //!< Keyboard F14 key F12, //!< Keyboard F12 key
ScanF15, //!< Keyboard F15 key F13, //!< Keyboard F13 key
ScanF16, //!< Keyboard F16 key F14, //!< Keyboard F14 key
ScanF17, //!< Keyboard F17 key F15, //!< Keyboard F15 key
ScanF18, //!< Keyboard F18 key F16, //!< Keyboard F16 key
ScanF19, //!< Keyboard F19 key F17, //!< Keyboard F17 key
ScanF20, //!< Keyboard F20 key F18, //!< Keyboard F18 key
ScanF21, //!< Keyboard F21 key F19, //!< Keyboard F19 key
ScanF22, //!< Keyboard F22 key F20, //!< Keyboard F20 key
ScanF23, //!< Keyboard F23 key F21, //!< Keyboard F21 key
ScanF24, //!< Keyboard F24 key F22, //!< Keyboard F22 key
ScanCapsLock, //!< Keyboard Caps %Lock key F23, //!< Keyboard F23 key
ScanPrintScreen, //!< Keyboard Print Screen key F24, //!< Keyboard F24 key
ScanScrollLock, //!< Keyboard Scroll %Lock key CapsLock, //!< Keyboard Caps %Lock key
ScanPause, //!< Keyboard Pause key PrintScreen, //!< Keyboard Print Screen key
ScanInsert, //!< Keyboard Insert key ScrollLock, //!< Keyboard Scroll %Lock key
ScanHome, //!< Keyboard Home key Pause, //!< Keyboard Pause key
ScanPageUp, //!< Keyboard Page Up key Insert, //!< Keyboard Insert key
ScanDelete, //!< Keyboard Delete Forward key Home, //!< Keyboard Home key
ScanEnd, //!< Keyboard End key PageUp, //!< Keyboard Page Up key
ScanPageDown, //!< Keyboard Page Down key Delete, //!< Keyboard Delete Forward key
ScanRight, //!< Keyboard Right Arrow key End, //!< Keyboard End key
ScanLeft, //!< Keyboard Left Arrow key PageDown, //!< Keyboard Page Down key
ScanDown, //!< Keyboard Down Arrow key Right, //!< Keyboard Right Arrow key
ScanUp, //!< Keyboard Up Arrow key Left, //!< Keyboard Left Arrow key
ScanNumLock, //!< Keypad Num %Lock and Clear key Down, //!< Keyboard Down Arrow key
ScanNumpadDivide, //!< Keypad / key Up, //!< Keyboard Up Arrow key
ScanNumpadMultiply, //!< Keypad * key NumLock, //!< Keypad Num %Lock and Clear key
ScanNumpadMinus, //!< Keypad - key NumpadDivide, //!< Keypad / key
ScanNumpadPlus, //!< Keypad + key NumpadMultiply, //!< Keypad * key
ScanNumpadEqual, //!< keypad = key NumpadMinus, //!< Keypad - key
ScanNumpadEnter, //!< Keypad Enter/Return key NumpadPlus, //!< Keypad + key
ScanNumpadDecimal, //!< Keypad . and Delete key NumpadEqual, //!< keypad = key
ScanNumpad1, //!< Keypad 1 and End key NumpadEnter, //!< Keypad Enter/Return key
ScanNumpad2, //!< Keypad 2 and Down Arrow key NumpadDecimal, //!< Keypad . and Delete key
ScanNumpad3, //!< Keypad 3 and Page Down key Numpad1, //!< Keypad 1 and End key
ScanNumpad4, //!< Keypad 4 and Left Arrow key Numpad2, //!< Keypad 2 and Down Arrow key
ScanNumpad5, //!< Keypad 5 key Numpad3, //!< Keypad 3 and Page Down key
ScanNumpad6, //!< Keypad 6 and Right Arrow key Numpad4, //!< Keypad 4 and Left Arrow key
ScanNumpad7, //!< Keypad 7 and Home key Numpad5, //!< Keypad 5 key
ScanNumpad8, //!< Keypad 8 and Up Arrow key Numpad6, //!< Keypad 6 and Right Arrow key
ScanNumpad9, //!< Keypad 9 and Page Up key Numpad7, //!< Keypad 7 and Home key
ScanNumpad0, //!< Keypad 0 and Insert key Numpad8, //!< Keypad 8 and Up Arrow key
// For US keyboards doesn't exist Numpad9, //!< Keypad 9 and Page Up key
// For Non-US keyboards mapped to key 45 (Microsoft Keyboard Scan Code Specification) Numpad0, //!< Keypad 0 and Insert key
// Typical language mappings: Belg:<\> FrCa:«°» Dan:<\> Dutch:]|[ Fren:<> Ger:<|> Ital:<> LatAm:<> Nor:<> Span:<> Swed:<|> Swiss:<\> UK:\| Brazil: \|. // For US keyboards doesn't exist
ScanNonUsBackslash, //!< Keyboard Non-US \ and | key // For Non-US keyboards mapped to key 45 (Microsoft Keyboard Scan Code Specification)
ScanApplication, //!< Keyboard Application key // Typical language mappings: Belg:<\> FrCa:«°» Dan:<\> Dutch:]|[ Fren:<> Ger:<|> Ital:<> LatAm:<> Nor:<> Span:<> Swed:<|> Swiss:<\> UK:\| Brazil: \|.
ScanExecute, //!< Keyboard Execute key NonUsBackslash, //!< Keyboard Non-US \ and | key
ScanModeChange, //!< Keyboard Mode Change key Application, //!< Keyboard Application key
ScanHelp, //!< Keyboard Help key Execute, //!< Keyboard Execute key
ScanMenu, //!< Keyboard Menu key ModeChange, //!< Keyboard Mode Change key
ScanSelect, //!< Keyboard Select key Help, //!< Keyboard Help key
ScanRedo, //!< Keyboard Redo key Menu, //!< Keyboard Menu key
ScanUndo, //!< Keyboard Undo key Select, //!< Keyboard Select key
ScanCut, //!< Keyboard Cut key Redo, //!< Keyboard Redo key
ScanCopy, //!< Keyboard Copy key Undo, //!< Keyboard Undo key
ScanPaste, //!< Keyboard Paste key Cut, //!< Keyboard Cut key
ScanVolumeMute, //!< Keyboard Volume Mute key Copy, //!< Keyboard Copy key
ScanVolumeUp, //!< Keyboard Volume Up key Paste, //!< Keyboard Paste key
ScanVolumeDown, //!< Keyboard Volume Down key VolumeMute, //!< Keyboard Volume Mute key
ScanMediaPlayPause, //!< Keyboard Media Play Pause key VolumeUp, //!< Keyboard Volume Up key
ScanMediaStop, //!< Keyboard Media Stop key VolumeDown, //!< Keyboard Volume Down key
ScanMediaNextTrack, //!< Keyboard Media Next Track key MediaPlayPause, //!< Keyboard Media Play Pause key
ScanMediaPreviousTrack, //!< Keyboard Media Previous Track key MediaStop, //!< Keyboard Media Stop key
ScanLControl, //!< Keyboard Left Control key MediaNextTrack, //!< Keyboard Media Next Track key
ScanLShift, //!< Keyboard Left Shift key MediaPreviousTrack, //!< Keyboard Media Previous Track key
ScanLAlt, //!< Keyboard Left Alt key LControl, //!< Keyboard Left Control key
ScanLSystem, //!< Keyboard Left System key LShift, //!< Keyboard Left Shift key
ScanRControl, //!< Keyboard Right Control key LAlt, //!< Keyboard Left Alt key
ScanRShift, //!< Keyboard Right Shift key LSystem, //!< Keyboard Left System key
ScanRAlt, //!< Keyboard Right Alt key RControl, //!< Keyboard Right Control key
ScanRSystem, //!< Keyboard Right System key RShift, //!< Keyboard Right Shift key
ScanBack, //!< Keyboard Back key RAlt, //!< Keyboard Right Alt key
ScanForward, //!< Keyboard Forward key RSystem, //!< Keyboard Right System key
ScanRefresh, //!< Keyboard Refresh key Back, //!< Keyboard Back key
ScanStop, //!< Keyboard Stop key Forward, //!< Keyboard Forward key
ScanSearch, //!< Keyboard Search key Refresh, //!< Keyboard Refresh key
ScanFavorites, //!< Keyboard Favorites key Stop, //!< Keyboard Stop key
ScanHomePage, //!< Keyboard Home Page key Search, //!< Keyboard Search key
ScanLaunchApplication1, //!< Keyboard Launch Application 1 key Favorites, //!< Keyboard Favorites key
ScanLaunchApplication2, //!< Keyboard Launch Application 2 key HomePage, //!< Keyboard Home Page key
ScanLaunchMail, //!< Keyboard Launch Mail key LaunchApplication1, //!< Keyboard Launch Application 1 key
ScanLaunchMediaSelect, //!< Keyboard Launch Media Select key LaunchApplication2, //!< Keyboard Launch Application 2 key
LaunchMail, //!< Keyboard Launch Mail key
LaunchMediaSelect, //!< Keyboard Launch Media Select key
ScancodeCount //!< Keep last -- the total number of scancodes ScancodeCount //!< Keep last -- the total number of scancodes
};
}; };
typedef Scan::Scancode Scancode;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Check if a key is pressed /// \brief Check if a key is pressed
/// ///
@ -377,7 +382,7 @@ public:
/// ///
/// \return The scancode corresponding to the key under the current /// \return The scancode corresponding to the key under the current
/// keyboard layout used by the operating system, or /// keyboard layout used by the operating system, or
/// sf::Keyboard::ScanUnknown when the key cannot be mapped /// sf::Keyboard::Scan::Unknown when the key cannot be mapped
/// to a sf::Keyboard::Scancode. /// to a sf::Keyboard::Scancode.
/// ///
/// \see localize /// \see localize
@ -393,7 +398,7 @@ public:
/// used in user interfaces, as the description for the key takes /// used in user interfaces, as the description for the key takes
/// the users keyboard layout into consideration. /// the users keyboard layout into consideration.
/// ///
/// \warning The result is OS-dependent: for example, sf::Keyboard::ScanLSystem /// \warning The result is OS-dependent: for example, sf::Keyboard::Scan::LSystem
/// is "Left Meta" on Linux, "Left Windows" on Windows and /// is "Left Meta" on Linux, "Left Windows" on Windows and
/// "Left Command" on macOS. /// "Left Command" on macOS.
/// ///
@ -460,7 +465,7 @@ public:
/// { /// {
/// // quit... /// // quit...
/// } /// }
/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::ScanGrave)) /// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Scan::Grave))
/// { /// {
/// // open in-game command line (if it's not already open) /// // open in-game command line (if it's not already open)
/// } /// }

View File

@ -115,7 +115,7 @@ public:
/// Try to convert a virtual keycode (HID level) into a /// Try to convert a virtual keycode (HID level) into a
/// SFML scancode. /// SFML scancode.
/// ///
/// Return sf::Keyboard::ScanUnknown if the keycode is unknown. /// Return sf::Keyboard::Scan::Unknown if the keycode is unknown.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static Keyboard::Scancode nonLocalizedKey(UniChar virtualKeycode); static Keyboard::Scancode nonLocalizedKey(UniChar virtualKeycode);
@ -252,7 +252,7 @@ private:
/// ///
/// \param usage Any kHIDUsage_Keyboard* usage /// \param usage Any kHIDUsage_Keyboard* usage
/// \return the scancode associated with the given HID key usage /// \return the scancode associated with the given HID key usage
/// or ScanUnknown if it is associated with no scancode. /// or Scan::Unknown if it is associated with no scancode.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static Keyboard::Scancode usageToScancode(UInt32 usage); static Keyboard::Scancode usageToScancode(UInt32 usage);
@ -276,9 +276,9 @@ private:
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
IOHIDManagerRef m_manager; ///< Underlying HID Manager IOHIDManagerRef m_manager; ///< Underlying HID Manager
IOHIDElements m_keys[Keyboard::ScancodeCount]; ///< All the keys on any connected keyboard IOHIDElements m_keys[Keyboard::Scan::ScancodeCount]; ///< All the keys on any connected keyboard
Keyboard::Scancode m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode Keyboard::Scancode m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode
Keyboard::Key m_scancodeToKeyMapping[Keyboard::ScancodeCount]; ///< Mapping from Scancode to Key Keyboard::Key m_scancodeToKeyMapping[Keyboard::Scan::ScancodeCount]; ///< Mapping from Scancode to Key
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// m_keys' index corresponds to sf::Keyboard::Scancode enum. /// m_keys' index corresponds to sf::Keyboard::Scancode enum.

File diff suppressed because it is too large Load Diff

View File

@ -169,7 +169,7 @@ void handleModifiersChanged(NSUInteger modifiers, sf::priv::WindowImplCocoa& req
NSLeftShiftKeyMask, NSRightShiftKeyMask, NSLeftShiftKeyMask, NSRightShiftKeyMask,
state.leftShiftWasDown, state.rightShiftWasDown, state.leftShiftWasDown, state.rightShiftWasDown,
sf::Keyboard::LShift, sf::Keyboard::RShift, sf::Keyboard::LShift, sf::Keyboard::RShift,
sf::Keyboard::ScanLShift, sf::Keyboard::ScanRShift, sf::Keyboard::Scan::LShift, sf::Keyboard::Scan::RShift,
requester requester
); );
@ -179,7 +179,7 @@ void handleModifiersChanged(NSUInteger modifiers, sf::priv::WindowImplCocoa& req
NSLeftCommandKeyMask, NSRightCommandKeyMask, NSLeftCommandKeyMask, NSRightCommandKeyMask,
state.leftCommandWasDown, state.rightCommandWasDown, state.leftCommandWasDown, state.rightCommandWasDown,
sf::Keyboard::LSystem, sf::Keyboard::RSystem, sf::Keyboard::LSystem, sf::Keyboard::RSystem,
sf::Keyboard::ScanLSystem, sf::Keyboard::ScanRSystem, sf::Keyboard::Scan::LSystem, sf::Keyboard::Scan::RSystem,
requester requester
); );
@ -189,7 +189,7 @@ void handleModifiersChanged(NSUInteger modifiers, sf::priv::WindowImplCocoa& req
NSLeftAlternateKeyMask, NSRightAlternateKeyMask, NSLeftAlternateKeyMask, NSRightAlternateKeyMask,
state.leftAlternateWasDown, state.rightAlternateWasDown, state.leftAlternateWasDown, state.rightAlternateWasDown,
sf::Keyboard::LAlt, sf::Keyboard::RAlt, sf::Keyboard::LAlt, sf::Keyboard::RAlt,
sf::Keyboard::ScanLAlt, sf::Keyboard::ScanRAlt, sf::Keyboard::Scan::LAlt, sf::Keyboard::Scan::RAlt,
requester requester
); );
@ -199,7 +199,7 @@ void handleModifiersChanged(NSUInteger modifiers, sf::priv::WindowImplCocoa& req
NSLeftControlKeyMask, NSRightControlKeyMask, NSLeftControlKeyMask, NSRightControlKeyMask,
state.leftControlWasDown, state.rightControlWasDown, state.leftControlWasDown, state.rightControlWasDown,
sf::Keyboard::LControl, sf::Keyboard::RControl, sf::Keyboard::LControl, sf::Keyboard::RControl,
sf::Keyboard::ScanLControl, sf::Keyboard::ScanRControl, sf::Keyboard::Scan::LControl, sf::Keyboard::Scan::RControl,
requester requester
); );
} }

View File

@ -94,7 +94,7 @@
{ {
sf::Event::KeyEvent key = [SFOpenGLView convertNSKeyEventToSFMLEvent:theEvent]; sf::Event::KeyEvent key = [SFOpenGLView convertNSKeyEventToSFMLEvent:theEvent];
if ((key.code != sf::Keyboard::Unknown) || (key.scancode != sf::Keyboard::ScanUnknown)) if ((key.code != sf::Keyboard::Unknown) || (key.scancode != sf::Keyboard::Scan::Unknown))
m_requester->keyDown(key); m_requester->keyDown(key);
} }

View File

@ -44,7 +44,7 @@ namespace
const KeyCode NullKeyCode = 0; const KeyCode NullKeyCode = 0;
const int MaxKeyCode = 256; const int MaxKeyCode = 256;
KeyCode scancodeToKeycode[sf::Keyboard::ScancodeCount]; ///< Mapping of SFML scancode to X11 KeyCode KeyCode scancodeToKeycode[sf::Keyboard::Scan::ScancodeCount]; ///< Mapping of SFML scancode to X11 KeyCode
sf::Keyboard::Scancode keycodeToScancode[MaxKeyCode]; ///< Mapping of X11 KeyCode to SFML scancode sf::Keyboard::Scancode keycodeToScancode[MaxKeyCode]; ///< Mapping of X11 KeyCode to SFML scancode
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -59,7 +59,7 @@ bool isValidKeycode(KeyCode keycode)
sf::Keyboard::Scancode translateKeyCode(Display* display, KeyCode keycode) sf::Keyboard::Scancode translateKeyCode(Display* display, KeyCode keycode)
{ {
if (!isValidKeycode(keycode)) if (!isValidKeycode(keycode))
return sf::Keyboard::ScanUnknown; return sf::Keyboard::Scan::Unknown;
// Try secondary keysym, for numeric keypad keys // Try secondary keysym, for numeric keypad keys
// Note: This way we always force "NumLock = ON", which is intentional // Note: This way we always force "NumLock = ON", which is intentional
@ -68,20 +68,20 @@ sf::Keyboard::Scancode translateKeyCode(Display* display, KeyCode keycode)
switch (keySym) switch (keySym)
{ {
case XK_KP_0: return sf::Keyboard::ScanNumpad0; case XK_KP_0: return sf::Keyboard::Scan::Numpad0;
case XK_KP_1: return sf::Keyboard::ScanNumpad1; case XK_KP_1: return sf::Keyboard::Scan::Numpad1;
case XK_KP_2: return sf::Keyboard::ScanNumpad2; case XK_KP_2: return sf::Keyboard::Scan::Numpad2;
case XK_KP_3: return sf::Keyboard::ScanNumpad3; case XK_KP_3: return sf::Keyboard::Scan::Numpad3;
case XK_KP_4: return sf::Keyboard::ScanNumpad4; case XK_KP_4: return sf::Keyboard::Scan::Numpad4;
case XK_KP_5: return sf::Keyboard::ScanNumpad5; case XK_KP_5: return sf::Keyboard::Scan::Numpad5;
case XK_KP_6: return sf::Keyboard::ScanNumpad6; case XK_KP_6: return sf::Keyboard::Scan::Numpad6;
case XK_KP_7: return sf::Keyboard::ScanNumpad7; case XK_KP_7: return sf::Keyboard::Scan::Numpad7;
case XK_KP_8: return sf::Keyboard::ScanNumpad8; case XK_KP_8: return sf::Keyboard::Scan::Numpad8;
case XK_KP_9: return sf::Keyboard::ScanNumpad9; case XK_KP_9: return sf::Keyboard::Scan::Numpad9;
case XK_KP_Separator: return sf::Keyboard::ScanNumpadDecimal; case XK_KP_Separator: return sf::Keyboard::Scan::NumpadDecimal;
case XK_KP_Decimal: return sf::Keyboard::ScanNumpadDecimal; case XK_KP_Decimal: return sf::Keyboard::Scan::NumpadDecimal;
case XK_KP_Equal: return sf::Keyboard::ScanNumpadEqual; case XK_KP_Equal: return sf::Keyboard::Scan::NumpadEqual;
case XK_KP_Enter: return sf::Keyboard::ScanNumpadEnter; case XK_KP_Enter: return sf::Keyboard::Scan::NumpadEnter;
default: break; default: break;
} }
@ -91,180 +91,180 @@ sf::Keyboard::Scancode translateKeyCode(Display* display, KeyCode keycode)
switch (keySym) switch (keySym)
{ {
case XK_Return: return sf::Keyboard::ScanEnter; case XK_Return: return sf::Keyboard::Scan::Enter;
case XK_Escape: return sf::Keyboard::ScanEscape; case XK_Escape: return sf::Keyboard::Scan::Escape;
case XK_BackSpace: return sf::Keyboard::ScanBackspace; case XK_BackSpace: return sf::Keyboard::Scan::Backspace;
case XK_Tab: return sf::Keyboard::ScanTab; case XK_Tab: return sf::Keyboard::Scan::Tab;
case XK_Shift_L: return sf::Keyboard::ScanLShift; case XK_Shift_L: return sf::Keyboard::Scan::LShift;
case XK_Shift_R: return sf::Keyboard::ScanRShift; case XK_Shift_R: return sf::Keyboard::Scan::RShift;
case XK_Control_L: return sf::Keyboard::ScanLControl; case XK_Control_L: return sf::Keyboard::Scan::LControl;
case XK_Control_R: return sf::Keyboard::ScanRControl; case XK_Control_R: return sf::Keyboard::Scan::RControl;
case XK_Alt_L: return sf::Keyboard::ScanLAlt; case XK_Alt_L: return sf::Keyboard::Scan::LAlt;
case XK_ISO_Level3_Shift: // AltGr on at least some machines case XK_ISO_Level3_Shift: // AltGr on at least some machines
case XK_Alt_R: return sf::Keyboard::ScanRAlt; case XK_Alt_R: return sf::Keyboard::Scan::RAlt;
case XK_Meta_L: case XK_Meta_L:
case XK_Super_L: return sf::Keyboard::ScanLSystem; case XK_Super_L: return sf::Keyboard::Scan::LSystem;
case XK_Meta_R: case XK_Meta_R:
case XK_Super_R: return sf::Keyboard::ScanRSystem; case XK_Super_R: return sf::Keyboard::Scan::RSystem;
case XK_Menu: return sf::Keyboard::ScanMenu; case XK_Menu: return sf::Keyboard::Scan::Menu;
case XK_Num_Lock: return sf::Keyboard::ScanNumLock; case XK_Num_Lock: return sf::Keyboard::Scan::NumLock;
case XK_Caps_Lock: return sf::Keyboard::ScanCapsLock; case XK_Caps_Lock: return sf::Keyboard::Scan::CapsLock;
case XK_Execute: return sf::Keyboard::ScanExecute; case XK_Execute: return sf::Keyboard::Scan::Execute;
case XK_Hyper_R: return sf::Keyboard::ScanApplication; case XK_Hyper_R: return sf::Keyboard::Scan::Application;
case XK_Select: return sf::Keyboard::ScanSelect; case XK_Select: return sf::Keyboard::Scan::Select;
case XK_Cancel: return sf::Keyboard::ScanStop; case XK_Cancel: return sf::Keyboard::Scan::Stop;
case XK_Redo: return sf::Keyboard::ScanRedo; case XK_Redo: return sf::Keyboard::Scan::Redo;
case XK_Undo: return sf::Keyboard::ScanUndo; case XK_Undo: return sf::Keyboard::Scan::Undo;
case XK_Find: return sf::Keyboard::ScanSearch; case XK_Find: return sf::Keyboard::Scan::Search;
case XK_Mode_switch: return sf::Keyboard::ScanModeChange; case XK_Mode_switch: return sf::Keyboard::Scan::ModeChange;
case XK_Print: return sf::Keyboard::ScanPrintScreen; case XK_Print: return sf::Keyboard::Scan::PrintScreen;
case XK_Scroll_Lock: return sf::Keyboard::ScanScrollLock; case XK_Scroll_Lock: return sf::Keyboard::Scan::ScrollLock;
case XK_Pause: case XK_Pause:
case XK_Break: return sf::Keyboard::ScanPause; case XK_Break: return sf::Keyboard::Scan::Pause;
case XK_Delete: case XK_Delete:
case XK_Clear: return sf::Keyboard::ScanDelete; case XK_Clear: return sf::Keyboard::Scan::Delete;
case XK_Home: return sf::Keyboard::ScanHome; case XK_Home: return sf::Keyboard::Scan::Home;
case XK_End: return sf::Keyboard::ScanEnd; case XK_End: return sf::Keyboard::Scan::End;
case XK_Page_Up: return sf::Keyboard::ScanPageUp; case XK_Page_Up: return sf::Keyboard::Scan::PageUp;
case XK_Page_Down: return sf::Keyboard::ScanPageDown; case XK_Page_Down: return sf::Keyboard::Scan::PageDown;
case XK_Insert: return sf::Keyboard::ScanInsert; case XK_Insert: return sf::Keyboard::Scan::Insert;
case XK_Left: return sf::Keyboard::ScanLeft; case XK_Left: return sf::Keyboard::Scan::Left;
case XK_Right: return sf::Keyboard::ScanRight; case XK_Right: return sf::Keyboard::Scan::Right;
case XK_Down: return sf::Keyboard::ScanDown; case XK_Down: return sf::Keyboard::Scan::Down;
case XK_Up: return sf::Keyboard::ScanUp; case XK_Up: return sf::Keyboard::Scan::Up;
case XK_F1: return sf::Keyboard::ScanF1; case XK_F1: return sf::Keyboard::Scan::F1;
case XK_F2: return sf::Keyboard::ScanF2; case XK_F2: return sf::Keyboard::Scan::F2;
case XK_F3: return sf::Keyboard::ScanF3; case XK_F3: return sf::Keyboard::Scan::F3;
case XK_F4: return sf::Keyboard::ScanF4; case XK_F4: return sf::Keyboard::Scan::F4;
case XK_F5: return sf::Keyboard::ScanF5; case XK_F5: return sf::Keyboard::Scan::F5;
case XK_F6: return sf::Keyboard::ScanF6; case XK_F6: return sf::Keyboard::Scan::F6;
case XK_F7: return sf::Keyboard::ScanF7; case XK_F7: return sf::Keyboard::Scan::F7;
case XK_F8: return sf::Keyboard::ScanF8; case XK_F8: return sf::Keyboard::Scan::F8;
case XK_F9: return sf::Keyboard::ScanF9; case XK_F9: return sf::Keyboard::Scan::F9;
case XK_F10: return sf::Keyboard::ScanF10; case XK_F10: return sf::Keyboard::Scan::F10;
case XK_F11: return sf::Keyboard::ScanF11; case XK_F11: return sf::Keyboard::Scan::F11;
case XK_F12: return sf::Keyboard::ScanF12; case XK_F12: return sf::Keyboard::Scan::F12;
case XK_F13: return sf::Keyboard::ScanF13; case XK_F13: return sf::Keyboard::Scan::F13;
case XK_F14: return sf::Keyboard::ScanF14; case XK_F14: return sf::Keyboard::Scan::F14;
case XK_F15: return sf::Keyboard::ScanF15; case XK_F15: return sf::Keyboard::Scan::F15;
case XK_F16: return sf::Keyboard::ScanF16; case XK_F16: return sf::Keyboard::Scan::F16;
case XK_F17: return sf::Keyboard::ScanF17; case XK_F17: return sf::Keyboard::Scan::F17;
case XK_F18: return sf::Keyboard::ScanF18; case XK_F18: return sf::Keyboard::Scan::F18;
case XK_F19: return sf::Keyboard::ScanF19; case XK_F19: return sf::Keyboard::Scan::F19;
case XK_F20: return sf::Keyboard::ScanF20; case XK_F20: return sf::Keyboard::Scan::F20;
case XK_F21: return sf::Keyboard::ScanF21; case XK_F21: return sf::Keyboard::Scan::F21;
case XK_F22: return sf::Keyboard::ScanF22; case XK_F22: return sf::Keyboard::Scan::F22;
case XK_F23: return sf::Keyboard::ScanF23; case XK_F23: return sf::Keyboard::Scan::F23;
case XK_F24: return sf::Keyboard::ScanF24; case XK_F24: return sf::Keyboard::Scan::F24;
// Numeric keypad // Numeric keypad
case XK_KP_Divide: return sf::Keyboard::ScanNumpadDivide; case XK_KP_Divide: return sf::Keyboard::Scan::NumpadDivide;
case XK_KP_Multiply: return sf::Keyboard::ScanNumpadMultiply; case XK_KP_Multiply: return sf::Keyboard::Scan::NumpadMultiply;
case XK_KP_Subtract: return sf::Keyboard::ScanNumpadMinus; case XK_KP_Subtract: return sf::Keyboard::Scan::NumpadMinus;
case XK_KP_Add: return sf::Keyboard::ScanNumpadPlus; case XK_KP_Add: return sf::Keyboard::Scan::NumpadPlus;
// These should have been detected in secondary keysym test above! // These should have been detected in secondary keysym test above!
case XK_KP_Insert: return sf::Keyboard::ScanNumpad0; case XK_KP_Insert: return sf::Keyboard::Scan::Numpad0;
case XK_KP_End: return sf::Keyboard::ScanNumpad1; case XK_KP_End: return sf::Keyboard::Scan::Numpad1;
case XK_KP_Down: return sf::Keyboard::ScanNumpad2; case XK_KP_Down: return sf::Keyboard::Scan::Numpad2;
case XK_KP_Page_Down: return sf::Keyboard::ScanNumpad3; case XK_KP_Page_Down: return sf::Keyboard::Scan::Numpad3;
case XK_KP_Left: return sf::Keyboard::ScanNumpad4; case XK_KP_Left: return sf::Keyboard::Scan::Numpad4;
case XK_KP_Right: return sf::Keyboard::ScanNumpad6; case XK_KP_Right: return sf::Keyboard::Scan::Numpad6;
case XK_KP_Home: return sf::Keyboard::ScanNumpad7; case XK_KP_Home: return sf::Keyboard::Scan::Numpad7;
case XK_KP_Up: return sf::Keyboard::ScanNumpad8; case XK_KP_Up: return sf::Keyboard::Scan::Numpad8;
case XK_KP_Page_Up: return sf::Keyboard::ScanNumpad9; case XK_KP_Page_Up: return sf::Keyboard::Scan::Numpad9;
case XK_KP_Delete: return sf::Keyboard::ScanNumpadDecimal; case XK_KP_Delete: return sf::Keyboard::Scan::NumpadDecimal;
case XK_KP_Equal: return sf::Keyboard::ScanNumpadEqual; case XK_KP_Equal: return sf::Keyboard::Scan::NumpadEqual;
case XK_KP_Enter: return sf::Keyboard::ScanNumpadEnter; case XK_KP_Enter: return sf::Keyboard::Scan::NumpadEnter;
// Last resort: Check for printable keys (should not happen if the XKB // Last resort: Check for printable keys (should not happen if the XKB
// extension is available). This will give a layout dependent mapping // extension is available). This will give a layout dependent mapping
// (which is wrong, and we may miss some keys, especially on non-US // (which is wrong, and we may miss some keys, especially on non-US
// keyboards), but it's better than nothing... // keyboards), but it's better than nothing...
case XK_a: case XK_a:
case XK_A: return sf::Keyboard::ScanA; case XK_A: return sf::Keyboard::Scan::A;
case XK_b: case XK_b:
case XK_B: return sf::Keyboard::ScanB; case XK_B: return sf::Keyboard::Scan::B;
case XK_c: case XK_c:
case XK_C: return sf::Keyboard::ScanC; case XK_C: return sf::Keyboard::Scan::C;
case XK_d: case XK_d:
case XK_D: return sf::Keyboard::ScanD; case XK_D: return sf::Keyboard::Scan::D;
case XK_e: case XK_e:
case XK_E: return sf::Keyboard::ScanE; case XK_E: return sf::Keyboard::Scan::E;
case XK_f: case XK_f:
case XK_F: return sf::Keyboard::ScanF; case XK_F: return sf::Keyboard::Scan::F;
case XK_g: case XK_g:
case XK_G: return sf::Keyboard::ScanG; case XK_G: return sf::Keyboard::Scan::G;
case XK_h: case XK_h:
case XK_H: return sf::Keyboard::ScanH; case XK_H: return sf::Keyboard::Scan::H;
case XK_i: case XK_i:
case XK_I: return sf::Keyboard::ScanI; case XK_I: return sf::Keyboard::Scan::I;
case XK_j: case XK_j:
case XK_J: return sf::Keyboard::ScanJ; case XK_J: return sf::Keyboard::Scan::J;
case XK_k: case XK_k:
case XK_K: return sf::Keyboard::ScanK; case XK_K: return sf::Keyboard::Scan::K;
case XK_l: case XK_l:
case XK_L: return sf::Keyboard::ScanL; case XK_L: return sf::Keyboard::Scan::L;
case XK_m: case XK_m:
case XK_M: return sf::Keyboard::ScanM; case XK_M: return sf::Keyboard::Scan::M;
case XK_n: case XK_n:
case XK_N: return sf::Keyboard::ScanN; case XK_N: return sf::Keyboard::Scan::N;
case XK_o: case XK_o:
case XK_O: return sf::Keyboard::ScanO; case XK_O: return sf::Keyboard::Scan::O;
case XK_p: case XK_p:
case XK_P: return sf::Keyboard::ScanP; case XK_P: return sf::Keyboard::Scan::P;
case XK_q: case XK_q:
case XK_Q: return sf::Keyboard::ScanQ; case XK_Q: return sf::Keyboard::Scan::Q;
case XK_r: case XK_r:
case XK_R: return sf::Keyboard::ScanR; case XK_R: return sf::Keyboard::Scan::R;
case XK_s: case XK_s:
case XK_S: return sf::Keyboard::ScanS; case XK_S: return sf::Keyboard::Scan::S;
case XK_t: case XK_t:
case XK_T: return sf::Keyboard::ScanT; case XK_T: return sf::Keyboard::Scan::T;
case XK_u: case XK_u:
case XK_U: return sf::Keyboard::ScanU; case XK_U: return sf::Keyboard::Scan::U;
case XK_v: case XK_v:
case XK_V: return sf::Keyboard::ScanV; case XK_V: return sf::Keyboard::Scan::V;
case XK_w: case XK_w:
case XK_W: return sf::Keyboard::ScanW; case XK_W: return sf::Keyboard::Scan::W;
case XK_x: case XK_x:
case XK_X: return sf::Keyboard::ScanX; case XK_X: return sf::Keyboard::Scan::X;
case XK_y: case XK_y:
case XK_Y: return sf::Keyboard::ScanY; case XK_Y: return sf::Keyboard::Scan::Y;
case XK_z: case XK_z:
case XK_Z: return sf::Keyboard::ScanZ; case XK_Z: return sf::Keyboard::Scan::Z;
case XK_1: return sf::Keyboard::ScanNum1; case XK_1: return sf::Keyboard::Scan::Num1;
case XK_2: return sf::Keyboard::ScanNum2; case XK_2: return sf::Keyboard::Scan::Num2;
case XK_3: return sf::Keyboard::ScanNum3; case XK_3: return sf::Keyboard::Scan::Num3;
case XK_4: return sf::Keyboard::ScanNum4; case XK_4: return sf::Keyboard::Scan::Num4;
case XK_5: return sf::Keyboard::ScanNum5; case XK_5: return sf::Keyboard::Scan::Num5;
case XK_6: return sf::Keyboard::ScanNum6; case XK_6: return sf::Keyboard::Scan::Num6;
case XK_7: return sf::Keyboard::ScanNum7; case XK_7: return sf::Keyboard::Scan::Num7;
case XK_8: return sf::Keyboard::ScanNum8; case XK_8: return sf::Keyboard::Scan::Num8;
case XK_9: return sf::Keyboard::ScanNum9; case XK_9: return sf::Keyboard::Scan::Num9;
case XK_0: return sf::Keyboard::ScanNum0; case XK_0: return sf::Keyboard::Scan::Num0;
case XK_space: return sf::Keyboard::ScanSpace; case XK_space: return sf::Keyboard::Scan::Space;
case XK_minus: return sf::Keyboard::ScanHyphen; case XK_minus: return sf::Keyboard::Scan::Hyphen;
case XK_equal: return sf::Keyboard::ScanEqual; case XK_equal: return sf::Keyboard::Scan::Equal;
case XK_bracketleft: return sf::Keyboard::ScanLBracket; case XK_bracketleft: return sf::Keyboard::Scan::LBracket;
case XK_bracketright: return sf::Keyboard::ScanRBracket; case XK_bracketright: return sf::Keyboard::Scan::RBracket;
case XK_backslash: return sf::Keyboard::ScanBackslash; case XK_backslash: return sf::Keyboard::Scan::Backslash;
case XK_semicolon: return sf::Keyboard::ScanSemicolon; case XK_semicolon: return sf::Keyboard::Scan::Semicolon;
case XK_apostrophe: return sf::Keyboard::ScanApostrophe; case XK_apostrophe: return sf::Keyboard::Scan::Apostrophe;
case XK_grave: return sf::Keyboard::ScanGrave; case XK_grave: return sf::Keyboard::Scan::Grave;
case XK_comma: return sf::Keyboard::ScanComma; case XK_comma: return sf::Keyboard::Scan::Comma;
case XK_period: return sf::Keyboard::ScanPeriod; case XK_period: return sf::Keyboard::Scan::Period;
case XK_slash: return sf::Keyboard::ScanSlash; case XK_slash: return sf::Keyboard::Scan::Slash;
case XK_less: return sf::Keyboard::ScanNonUsBackslash; case XK_less: return sf::Keyboard::Scan::NonUsBackslash;
default: return sf::Keyboard::ScanUnknown; default: return sf::Keyboard::Scan::Unknown;
} }
} }
@ -273,172 +273,172 @@ std::map<std::string, sf::Keyboard::Scancode> GetNameScancodeMap()
{ {
std::map<std::string, sf::Keyboard::Scancode> mapping; std::map<std::string, sf::Keyboard::Scancode> mapping;
mapping.insert(std::make_pair("LSGT", sf::Keyboard::ScanNonUsBackslash)); mapping.insert(std::make_pair("LSGT", sf::Keyboard::Scan::NonUsBackslash));
mapping.insert(std::make_pair("TLDE", sf::Keyboard::ScanGrave)); mapping.insert(std::make_pair("TLDE", sf::Keyboard::Scan::Grave));
mapping.insert(std::make_pair("AE01", sf::Keyboard::ScanNum1)); mapping.insert(std::make_pair("AE01", sf::Keyboard::Scan::Num1));
mapping.insert(std::make_pair("AE02", sf::Keyboard::ScanNum2)); mapping.insert(std::make_pair("AE02", sf::Keyboard::Scan::Num2));
mapping.insert(std::make_pair("AE03", sf::Keyboard::ScanNum3)); mapping.insert(std::make_pair("AE03", sf::Keyboard::Scan::Num3));
mapping.insert(std::make_pair("AE04", sf::Keyboard::ScanNum4)); mapping.insert(std::make_pair("AE04", sf::Keyboard::Scan::Num4));
mapping.insert(std::make_pair("AE05", sf::Keyboard::ScanNum5)); mapping.insert(std::make_pair("AE05", sf::Keyboard::Scan::Num5));
mapping.insert(std::make_pair("AE06", sf::Keyboard::ScanNum6)); mapping.insert(std::make_pair("AE06", sf::Keyboard::Scan::Num6));
mapping.insert(std::make_pair("AE07", sf::Keyboard::ScanNum7)); mapping.insert(std::make_pair("AE07", sf::Keyboard::Scan::Num7));
mapping.insert(std::make_pair("AE08", sf::Keyboard::ScanNum8)); mapping.insert(std::make_pair("AE08", sf::Keyboard::Scan::Num8));
mapping.insert(std::make_pair("AE09", sf::Keyboard::ScanNum9)); mapping.insert(std::make_pair("AE09", sf::Keyboard::Scan::Num9));
mapping.insert(std::make_pair("AE10", sf::Keyboard::ScanNum0)); mapping.insert(std::make_pair("AE10", sf::Keyboard::Scan::Num0));
mapping.insert(std::make_pair("AE11", sf::Keyboard::ScanHyphen)); mapping.insert(std::make_pair("AE11", sf::Keyboard::Scan::Hyphen));
mapping.insert(std::make_pair("AE12", sf::Keyboard::ScanEqual)); mapping.insert(std::make_pair("AE12", sf::Keyboard::Scan::Equal));
mapping.insert(std::make_pair("BKSP", sf::Keyboard::ScanBackspace)); mapping.insert(std::make_pair("BKSP", sf::Keyboard::Scan::Backspace));
mapping.insert(std::make_pair("TAB", sf::Keyboard::ScanTab)); mapping.insert(std::make_pair("TAB", sf::Keyboard::Scan::Tab));
mapping.insert(std::make_pair("AD01", sf::Keyboard::ScanQ)); mapping.insert(std::make_pair("AD01", sf::Keyboard::Scan::Q));
mapping.insert(std::make_pair("AD02", sf::Keyboard::ScanW)); mapping.insert(std::make_pair("AD02", sf::Keyboard::Scan::W));
mapping.insert(std::make_pair("AD03", sf::Keyboard::ScanE)); mapping.insert(std::make_pair("AD03", sf::Keyboard::Scan::E));
mapping.insert(std::make_pair("AD04", sf::Keyboard::ScanR)); mapping.insert(std::make_pair("AD04", sf::Keyboard::Scan::R));
mapping.insert(std::make_pair("AD05", sf::Keyboard::ScanT)); mapping.insert(std::make_pair("AD05", sf::Keyboard::Scan::T));
mapping.insert(std::make_pair("AD06", sf::Keyboard::ScanY)); mapping.insert(std::make_pair("AD06", sf::Keyboard::Scan::Y));
mapping.insert(std::make_pair("AD07", sf::Keyboard::ScanU)); mapping.insert(std::make_pair("AD07", sf::Keyboard::Scan::U));
mapping.insert(std::make_pair("AD08", sf::Keyboard::ScanI)); mapping.insert(std::make_pair("AD08", sf::Keyboard::Scan::I));
mapping.insert(std::make_pair("AD09", sf::Keyboard::ScanO)); mapping.insert(std::make_pair("AD09", sf::Keyboard::Scan::O));
mapping.insert(std::make_pair("AD10", sf::Keyboard::ScanP)); mapping.insert(std::make_pair("AD10", sf::Keyboard::Scan::P));
mapping.insert(std::make_pair("AD11", sf::Keyboard::ScanLBracket)); mapping.insert(std::make_pair("AD11", sf::Keyboard::Scan::LBracket));
mapping.insert(std::make_pair("AD12", sf::Keyboard::ScanRBracket)); mapping.insert(std::make_pair("AD12", sf::Keyboard::Scan::RBracket));
mapping.insert(std::make_pair("BKSL", sf::Keyboard::ScanBackslash)); mapping.insert(std::make_pair("BKSL", sf::Keyboard::Scan::Backslash));
mapping.insert(std::make_pair("RTRN", sf::Keyboard::ScanEnter)); mapping.insert(std::make_pair("RTRN", sf::Keyboard::Scan::Enter));
mapping.insert(std::make_pair("CAPS", sf::Keyboard::ScanCapsLock)); mapping.insert(std::make_pair("CAPS", sf::Keyboard::Scan::CapsLock));
mapping.insert(std::make_pair("AC01", sf::Keyboard::ScanA)); mapping.insert(std::make_pair("AC01", sf::Keyboard::Scan::A));
mapping.insert(std::make_pair("AC02", sf::Keyboard::ScanS)); mapping.insert(std::make_pair("AC02", sf::Keyboard::Scan::S));
mapping.insert(std::make_pair("AC03", sf::Keyboard::ScanD)); mapping.insert(std::make_pair("AC03", sf::Keyboard::Scan::D));
mapping.insert(std::make_pair("AC04", sf::Keyboard::ScanF)); mapping.insert(std::make_pair("AC04", sf::Keyboard::Scan::F));
mapping.insert(std::make_pair("AC05", sf::Keyboard::ScanG)); mapping.insert(std::make_pair("AC05", sf::Keyboard::Scan::G));
mapping.insert(std::make_pair("AC06", sf::Keyboard::ScanH)); mapping.insert(std::make_pair("AC06", sf::Keyboard::Scan::H));
mapping.insert(std::make_pair("AC07", sf::Keyboard::ScanJ)); mapping.insert(std::make_pair("AC07", sf::Keyboard::Scan::J));
mapping.insert(std::make_pair("AC08", sf::Keyboard::ScanK)); mapping.insert(std::make_pair("AC08", sf::Keyboard::Scan::K));
mapping.insert(std::make_pair("AC09", sf::Keyboard::ScanL)); mapping.insert(std::make_pair("AC09", sf::Keyboard::Scan::L));
mapping.insert(std::make_pair("AC10", sf::Keyboard::ScanSemicolon)); mapping.insert(std::make_pair("AC10", sf::Keyboard::Scan::Semicolon));
mapping.insert(std::make_pair("AC11", sf::Keyboard::ScanApostrophe)); mapping.insert(std::make_pair("AC11", sf::Keyboard::Scan::Apostrophe));
mapping.insert(std::make_pair("AC12", sf::Keyboard::ScanBackslash)); mapping.insert(std::make_pair("AC12", sf::Keyboard::Scan::Backslash));
mapping.insert(std::make_pair("LFSH", sf::Keyboard::ScanLShift)); mapping.insert(std::make_pair("LFSH", sf::Keyboard::Scan::LShift));
mapping.insert(std::make_pair("AB01", sf::Keyboard::ScanZ)); mapping.insert(std::make_pair("AB01", sf::Keyboard::Scan::Z));
mapping.insert(std::make_pair("AB02", sf::Keyboard::ScanX)); mapping.insert(std::make_pair("AB02", sf::Keyboard::Scan::X));
mapping.insert(std::make_pair("AB03", sf::Keyboard::ScanC)); mapping.insert(std::make_pair("AB03", sf::Keyboard::Scan::C));
mapping.insert(std::make_pair("AB04", sf::Keyboard::ScanV)); mapping.insert(std::make_pair("AB04", sf::Keyboard::Scan::V));
mapping.insert(std::make_pair("AB05", sf::Keyboard::ScanB)); mapping.insert(std::make_pair("AB05", sf::Keyboard::Scan::B));
mapping.insert(std::make_pair("AB06", sf::Keyboard::ScanN)); mapping.insert(std::make_pair("AB06", sf::Keyboard::Scan::N));
mapping.insert(std::make_pair("AB07", sf::Keyboard::ScanM)); mapping.insert(std::make_pair("AB07", sf::Keyboard::Scan::M));
mapping.insert(std::make_pair("AB08", sf::Keyboard::ScanComma)); mapping.insert(std::make_pair("AB08", sf::Keyboard::Scan::Comma));
mapping.insert(std::make_pair("AB09", sf::Keyboard::ScanPeriod)); mapping.insert(std::make_pair("AB09", sf::Keyboard::Scan::Period));
mapping.insert(std::make_pair("AB10", sf::Keyboard::ScanSlash)); mapping.insert(std::make_pair("AB10", sf::Keyboard::Scan::Slash));
mapping.insert(std::make_pair("RTSH", sf::Keyboard::ScanRShift)); mapping.insert(std::make_pair("RTSH", sf::Keyboard::Scan::RShift));
mapping.insert(std::make_pair("LCTL", sf::Keyboard::ScanLControl)); mapping.insert(std::make_pair("LCTL", sf::Keyboard::Scan::LControl));
mapping.insert(std::make_pair("LALT", sf::Keyboard::ScanLAlt)); mapping.insert(std::make_pair("LALT", sf::Keyboard::Scan::LAlt));
mapping.insert(std::make_pair("SPCE", sf::Keyboard::ScanSpace)); mapping.insert(std::make_pair("SPCE", sf::Keyboard::Scan::Space));
mapping.insert(std::make_pair("RCTL", sf::Keyboard::ScanRControl)); mapping.insert(std::make_pair("RCTL", sf::Keyboard::Scan::RControl));
mapping.insert(std::make_pair("RALT", sf::Keyboard::ScanRAlt)); mapping.insert(std::make_pair("RALT", sf::Keyboard::Scan::RAlt));
mapping.insert(std::make_pair("LVL3", sf::Keyboard::ScanRAlt)); mapping.insert(std::make_pair("LVL3", sf::Keyboard::Scan::RAlt));
mapping.insert(std::make_pair("ALGR", sf::Keyboard::ScanRAlt)); mapping.insert(std::make_pair("ALGR", sf::Keyboard::Scan::RAlt));
mapping.insert(std::make_pair("LWIN", sf::Keyboard::ScanLSystem)); mapping.insert(std::make_pair("LWIN", sf::Keyboard::Scan::LSystem));
mapping.insert(std::make_pair("RWIN", sf::Keyboard::ScanRSystem)); mapping.insert(std::make_pair("RWIN", sf::Keyboard::Scan::RSystem));
mapping.insert(std::make_pair("HYPR", sf::Keyboard::ScanApplication)); mapping.insert(std::make_pair("HYPR", sf::Keyboard::Scan::Application));
mapping.insert(std::make_pair("EXEC", sf::Keyboard::ScanExecute)); mapping.insert(std::make_pair("EXEC", sf::Keyboard::Scan::Execute));
mapping.insert(std::make_pair("MDSW", sf::Keyboard::ScanModeChange)); mapping.insert(std::make_pair("MDSW", sf::Keyboard::Scan::ModeChange));
mapping.insert(std::make_pair("MENU", sf::Keyboard::ScanMenu)); mapping.insert(std::make_pair("MENU", sf::Keyboard::Scan::Menu));
mapping.insert(std::make_pair("COMP", sf::Keyboard::ScanMenu)); mapping.insert(std::make_pair("COMP", sf::Keyboard::Scan::Menu));
mapping.insert(std::make_pair("SELE", sf::Keyboard::ScanSelect)); mapping.insert(std::make_pair("SELE", sf::Keyboard::Scan::Select));
mapping.insert(std::make_pair("ESC", sf::Keyboard::ScanEscape)); mapping.insert(std::make_pair("ESC", sf::Keyboard::Scan::Escape));
mapping.insert(std::make_pair("FK01", sf::Keyboard::ScanF1)); mapping.insert(std::make_pair("FK01", sf::Keyboard::Scan::F1));
mapping.insert(std::make_pair("FK02", sf::Keyboard::ScanF2)); mapping.insert(std::make_pair("FK02", sf::Keyboard::Scan::F2));
mapping.insert(std::make_pair("FK03", sf::Keyboard::ScanF3)); mapping.insert(std::make_pair("FK03", sf::Keyboard::Scan::F3));
mapping.insert(std::make_pair("FK04", sf::Keyboard::ScanF4)); mapping.insert(std::make_pair("FK04", sf::Keyboard::Scan::F4));
mapping.insert(std::make_pair("FK05", sf::Keyboard::ScanF5)); mapping.insert(std::make_pair("FK05", sf::Keyboard::Scan::F5));
mapping.insert(std::make_pair("FK06", sf::Keyboard::ScanF6)); mapping.insert(std::make_pair("FK06", sf::Keyboard::Scan::F6));
mapping.insert(std::make_pair("FK07", sf::Keyboard::ScanF7)); mapping.insert(std::make_pair("FK07", sf::Keyboard::Scan::F7));
mapping.insert(std::make_pair("FK08", sf::Keyboard::ScanF8)); mapping.insert(std::make_pair("FK08", sf::Keyboard::Scan::F8));
mapping.insert(std::make_pair("FK09", sf::Keyboard::ScanF9)); mapping.insert(std::make_pair("FK09", sf::Keyboard::Scan::F9));
mapping.insert(std::make_pair("FK10", sf::Keyboard::ScanF10)); mapping.insert(std::make_pair("FK10", sf::Keyboard::Scan::F10));
mapping.insert(std::make_pair("FK11", sf::Keyboard::ScanF11)); mapping.insert(std::make_pair("FK11", sf::Keyboard::Scan::F11));
mapping.insert(std::make_pair("FK12", sf::Keyboard::ScanF12)); mapping.insert(std::make_pair("FK12", sf::Keyboard::Scan::F12));
mapping.insert(std::make_pair("PRSC", sf::Keyboard::ScanPrintScreen)); mapping.insert(std::make_pair("PRSC", sf::Keyboard::Scan::PrintScreen));
mapping.insert(std::make_pair("SCLK", sf::Keyboard::ScanScrollLock)); mapping.insert(std::make_pair("SCLK", sf::Keyboard::Scan::ScrollLock));
mapping.insert(std::make_pair("PAUS", sf::Keyboard::ScanPause)); mapping.insert(std::make_pair("PAUS", sf::Keyboard::Scan::Pause));
mapping.insert(std::make_pair("INS", sf::Keyboard::ScanInsert)); mapping.insert(std::make_pair("INS", sf::Keyboard::Scan::Insert));
mapping.insert(std::make_pair("HOME", sf::Keyboard::ScanHome)); mapping.insert(std::make_pair("HOME", sf::Keyboard::Scan::Home));
mapping.insert(std::make_pair("PGUP", sf::Keyboard::ScanPageUp)); mapping.insert(std::make_pair("PGUP", sf::Keyboard::Scan::PageUp));
mapping.insert(std::make_pair("DELE", sf::Keyboard::ScanDelete)); mapping.insert(std::make_pair("DELE", sf::Keyboard::Scan::Delete));
mapping.insert(std::make_pair("END", sf::Keyboard::ScanEnd)); mapping.insert(std::make_pair("END", sf::Keyboard::Scan::End));
mapping.insert(std::make_pair("PGDN", sf::Keyboard::ScanPageDown)); mapping.insert(std::make_pair("PGDN", sf::Keyboard::Scan::PageDown));
mapping.insert(std::make_pair("UP", sf::Keyboard::ScanUp)); mapping.insert(std::make_pair("UP", sf::Keyboard::Scan::Up));
mapping.insert(std::make_pair("RGHT", sf::Keyboard::ScanRight)); mapping.insert(std::make_pair("RGHT", sf::Keyboard::Scan::Right));
mapping.insert(std::make_pair("DOWN", sf::Keyboard::ScanDown)); mapping.insert(std::make_pair("DOWN", sf::Keyboard::Scan::Down));
mapping.insert(std::make_pair("LEFT", sf::Keyboard::ScanLeft)); mapping.insert(std::make_pair("LEFT", sf::Keyboard::Scan::Left));
mapping.insert(std::make_pair("NMLK", sf::Keyboard::ScanNumLock)); mapping.insert(std::make_pair("NMLK", sf::Keyboard::Scan::NumLock));
mapping.insert(std::make_pair("KPDV", sf::Keyboard::ScanNumpadDivide)); mapping.insert(std::make_pair("KPDV", sf::Keyboard::Scan::NumpadDivide));
mapping.insert(std::make_pair("KPMU", sf::Keyboard::ScanNumpadMultiply)); mapping.insert(std::make_pair("KPMU", sf::Keyboard::Scan::NumpadMultiply));
mapping.insert(std::make_pair("KPSU", sf::Keyboard::ScanNumpadMinus)); mapping.insert(std::make_pair("KPSU", sf::Keyboard::Scan::NumpadMinus));
mapping.insert(std::make_pair("KP7", sf::Keyboard::ScanNumpad7)); mapping.insert(std::make_pair("KP7", sf::Keyboard::Scan::Numpad7));
mapping.insert(std::make_pair("KP8", sf::Keyboard::ScanNumpad8)); mapping.insert(std::make_pair("KP8", sf::Keyboard::Scan::Numpad8));
mapping.insert(std::make_pair("KP9", sf::Keyboard::ScanNumpad9)); mapping.insert(std::make_pair("KP9", sf::Keyboard::Scan::Numpad9));
mapping.insert(std::make_pair("KPAD", sf::Keyboard::ScanNumpadPlus)); mapping.insert(std::make_pair("KPAD", sf::Keyboard::Scan::NumpadPlus));
mapping.insert(std::make_pair("KP4", sf::Keyboard::ScanNumpad4)); mapping.insert(std::make_pair("KP4", sf::Keyboard::Scan::Numpad4));
mapping.insert(std::make_pair("KP5", sf::Keyboard::ScanNumpad5)); mapping.insert(std::make_pair("KP5", sf::Keyboard::Scan::Numpad5));
mapping.insert(std::make_pair("KP6", sf::Keyboard::ScanNumpad6)); mapping.insert(std::make_pair("KP6", sf::Keyboard::Scan::Numpad6));
mapping.insert(std::make_pair("KP1", sf::Keyboard::ScanNumpad1)); mapping.insert(std::make_pair("KP1", sf::Keyboard::Scan::Numpad1));
mapping.insert(std::make_pair("KP2", sf::Keyboard::ScanNumpad2)); mapping.insert(std::make_pair("KP2", sf::Keyboard::Scan::Numpad2));
mapping.insert(std::make_pair("KP3", sf::Keyboard::ScanNumpad3)); mapping.insert(std::make_pair("KP3", sf::Keyboard::Scan::Numpad3));
mapping.insert(std::make_pair("KPEN", sf::Keyboard::ScanNumpadEnter)); mapping.insert(std::make_pair("KPEN", sf::Keyboard::Scan::NumpadEnter));
mapping.insert(std::make_pair("KP0", sf::Keyboard::ScanNumpad0)); mapping.insert(std::make_pair("KP0", sf::Keyboard::Scan::Numpad0));
mapping.insert(std::make_pair("KPDL", sf::Keyboard::ScanNumpadDecimal)); mapping.insert(std::make_pair("KPDL", sf::Keyboard::Scan::NumpadDecimal));
mapping.insert(std::make_pair("KPEQ", sf::Keyboard::ScanNumpadEqual)); mapping.insert(std::make_pair("KPEQ", sf::Keyboard::Scan::NumpadEqual));
mapping.insert(std::make_pair("FK13", sf::Keyboard::ScanF13)); mapping.insert(std::make_pair("FK13", sf::Keyboard::Scan::F13));
mapping.insert(std::make_pair("FK14", sf::Keyboard::ScanF14)); mapping.insert(std::make_pair("FK14", sf::Keyboard::Scan::F14));
mapping.insert(std::make_pair("FK15", sf::Keyboard::ScanF15)); mapping.insert(std::make_pair("FK15", sf::Keyboard::Scan::F15));
mapping.insert(std::make_pair("FK16", sf::Keyboard::ScanF16)); mapping.insert(std::make_pair("FK16", sf::Keyboard::Scan::F16));
mapping.insert(std::make_pair("FK17", sf::Keyboard::ScanF17)); mapping.insert(std::make_pair("FK17", sf::Keyboard::Scan::F17));
mapping.insert(std::make_pair("FK18", sf::Keyboard::ScanF18)); mapping.insert(std::make_pair("FK18", sf::Keyboard::Scan::F18));
mapping.insert(std::make_pair("FK19", sf::Keyboard::ScanF19)); mapping.insert(std::make_pair("FK19", sf::Keyboard::Scan::F19));
mapping.insert(std::make_pair("FK20", sf::Keyboard::ScanF20)); mapping.insert(std::make_pair("FK20", sf::Keyboard::Scan::F20));
mapping.insert(std::make_pair("FK21", sf::Keyboard::ScanF21)); mapping.insert(std::make_pair("FK21", sf::Keyboard::Scan::F21));
mapping.insert(std::make_pair("FK22", sf::Keyboard::ScanF22)); mapping.insert(std::make_pair("FK22", sf::Keyboard::Scan::F22));
mapping.insert(std::make_pair("FK23", sf::Keyboard::ScanF23)); mapping.insert(std::make_pair("FK23", sf::Keyboard::Scan::F23));
mapping.insert(std::make_pair("FK24", sf::Keyboard::ScanF24)); mapping.insert(std::make_pair("FK24", sf::Keyboard::Scan::F24));
mapping.insert(std::make_pair("LMTA", sf::Keyboard::ScanLSystem)); mapping.insert(std::make_pair("LMTA", sf::Keyboard::Scan::LSystem));
mapping.insert(std::make_pair("RMTA", sf::Keyboard::ScanRSystem)); mapping.insert(std::make_pair("RMTA", sf::Keyboard::Scan::RSystem));
mapping.insert(std::make_pair("MUTE", sf::Keyboard::ScanVolumeMute)); mapping.insert(std::make_pair("MUTE", sf::Keyboard::Scan::VolumeMute));
mapping.insert(std::make_pair("VOL-", sf::Keyboard::ScanVolumeDown)); mapping.insert(std::make_pair("VOL-", sf::Keyboard::Scan::VolumeDown));
mapping.insert(std::make_pair("VOL+", sf::Keyboard::ScanVolumeUp)); mapping.insert(std::make_pair("VOL+", sf::Keyboard::Scan::VolumeUp));
mapping.insert(std::make_pair("STOP", sf::Keyboard::ScanStop)); mapping.insert(std::make_pair("STOP", sf::Keyboard::Scan::Stop));
mapping.insert(std::make_pair("REDO", sf::Keyboard::ScanRedo)); mapping.insert(std::make_pair("REDO", sf::Keyboard::Scan::Redo));
mapping.insert(std::make_pair("AGAI", sf::Keyboard::ScanRedo)); mapping.insert(std::make_pair("AGAI", sf::Keyboard::Scan::Redo));
mapping.insert(std::make_pair("UNDO", sf::Keyboard::ScanUndo)); mapping.insert(std::make_pair("UNDO", sf::Keyboard::Scan::Undo));
mapping.insert(std::make_pair("COPY", sf::Keyboard::ScanCopy)); mapping.insert(std::make_pair("COPY", sf::Keyboard::Scan::Copy));
mapping.insert(std::make_pair("PAST", sf::Keyboard::ScanPaste)); mapping.insert(std::make_pair("PAST", sf::Keyboard::Scan::Paste));
mapping.insert(std::make_pair("FIND", sf::Keyboard::ScanSearch)); mapping.insert(std::make_pair("FIND", sf::Keyboard::Scan::Search));
mapping.insert(std::make_pair("CUT", sf::Keyboard::ScanCut)); mapping.insert(std::make_pair("CUT", sf::Keyboard::Scan::Cut));
mapping.insert(std::make_pair("HELP", sf::Keyboard::ScanHelp)); mapping.insert(std::make_pair("HELP", sf::Keyboard::Scan::Help));
mapping.insert(std::make_pair("I156", sf::Keyboard::ScanLaunchApplication1)); mapping.insert(std::make_pair("I156", sf::Keyboard::Scan::LaunchApplication1));
mapping.insert(std::make_pair("I157", sf::Keyboard::ScanLaunchApplication2)); mapping.insert(std::make_pair("I157", sf::Keyboard::Scan::LaunchApplication2));
mapping.insert(std::make_pair("I164", sf::Keyboard::ScanFavorites)); mapping.insert(std::make_pair("I164", sf::Keyboard::Scan::Favorites));
mapping.insert(std::make_pair("I166", sf::Keyboard::ScanBack)); mapping.insert(std::make_pair("I166", sf::Keyboard::Scan::Back));
mapping.insert(std::make_pair("I167", sf::Keyboard::ScanForward)); mapping.insert(std::make_pair("I167", sf::Keyboard::Scan::Forward));
mapping.insert(std::make_pair("I171", sf::Keyboard::ScanMediaNextTrack)); mapping.insert(std::make_pair("I171", sf::Keyboard::Scan::MediaNextTrack));
mapping.insert(std::make_pair("I172", sf::Keyboard::ScanMediaPlayPause)); mapping.insert(std::make_pair("I172", sf::Keyboard::Scan::MediaPlayPause));
mapping.insert(std::make_pair("I173", sf::Keyboard::ScanMediaPreviousTrack)); mapping.insert(std::make_pair("I173", sf::Keyboard::Scan::MediaPreviousTrack));
mapping.insert(std::make_pair("I174", sf::Keyboard::ScanMediaStop)); mapping.insert(std::make_pair("I174", sf::Keyboard::Scan::MediaStop));
mapping.insert(std::make_pair("I180", sf::Keyboard::ScanHomePage)); mapping.insert(std::make_pair("I180", sf::Keyboard::Scan::HomePage));
mapping.insert(std::make_pair("I181", sf::Keyboard::ScanRefresh)); mapping.insert(std::make_pair("I181", sf::Keyboard::Scan::Refresh));
mapping.insert(std::make_pair("I223", sf::Keyboard::ScanLaunchMail)); mapping.insert(std::make_pair("I223", sf::Keyboard::Scan::LaunchMail));
mapping.insert(std::make_pair("I234", sf::Keyboard::ScanLaunchMediaSelect)); mapping.insert(std::make_pair("I234", sf::Keyboard::Scan::LaunchMediaSelect));
return mapping; return mapping;
} }
@ -452,11 +452,11 @@ void ensureMapping()
return; return;
// Phase 1: Initialize mappings with default values // Phase 1: Initialize mappings with default values
for (int i = 0; i < sf::Keyboard::ScancodeCount; ++i) for (int i = 0; i < sf::Keyboard::Scan::ScancodeCount; ++i)
scancodeToKeycode[i] = NullKeyCode; scancodeToKeycode[i] = NullKeyCode;
for (int i = 0; i < MaxKeyCode; ++i) for (int i = 0; i < MaxKeyCode; ++i)
keycodeToScancode[i] = sf::Keyboard::ScanUnknown; keycodeToScancode[i] = sf::Keyboard::Scan::Unknown;
// Phase 2: Get XKB names with key code // Phase 2: Get XKB names with key code
Display* display = sf::priv::OpenDisplay(); Display* display = sf::priv::OpenDisplay();
@ -466,7 +466,7 @@ void ensureMapping()
XkbGetNames(display, XkbKeyNamesMask, descriptor); XkbGetNames(display, XkbKeyNamesMask, descriptor);
std::map<std::string, sf::Keyboard::Scancode> nameScancodeMap = GetNameScancodeMap(); std::map<std::string, sf::Keyboard::Scancode> nameScancodeMap = GetNameScancodeMap();
sf::Keyboard::Scancode scancode = sf::Keyboard::ScanUnknown; sf::Keyboard::Scancode scancode = sf::Keyboard::Scan::Unknown;
for (int keycode = descriptor->min_key_code; keycode <= descriptor->max_key_code; ++keycode) for (int keycode = descriptor->min_key_code; keycode <= descriptor->max_key_code; ++keycode)
{ {
@ -479,12 +479,12 @@ void ensureMapping()
name[XkbKeyNameLength] = '\0'; name[XkbKeyNameLength] = '\0';
std::map<std::string, sf::Keyboard::Scancode>::iterator mappedScancode = nameScancodeMap.find(std::string(name)); std::map<std::string, sf::Keyboard::Scancode>::iterator mappedScancode = nameScancodeMap.find(std::string(name));
scancode = sf::Keyboard::ScanUnknown; scancode = sf::Keyboard::Scan::Unknown;
if (mappedScancode != nameScancodeMap.end()) if (mappedScancode != nameScancodeMap.end())
scancode = mappedScancode->second; scancode = mappedScancode->second;
if (scancode != sf::Keyboard::ScanUnknown) if (scancode != sf::Keyboard::Scan::Unknown)
scancodeToKeycode[scancode] = static_cast<KeyCode>(keycode); scancodeToKeycode[scancode] = static_cast<KeyCode>(keycode);
keycodeToScancode[keycode] = scancode; keycodeToScancode[keycode] = scancode;
@ -496,7 +496,7 @@ void ensureMapping()
// Phase 3: Translate un-translated keycodes using traditional X11 KeySym lookups // Phase 3: Translate un-translated keycodes using traditional X11 KeySym lookups
for (int keycode = 8; keycode < MaxKeyCode; ++keycode) for (int keycode = 8; keycode < MaxKeyCode; ++keycode)
{ {
if (keycodeToScancode[static_cast<KeyCode>(keycode)] == sf::Keyboard::ScanUnknown) if (keycodeToScancode[static_cast<KeyCode>(keycode)] == sf::Keyboard::Scan::Unknown)
{ {
scancode = translateKeyCode(display, static_cast<KeyCode>(keycode)); scancode = translateKeyCode(display, static_cast<KeyCode>(keycode));
@ -518,7 +518,7 @@ KeyCode scancodeToKeyCode(sf::Keyboard::Scancode code)
{ {
ensureMapping(); ensureMapping();
if (code != sf::Keyboard::ScanUnknown) if (code != sf::Keyboard::Scan::Unknown)
return scancodeToKeycode[code]; return scancodeToKeycode[code];
return NullKeyCode; return NullKeyCode;
@ -533,7 +533,7 @@ sf::Keyboard::Scancode keyCodeToScancode(KeyCode code)
if (isValidKeycode(code)) if (isValidKeycode(code))
return keycodeToScancode[code]; return keycodeToScancode[code];
return sf::Keyboard::ScanUnknown; return sf::Keyboard::Scan::Unknown;
} }
@ -643,21 +643,21 @@ String KeyboardImpl::getDescription(Keyboard::Scancode code)
// these scancodes actually correspond to keys with input // these scancodes actually correspond to keys with input
// but we want to return their description, not their behaviour // but we want to return their description, not their behaviour
if (code == Keyboard::ScanEnter || if (code == Keyboard::Scan::Enter ||
code == Keyboard::ScanEscape || code == Keyboard::Scan::Escape ||
code == Keyboard::ScanBackspace || code == Keyboard::Scan::Backspace ||
code == Keyboard::ScanTab || code == Keyboard::Scan::Tab ||
code == Keyboard::ScanSpace || code == Keyboard::Scan::Space ||
code == Keyboard::ScanScrollLock || code == Keyboard::Scan::ScrollLock ||
code == Keyboard::ScanPause || code == Keyboard::Scan::Pause ||
code == Keyboard::ScanDelete || code == Keyboard::Scan::Delete ||
code == Keyboard::ScanNumpadDivide || code == Keyboard::Scan::NumpadDivide ||
code == Keyboard::ScanNumpadMultiply || code == Keyboard::Scan::NumpadMultiply ||
code == Keyboard::ScanNumpadMinus || code == Keyboard::Scan::NumpadMinus ||
code == Keyboard::ScanNumpadPlus || code == Keyboard::Scan::NumpadPlus ||
code == Keyboard::ScanNumpadEqual || code == Keyboard::Scan::NumpadEqual ||
code == Keyboard::ScanNumpadEnter || code == Keyboard::Scan::NumpadEnter ||
code == Keyboard::ScanNumpadDecimal) code == Keyboard::Scan::NumpadDecimal)
{ {
checkInput = false; checkInput = false;
} }
@ -674,113 +674,113 @@ String KeyboardImpl::getDescription(Keyboard::Scancode code)
// Fallback to our best guess for the keys that are known to be independent of the layout. // Fallback to our best guess for the keys that are known to be independent of the layout.
switch (code) switch (code)
{ {
case Keyboard::ScanEnter: return "Enter"; case Keyboard::Scan::Enter: return "Enter";
case Keyboard::ScanEscape: return "Escape"; case Keyboard::Scan::Escape: return "Escape";
case Keyboard::ScanBackspace: return "Backspace"; case Keyboard::Scan::Backspace: return "Backspace";
case Keyboard::ScanTab: return "Tab"; case Keyboard::Scan::Tab: return "Tab";
case Keyboard::ScanSpace: return "Space"; case Keyboard::Scan::Space: return "Space";
case Keyboard::ScanF1: return "F1"; case Keyboard::Scan::F1: return "F1";
case Keyboard::ScanF2: return "F2"; case Keyboard::Scan::F2: return "F2";
case Keyboard::ScanF3: return "F3"; case Keyboard::Scan::F3: return "F3";
case Keyboard::ScanF4: return "F4"; case Keyboard::Scan::F4: return "F4";
case Keyboard::ScanF5: return "F5"; case Keyboard::Scan::F5: return "F5";
case Keyboard::ScanF6: return "F6"; case Keyboard::Scan::F6: return "F6";
case Keyboard::ScanF7: return "F7"; case Keyboard::Scan::F7: return "F7";
case Keyboard::ScanF8: return "F8"; case Keyboard::Scan::F8: return "F8";
case Keyboard::ScanF9: return "F9"; case Keyboard::Scan::F9: return "F9";
case Keyboard::ScanF10: return "F10"; case Keyboard::Scan::F10: return "F10";
case Keyboard::ScanF11: return "F11"; case Keyboard::Scan::F11: return "F11";
case Keyboard::ScanF12: return "F12"; case Keyboard::Scan::F12: return "F12";
case Keyboard::ScanF13: return "F13"; case Keyboard::Scan::F13: return "F13";
case Keyboard::ScanF14: return "F14"; case Keyboard::Scan::F14: return "F14";
case Keyboard::ScanF15: return "F15"; case Keyboard::Scan::F15: return "F15";
case Keyboard::ScanF16: return "F16"; case Keyboard::Scan::F16: return "F16";
case Keyboard::ScanF17: return "F17"; case Keyboard::Scan::F17: return "F17";
case Keyboard::ScanF18: return "F18"; case Keyboard::Scan::F18: return "F18";
case Keyboard::ScanF19: return "F19"; case Keyboard::Scan::F19: return "F19";
case Keyboard::ScanF20: return "F20"; case Keyboard::Scan::F20: return "F20";
case Keyboard::ScanF21: return "F21"; case Keyboard::Scan::F21: return "F21";
case Keyboard::ScanF22: return "F22"; case Keyboard::Scan::F22: return "F22";
case Keyboard::ScanF23: return "F23"; case Keyboard::Scan::F23: return "F23";
case Keyboard::ScanF24: return "F24"; case Keyboard::Scan::F24: return "F24";
case Keyboard::ScanCapsLock: return "Caps Lock"; case Keyboard::Scan::CapsLock: return "Caps Lock";
case Keyboard::ScanPrintScreen: return "Print Screen"; case Keyboard::Scan::PrintScreen: return "Print Screen";
case Keyboard::ScanScrollLock: return "Scroll Lock"; case Keyboard::Scan::ScrollLock: return "Scroll Lock";
case Keyboard::ScanPause: return "Pause"; case Keyboard::Scan::Pause: return "Pause";
case Keyboard::ScanInsert: return "Insert"; case Keyboard::Scan::Insert: return "Insert";
case Keyboard::ScanHome: return "Home"; case Keyboard::Scan::Home: return "Home";
case Keyboard::ScanPageUp: return "Page Up"; case Keyboard::Scan::PageUp: return "Page Up";
case Keyboard::ScanDelete: return "Delete"; case Keyboard::Scan::Delete: return "Delete";
case Keyboard::ScanEnd: return "End"; case Keyboard::Scan::End: return "End";
case Keyboard::ScanPageDown: return "Page Down"; case Keyboard::Scan::PageDown: return "Page Down";
case Keyboard::ScanLeft: return "Left Arrow"; case Keyboard::Scan::Left: return "Left Arrow";
case Keyboard::ScanRight: return "Right Arrow"; case Keyboard::Scan::Right: return "Right Arrow";
case Keyboard::ScanDown: return "Down Arrow"; case Keyboard::Scan::Down: return "Down Arrow";
case Keyboard::ScanUp: return "Up Arrow"; case Keyboard::Scan::Up: return "Up Arrow";
case Keyboard::ScanNumLock: return "Num Lock"; case Keyboard::Scan::NumLock: return "Num Lock";
case Keyboard::ScanNumpadDivide: return "Divide (Numpad)"; case Keyboard::Scan::NumpadDivide: return "Divide (Numpad)";
case Keyboard::ScanNumpadMultiply: return "Multiply (Numpad)"; case Keyboard::Scan::NumpadMultiply: return "Multiply (Numpad)";
case Keyboard::ScanNumpadMinus: return "Minus (Numpad)"; case Keyboard::Scan::NumpadMinus: return "Minus (Numpad)";
case Keyboard::ScanNumpadPlus: return "Plus (Numpad)"; case Keyboard::Scan::NumpadPlus: return "Plus (Numpad)";
case Keyboard::ScanNumpadEqual: return "Equal (Numpad)"; case Keyboard::Scan::NumpadEqual: return "Equal (Numpad)";
case Keyboard::ScanNumpadEnter: return "Enter (Numpad)"; case Keyboard::Scan::NumpadEnter: return "Enter (Numpad)";
case Keyboard::ScanNumpadDecimal: return "Decimal (Numpad)"; case Keyboard::Scan::NumpadDecimal: return "Decimal (Numpad)";
case Keyboard::ScanNumpad0: return "0 (Numpad)"; case Keyboard::Scan::Numpad0: return "0 (Numpad)";
case Keyboard::ScanNumpad1: return "1 (Numpad)"; case Keyboard::Scan::Numpad1: return "1 (Numpad)";
case Keyboard::ScanNumpad2: return "2 (Numpad)"; case Keyboard::Scan::Numpad2: return "2 (Numpad)";
case Keyboard::ScanNumpad3: return "3 (Numpad)"; case Keyboard::Scan::Numpad3: return "3 (Numpad)";
case Keyboard::ScanNumpad4: return "4 (Numpad)"; case Keyboard::Scan::Numpad4: return "4 (Numpad)";
case Keyboard::ScanNumpad5: return "5 (Numpad)"; case Keyboard::Scan::Numpad5: return "5 (Numpad)";
case Keyboard::ScanNumpad6: return "6 (Numpad)"; case Keyboard::Scan::Numpad6: return "6 (Numpad)";
case Keyboard::ScanNumpad7: return "7 (Numpad)"; case Keyboard::Scan::Numpad7: return "7 (Numpad)";
case Keyboard::ScanNumpad8: return "8 (Numpad)"; case Keyboard::Scan::Numpad8: return "8 (Numpad)";
case Keyboard::ScanNumpad9: return "9 (Numpad)"; case Keyboard::Scan::Numpad9: return "9 (Numpad)";
case Keyboard::ScanApplication: return "Application"; case Keyboard::Scan::Application: return "Application";
case Keyboard::ScanExecute: return "Execute"; case Keyboard::Scan::Execute: return "Execute";
case Keyboard::ScanHelp: return "Help"; case Keyboard::Scan::Help: return "Help";
case Keyboard::ScanMenu: return "Menu"; case Keyboard::Scan::Menu: return "Menu";
case Keyboard::ScanSelect: return "Select"; case Keyboard::Scan::Select: return "Select";
case Keyboard::ScanStop: return "Stop"; case Keyboard::Scan::Stop: return "Stop";
case Keyboard::ScanRedo: return "Redo"; case Keyboard::Scan::Redo: return "Redo";
case Keyboard::ScanUndo: return "Undo"; case Keyboard::Scan::Undo: return "Undo";
case Keyboard::ScanCut: return "Cut"; case Keyboard::Scan::Cut: return "Cut";
case Keyboard::ScanCopy: return "Copy"; case Keyboard::Scan::Copy: return "Copy";
case Keyboard::ScanPaste: return "Paste"; case Keyboard::Scan::Paste: return "Paste";
case Keyboard::ScanSearch: return "Search"; case Keyboard::Scan::Search: return "Search";
case Keyboard::ScanVolumeMute: return "Volume Mute"; case Keyboard::Scan::VolumeMute: return "Volume Mute";
case Keyboard::ScanVolumeUp: return "Volume Up"; case Keyboard::Scan::VolumeUp: return "Volume Up";
case Keyboard::ScanVolumeDown: return "Volume Down"; case Keyboard::Scan::VolumeDown: return "Volume Down";
case Keyboard::ScanLControl: return "Left Control"; case Keyboard::Scan::LControl: return "Left Control";
case Keyboard::ScanLShift: return "Left Shift"; case Keyboard::Scan::LShift: return "Left Shift";
case Keyboard::ScanLAlt: return "Left Alt"; case Keyboard::Scan::LAlt: return "Left Alt";
case Keyboard::ScanLSystem: return "Left System"; case Keyboard::Scan::LSystem: return "Left System";
case Keyboard::ScanRControl: return "Right Control"; case Keyboard::Scan::RControl: return "Right Control";
case Keyboard::ScanRShift: return "Right Shift"; case Keyboard::Scan::RShift: return "Right Shift";
case Keyboard::ScanRAlt: return "Right Alt"; case Keyboard::Scan::RAlt: return "Right Alt";
case Keyboard::ScanRSystem: return "Right System"; case Keyboard::Scan::RSystem: return "Right System";
case Keyboard::ScanLaunchApplication1: return "Launch Application 1"; case Keyboard::Scan::LaunchApplication1: return "Launch Application 1";
case Keyboard::ScanLaunchApplication2: return "Launch Application 2"; case Keyboard::Scan::LaunchApplication2: return "Launch Application 2";
case Keyboard::ScanFavorites: return "Favorites"; case Keyboard::Scan::Favorites: return "Favorites";
case Keyboard::ScanBack: return "Back"; case Keyboard::Scan::Back: return "Back";
case Keyboard::ScanForward: return "Forward"; case Keyboard::Scan::Forward: return "Forward";
case Keyboard::ScanMediaNextTrack: return "Media Next Track"; case Keyboard::Scan::MediaNextTrack: return "Media Next Track";
case Keyboard::ScanMediaPlayPause: return "Media Play Pause"; case Keyboard::Scan::MediaPlayPause: return "Media Play Pause";
case Keyboard::ScanMediaPreviousTrack: return "Media Previous Track"; case Keyboard::Scan::MediaPreviousTrack: return "Media Previous Track";
case Keyboard::ScanMediaStop: return "Media Stop"; case Keyboard::Scan::MediaStop: return "Media Stop";
case Keyboard::ScanHomePage: return "Home Page"; case Keyboard::Scan::HomePage: return "Home Page";
case Keyboard::ScanRefresh: return "Refresh"; case Keyboard::Scan::Refresh: return "Refresh";
case Keyboard::ScanLaunchMail: return "Launch Mail"; case Keyboard::Scan::LaunchMail: return "Launch Mail";
case Keyboard::ScanLaunchMediaSelect: return "Launch Media Select"; case Keyboard::Scan::LaunchMediaSelect: return "Launch Media Select";
default: return "Unknown Scancode"; default: return "Unknown Scancode";
} }

View File

@ -42,8 +42,8 @@ namespace sf
namespace priv namespace priv
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Keyboard::Scancode InputImpl::m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode Keyboard::Scancode InputImpl::m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode
Keyboard::Key InputImpl::m_scancodeToKeyMapping[Keyboard::ScancodeCount]; ///< Mapping from Scancode to Key Keyboard::Key InputImpl::m_scancodeToKeyMapping[Keyboard::Scan::ScancodeCount]; ///< Mapping from Scancode to Key
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Keyboard::Key virtualKeyToSfKey(UINT virtualKey) Keyboard::Key virtualKeyToSfKey(UINT virtualKey)
@ -276,163 +276,163 @@ WORD sfScanToWinScan(Keyboard::Scancode code)
// Reference: https://msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx // Reference: https://msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx
switch (code) switch (code)
{ {
case Keyboard::ScanA: return 0x1E; case Keyboard::Scan::A: return 0x1E;
case Keyboard::ScanB: return 0x30; case Keyboard::Scan::B: return 0x30;
case Keyboard::ScanC: return 0x2E; case Keyboard::Scan::C: return 0x2E;
case Keyboard::ScanD: return 0x20; case Keyboard::Scan::D: return 0x20;
case Keyboard::ScanE: return 0x12; case Keyboard::Scan::E: return 0x12;
case Keyboard::ScanF: return 0x21; case Keyboard::Scan::F: return 0x21;
case Keyboard::ScanG: return 0x22; case Keyboard::Scan::G: return 0x22;
case Keyboard::ScanH: return 0x23; case Keyboard::Scan::H: return 0x23;
case Keyboard::ScanI: return 0x17; case Keyboard::Scan::I: return 0x17;
case Keyboard::ScanJ: return 0x24; case Keyboard::Scan::J: return 0x24;
case Keyboard::ScanK: return 0x25; case Keyboard::Scan::K: return 0x25;
case Keyboard::ScanL: return 0x26; case Keyboard::Scan::L: return 0x26;
case Keyboard::ScanM: return 0x32; case Keyboard::Scan::M: return 0x32;
case Keyboard::ScanN: return 0x31; case Keyboard::Scan::N: return 0x31;
case Keyboard::ScanO: return 0x18; case Keyboard::Scan::O: return 0x18;
case Keyboard::ScanP: return 0x19; case Keyboard::Scan::P: return 0x19;
case Keyboard::ScanQ: return 0x10; case Keyboard::Scan::Q: return 0x10;
case Keyboard::ScanR: return 0x13; case Keyboard::Scan::R: return 0x13;
case Keyboard::ScanS: return 0x1F; case Keyboard::Scan::S: return 0x1F;
case Keyboard::ScanT: return 0x14; case Keyboard::Scan::T: return 0x14;
case Keyboard::ScanU: return 0x16; case Keyboard::Scan::U: return 0x16;
case Keyboard::ScanV: return 0x2F; case Keyboard::Scan::V: return 0x2F;
case Keyboard::ScanW: return 0x11; case Keyboard::Scan::W: return 0x11;
case Keyboard::ScanX: return 0x2D; case Keyboard::Scan::X: return 0x2D;
case Keyboard::ScanY: return 0x15; case Keyboard::Scan::Y: return 0x15;
case Keyboard::ScanZ: return 0x2C; case Keyboard::Scan::Z: return 0x2C;
case Keyboard::ScanNum1: return 0x02; case Keyboard::Scan::Num1: return 0x02;
case Keyboard::ScanNum2: return 0x03; case Keyboard::Scan::Num2: return 0x03;
case Keyboard::ScanNum3: return 0x04; case Keyboard::Scan::Num3: return 0x04;
case Keyboard::ScanNum4: return 0x05; case Keyboard::Scan::Num4: return 0x05;
case Keyboard::ScanNum5: return 0x06; case Keyboard::Scan::Num5: return 0x06;
case Keyboard::ScanNum6: return 0x07; case Keyboard::Scan::Num6: return 0x07;
case Keyboard::ScanNum7: return 0x08; case Keyboard::Scan::Num7: return 0x08;
case Keyboard::ScanNum8: return 0x09; case Keyboard::Scan::Num8: return 0x09;
case Keyboard::ScanNum9: return 0x0A; case Keyboard::Scan::Num9: return 0x0A;
case Keyboard::ScanNum0: return 0x0B; case Keyboard::Scan::Num0: return 0x0B;
case Keyboard::ScanEnter: return 0x1C; case Keyboard::Scan::Enter: return 0x1C;
case Keyboard::ScanEscape: return 0x01; case Keyboard::Scan::Escape: return 0x01;
case Keyboard::ScanBackspace: return 0x0E; case Keyboard::Scan::Backspace: return 0x0E;
case Keyboard::ScanTab: return 0x0F; case Keyboard::Scan::Tab: return 0x0F;
case Keyboard::ScanSpace: return 0x39; case Keyboard::Scan::Space: return 0x39;
case Keyboard::ScanHyphen: return 0x0C; case Keyboard::Scan::Hyphen: return 0x0C;
case Keyboard::ScanEqual: return 0x0D; case Keyboard::Scan::Equal: return 0x0D;
case Keyboard::ScanLBracket: return 0x1A; case Keyboard::Scan::LBracket: return 0x1A;
case Keyboard::ScanRBracket: return 0x1B; case Keyboard::Scan::RBracket: return 0x1B;
case Keyboard::ScanBackslash: return 0x2B; case Keyboard::Scan::Backslash: return 0x2B;
case Keyboard::ScanSemicolon: return 0x27; case Keyboard::Scan::Semicolon: return 0x27;
case Keyboard::ScanApostrophe: return 0x28; case Keyboard::Scan::Apostrophe: return 0x28;
case Keyboard::ScanGrave: return 0x29; case Keyboard::Scan::Grave: return 0x29;
case Keyboard::ScanComma: return 0x33; case Keyboard::Scan::Comma: return 0x33;
case Keyboard::ScanPeriod: return 0x34; case Keyboard::Scan::Period: return 0x34;
case Keyboard::ScanSlash: return 0x35; case Keyboard::Scan::Slash: return 0x35;
case Keyboard::ScanF1: return 0x3B; case Keyboard::Scan::F1: return 0x3B;
case Keyboard::ScanF2: return 0x3C; case Keyboard::Scan::F2: return 0x3C;
case Keyboard::ScanF3: return 0x3D; case Keyboard::Scan::F3: return 0x3D;
case Keyboard::ScanF4: return 0x3E; case Keyboard::Scan::F4: return 0x3E;
case Keyboard::ScanF5: return 0x3F; case Keyboard::Scan::F5: return 0x3F;
case Keyboard::ScanF6: return 0x40; case Keyboard::Scan::F6: return 0x40;
case Keyboard::ScanF7: return 0x41; case Keyboard::Scan::F7: return 0x41;
case Keyboard::ScanF8: return 0x42; case Keyboard::Scan::F8: return 0x42;
case Keyboard::ScanF9: return 0x43; case Keyboard::Scan::F9: return 0x43;
case Keyboard::ScanF10: return 0x44; case Keyboard::Scan::F10: return 0x44;
case Keyboard::ScanF11: return 0x57; case Keyboard::Scan::F11: return 0x57;
case Keyboard::ScanF12: return 0x58; case Keyboard::Scan::F12: return 0x58;
case Keyboard::ScanF13: return 0x64; case Keyboard::Scan::F13: return 0x64;
case Keyboard::ScanF14: return 0x65; case Keyboard::Scan::F14: return 0x65;
case Keyboard::ScanF15: return 0x66; case Keyboard::Scan::F15: return 0x66;
case Keyboard::ScanF16: return 0x67; case Keyboard::Scan::F16: return 0x67;
case Keyboard::ScanF17: return 0x68; case Keyboard::Scan::F17: return 0x68;
case Keyboard::ScanF18: return 0x69; case Keyboard::Scan::F18: return 0x69;
case Keyboard::ScanF19: return 0x6A; case Keyboard::Scan::F19: return 0x6A;
case Keyboard::ScanF20: return 0x6B; case Keyboard::Scan::F20: return 0x6B;
case Keyboard::ScanF21: return 0x6C; case Keyboard::Scan::F21: return 0x6C;
case Keyboard::ScanF22: return 0x6D; case Keyboard::Scan::F22: return 0x6D;
case Keyboard::ScanF23: return 0x6E; case Keyboard::Scan::F23: return 0x6E;
case Keyboard::ScanF24: return 0x76; case Keyboard::Scan::F24: return 0x76;
case Keyboard::ScanCapsLock: return 0x3A; case Keyboard::Scan::CapsLock: return 0x3A;
case Keyboard::ScanPrintScreen: return 0xE037; case Keyboard::Scan::PrintScreen: return 0xE037;
case Keyboard::ScanScrollLock: return 0x46; case Keyboard::Scan::ScrollLock: return 0x46;
case Keyboard::ScanPause: return 0x45; case Keyboard::Scan::Pause: return 0x45;
case Keyboard::ScanInsert: return 0xE052; case Keyboard::Scan::Insert: return 0xE052;
case Keyboard::ScanHome: return 0xE047; case Keyboard::Scan::Home: return 0xE047;
case Keyboard::ScanPageUp: return 0xE049; case Keyboard::Scan::PageUp: return 0xE049;
case Keyboard::ScanDelete: return 0xE053; case Keyboard::Scan::Delete: return 0xE053;
case Keyboard::ScanEnd: return 0xE04F; case Keyboard::Scan::End: return 0xE04F;
case Keyboard::ScanPageDown: return 0xE051; case Keyboard::Scan::PageDown: return 0xE051;
case Keyboard::ScanRight: return 0xE04D; case Keyboard::Scan::Right: return 0xE04D;
case Keyboard::ScanLeft: return 0xE04B; case Keyboard::Scan::Left: return 0xE04B;
case Keyboard::ScanDown: return 0xE050; case Keyboard::Scan::Down: return 0xE050;
case Keyboard::ScanUp: return 0xE048; case Keyboard::Scan::Up: return 0xE048;
case Keyboard::ScanNumLock: return 0xE045; case Keyboard::Scan::NumLock: return 0xE045;
case Keyboard::ScanNumpadDivide: return 0xE035; case Keyboard::Scan::NumpadDivide: return 0xE035;
case Keyboard::ScanNumpadMultiply: return 0x37; case Keyboard::Scan::NumpadMultiply: return 0x37;
case Keyboard::ScanNumpadMinus: return 0xA4; case Keyboard::Scan::NumpadMinus: return 0xA4;
case Keyboard::ScanNumpadPlus: return 0x4E; case Keyboard::Scan::NumpadPlus: return 0x4E;
case Keyboard::ScanNumpadEqual: return 0x7E; case Keyboard::Scan::NumpadEqual: return 0x7E;
case Keyboard::ScanNumpadEnter: return 0xE01C; case Keyboard::Scan::NumpadEnter: return 0xE01C;
case Keyboard::ScanNumpadDecimal: return 0x53; case Keyboard::Scan::NumpadDecimal: return 0x53;
case Keyboard::ScanNumpad1: return 0x4F; case Keyboard::Scan::Numpad1: return 0x4F;
case Keyboard::ScanNumpad2: return 0x50; case Keyboard::Scan::Numpad2: return 0x50;
case Keyboard::ScanNumpad3: return 0x51; case Keyboard::Scan::Numpad3: return 0x51;
case Keyboard::ScanNumpad4: return 0x4B; case Keyboard::Scan::Numpad4: return 0x4B;
case Keyboard::ScanNumpad5: return 0x4C; case Keyboard::Scan::Numpad5: return 0x4C;
case Keyboard::ScanNumpad6: return 0x4D; case Keyboard::Scan::Numpad6: return 0x4D;
case Keyboard::ScanNumpad7: return 0x47; case Keyboard::Scan::Numpad7: return 0x47;
case Keyboard::ScanNumpad8: return 0x48; case Keyboard::Scan::Numpad8: return 0x48;
case Keyboard::ScanNumpad9: return 0x49; case Keyboard::Scan::Numpad9: return 0x49;
case Keyboard::ScanNumpad0: return 0x52; case Keyboard::Scan::Numpad0: return 0x52;
case Keyboard::ScanNonUsBackslash: return 0x56; case Keyboard::Scan::NonUsBackslash: return 0x56;
// No known scancode for Keyboard::ScanApplication // No known scancode for Keyboard::Scan::Application
// No known scancode for Keyboard::ScanExecute // No known scancode for Keyboard::Scan::Execute
// No known scancode for Keyboard::ScanModeChange // No known scancode for Keyboard::Scan::ModeChange
case Keyboard::ScanHelp: return 0xE061; case Keyboard::Scan::Help: return 0xE061;
case Keyboard::ScanMenu: return 0xE05D; case Keyboard::Scan::Menu: return 0xE05D;
case Keyboard::ScanSelect: return 0xE01E; case Keyboard::Scan::Select: return 0xE01E;
// No known scancode for Keyboard::ScanRedo // No known scancode for Keyboard::Scan::Redo
// No known scancode for Keyboard::ScanUndo // No known scancode for Keyboard::Scan::Undo
// No known scancode for Keyboard::ScanCut // No known scancode for Keyboard::Scan::Cut
// No known scancode for Keyboard::ScanCopy // No known scancode for Keyboard::Scan::Copy
// No known scancode for Keyboard::ScanPaste // No known scancode for Keyboard::Scan::Paste
case Keyboard::ScanVolumeMute: return 0xE020; case Keyboard::Scan::VolumeMute: return 0xE020;
case Keyboard::ScanVolumeUp: return 0xE02E; case Keyboard::Scan::VolumeUp: return 0xE02E;
case Keyboard::ScanVolumeDown: return 0xE02C; case Keyboard::Scan::VolumeDown: return 0xE02C;
case Keyboard::ScanMediaPlayPause: return 0xE022; case Keyboard::Scan::MediaPlayPause: return 0xE022;
case Keyboard::ScanMediaStop: return 0xE024; case Keyboard::Scan::MediaStop: return 0xE024;
case Keyboard::ScanMediaNextTrack: return 0xE019; case Keyboard::Scan::MediaNextTrack: return 0xE019;
case Keyboard::ScanMediaPreviousTrack: return 0xE010; case Keyboard::Scan::MediaPreviousTrack: return 0xE010;
case Keyboard::ScanLControl: return 0x1D; case Keyboard::Scan::LControl: return 0x1D;
case Keyboard::ScanLShift: return 0x2A; case Keyboard::Scan::LShift: return 0x2A;
case Keyboard::ScanLAlt: return 0x38; case Keyboard::Scan::LAlt: return 0x38;
case Keyboard::ScanLSystem: return 0xE05B; case Keyboard::Scan::LSystem: return 0xE05B;
case Keyboard::ScanRControl: return 0xE01D; case Keyboard::Scan::RControl: return 0xE01D;
case Keyboard::ScanRShift: return 0x36; case Keyboard::Scan::RShift: return 0x36;
case Keyboard::ScanRAlt: return 0xE038; case Keyboard::Scan::RAlt: return 0xE038;
case Keyboard::ScanRSystem: return 0xE05C; case Keyboard::Scan::RSystem: return 0xE05C;
case Keyboard::ScanBack: return 0xE06A; case Keyboard::Scan::Back: return 0xE06A;
case Keyboard::ScanForward: return 0xE069; case Keyboard::Scan::Forward: return 0xE069;
case Keyboard::ScanRefresh: return 0xE067; case Keyboard::Scan::Refresh: return 0xE067;
case Keyboard::ScanStop: return 0xE068; case Keyboard::Scan::Stop: return 0xE068;
case Keyboard::ScanSearch: return 0xE065; case Keyboard::Scan::Search: return 0xE065;
case Keyboard::ScanFavorites: return 0xE066; case Keyboard::Scan::Favorites: return 0xE066;
case Keyboard::ScanHomePage: return 0xE030; case Keyboard::Scan::HomePage: return 0xE030;
case Keyboard::ScanLaunchApplication1: return 0xE06B; case Keyboard::Scan::LaunchApplication1: return 0xE06B;
case Keyboard::ScanLaunchApplication2: return 0xE021; case Keyboard::Scan::LaunchApplication2: return 0xE021;
case Keyboard::ScanLaunchMail: return 0xE06C; case Keyboard::Scan::LaunchMail: return 0xE06C;
case Keyboard::ScanLaunchMediaSelect: return 0xE06D; case Keyboard::Scan::LaunchMediaSelect: return 0xE06D;
// Unable to map to a scancode // Unable to map to a scancode
default: return 0x0; default: return 0x0;
@ -446,44 +446,44 @@ WORD sfScanToWinScanExtended(Keyboard::Scancode code)
// Reference: https://msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx // Reference: https://msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx
switch (code) switch (code)
{ {
case Keyboard::ScanPrintScreen: return 55 | 0xE100; case Keyboard::Scan::PrintScreen: return 55 | 0xE100;
case Keyboard::ScanInsert: return 82 | 0xE100; case Keyboard::Scan::Insert: return 82 | 0xE100;
case Keyboard::ScanHome: return 71 | 0xE100; case Keyboard::Scan::Home: return 71 | 0xE100;
case Keyboard::ScanPageUp: return 73 | 0xE100; case Keyboard::Scan::PageUp: return 73 | 0xE100;
case Keyboard::ScanDelete: return 83 | 0xE100; case Keyboard::Scan::Delete: return 83 | 0xE100;
case Keyboard::ScanEnd: return 79 | 0xE100; case Keyboard::Scan::End: return 79 | 0xE100;
case Keyboard::ScanPageDown: return 81 | 0xE100; case Keyboard::Scan::PageDown: return 81 | 0xE100;
case Keyboard::ScanRight: return 77 | 0xE100; case Keyboard::Scan::Right: return 77 | 0xE100;
case Keyboard::ScanLeft: return 75 | 0xE100; case Keyboard::Scan::Left: return 75 | 0xE100;
case Keyboard::ScanDown: return 80 | 0xE100; case Keyboard::Scan::Down: return 80 | 0xE100;
case Keyboard::ScanUp: return 72 | 0xE100; case Keyboard::Scan::Up: return 72 | 0xE100;
case Keyboard::ScanNumLock: return 69 | 0xE100; case Keyboard::Scan::NumLock: return 69 | 0xE100;
case Keyboard::ScanNumpadEnter: return 28 | 0xE100; case Keyboard::Scan::NumpadEnter: return 28 | 0xE100;
case Keyboard::ScanHelp: return 97 | 0xE100; case Keyboard::Scan::Help: return 97 | 0xE100;
case Keyboard::ScanMenu: return 93 | 0xE100; case Keyboard::Scan::Menu: return 93 | 0xE100;
case Keyboard::ScanSelect: return 30 | 0xE100; case Keyboard::Scan::Select: return 30 | 0xE100;
case Keyboard::ScanVolumeMute: return 32 | 0xE100; case Keyboard::Scan::VolumeMute: return 32 | 0xE100;
case Keyboard::ScanVolumeUp: return 46 | 0xE100; case Keyboard::Scan::VolumeUp: return 46 | 0xE100;
case Keyboard::ScanVolumeDown: return 44 | 0xE100; case Keyboard::Scan::VolumeDown: return 44 | 0xE100;
case Keyboard::ScanMediaPlayPause: return 34 | 0xE100; case Keyboard::Scan::MediaPlayPause: return 34 | 0xE100;
case Keyboard::ScanMediaStop: return 36 | 0xE100; case Keyboard::Scan::MediaStop: return 36 | 0xE100;
case Keyboard::ScanMediaNextTrack: return 25 | 0xE100; case Keyboard::Scan::MediaNextTrack: return 25 | 0xE100;
case Keyboard::ScanMediaPreviousTrack: return 16 | 0xE100; case Keyboard::Scan::MediaPreviousTrack: return 16 | 0xE100;
case Keyboard::ScanLSystem: return 91 | 0xE100; case Keyboard::Scan::LSystem: return 91 | 0xE100;
case Keyboard::ScanRControl: return 29 | 0xE100; case Keyboard::Scan::RControl: return 29 | 0xE100;
case Keyboard::ScanRAlt: return 56 | 0xE100; case Keyboard::Scan::RAlt: return 56 | 0xE100;
case Keyboard::ScanRSystem: return 92 | 0xE100; case Keyboard::Scan::RSystem: return 92 | 0xE100;
case Keyboard::ScanBack: return 106 | 0xE100; case Keyboard::Scan::Back: return 106 | 0xE100;
case Keyboard::ScanForward: return 105 | 0xE100; case Keyboard::Scan::Forward: return 105 | 0xE100;
case Keyboard::ScanRefresh: return 103 | 0xE100; case Keyboard::Scan::Refresh: return 103 | 0xE100;
case Keyboard::ScanStop: return 104 | 0xE100; case Keyboard::Scan::Stop: return 104 | 0xE100;
case Keyboard::ScanSearch: return 101 | 0xE100; case Keyboard::Scan::Search: return 101 | 0xE100;
case Keyboard::ScanFavorites: return 102 | 0xE100; case Keyboard::Scan::Favorites: return 102 | 0xE100;
case Keyboard::ScanHomePage: return 48 | 0xE100; case Keyboard::Scan::HomePage: return 48 | 0xE100;
case Keyboard::ScanLaunchApplication1: return 107 | 0xE100; case Keyboard::Scan::LaunchApplication1: return 107 | 0xE100;
case Keyboard::ScanLaunchApplication2: return 33 | 0xE100; case Keyboard::Scan::LaunchApplication2: return 33 | 0xE100;
case Keyboard::ScanLaunchMail: return 108 | 0xE100; case Keyboard::Scan::LaunchMail: return 108 | 0xE100;
case Keyboard::ScanLaunchMediaSelect: return 109 | 0xE100; case Keyboard::Scan::LaunchMediaSelect: return 109 | 0xE100;
// Use non-extended mapping // Use non-extended mapping
default: return sfScanToWinScan(code); default: return sfScanToWinScan(code);
@ -497,37 +497,37 @@ UINT sfScanToVirtualKey(Keyboard::Scancode code)
// Manually map non-extended key codes // Manually map non-extended key codes
switch (code) switch (code)
{ {
case Keyboard::ScanNumpad0: case Keyboard::Scan::Numpad0:
return VK_NUMPAD0; return VK_NUMPAD0;
case Keyboard::ScanNumpad1: case Keyboard::Scan::Numpad1:
return VK_NUMPAD1; return VK_NUMPAD1;
case Keyboard::ScanNumpad2: case Keyboard::Scan::Numpad2:
return VK_NUMPAD2; return VK_NUMPAD2;
case Keyboard::ScanNumpad3: case Keyboard::Scan::Numpad3:
return VK_NUMPAD3; return VK_NUMPAD3;
case Keyboard::ScanNumpad4: case Keyboard::Scan::Numpad4:
return VK_NUMPAD4; return VK_NUMPAD4;
case Keyboard::ScanNumpad5: case Keyboard::Scan::Numpad5:
return VK_NUMPAD5; return VK_NUMPAD5;
case Keyboard::ScanNumpad6: case Keyboard::Scan::Numpad6:
return VK_NUMPAD6; return VK_NUMPAD6;
case Keyboard::ScanNumpad7: case Keyboard::Scan::Numpad7:
return VK_NUMPAD7; return VK_NUMPAD7;
case Keyboard::ScanNumpad8: case Keyboard::Scan::Numpad8:
return VK_NUMPAD8; return VK_NUMPAD8;
case Keyboard::ScanNumpad9: case Keyboard::Scan::Numpad9:
return VK_NUMPAD9; return VK_NUMPAD9;
case Keyboard::ScanNumpadMinus: case Keyboard::Scan::NumpadMinus:
return VK_SUBTRACT; return VK_SUBTRACT;
case Keyboard::ScanNumpadDecimal: case Keyboard::Scan::NumpadDecimal:
return VK_DECIMAL; return VK_DECIMAL;
case Keyboard::ScanNumpadDivide: case Keyboard::Scan::NumpadDivide:
return VK_DIVIDE; return VK_DIVIDE;
case Keyboard::ScanPause: case Keyboard::Scan::Pause:
return VK_PAUSE; return VK_PAUSE;
case Keyboard::ScanRControl: case Keyboard::Scan::RControl:
return VK_RCONTROL; return VK_RCONTROL;
case Keyboard::ScanRAlt: case Keyboard::Scan::RAlt:
return VK_RMENU; return VK_RMENU;
default: default:
return MapVirtualKey(winScancode, MAPVK_VSC_TO_VK_EX); return MapVirtualKey(winScancode, MAPVK_VSC_TO_VK_EX);
@ -536,7 +536,7 @@ UINT sfScanToVirtualKey(Keyboard::Scancode code)
bool isValidScancode(Keyboard::Scancode code) bool isValidScancode(Keyboard::Scancode code)
{ {
return code > Keyboard::ScanUnknown && code < Keyboard::ScancodeCount; return code > Keyboard::Scan::Unknown && code < Keyboard::Scan::ScancodeCount;
} }
bool isValidKey(Keyboard::Key key) bool isValidKey(Keyboard::Key key)
@ -554,13 +554,13 @@ void InputImpl::ensureMappings()
// Phase 1: Initialize mappings with default values // Phase 1: Initialize mappings with default values
for (int i = 0; i < Keyboard::KeyCount; ++i) for (int i = 0; i < Keyboard::KeyCount; ++i)
m_keyToScancodeMapping[i] = Keyboard::ScanUnknown; m_keyToScancodeMapping[i] = Keyboard::Scan::Unknown;
for (int i = 0; i < Keyboard::ScancodeCount; ++i) for (int i = 0; i < Keyboard::Scan::ScancodeCount; ++i)
m_scancodeToKeyMapping[i] = Keyboard::Unknown; m_scancodeToKeyMapping[i] = Keyboard::Unknown;
// Phase 2: Translate scancode to virtual code to key names // Phase 2: Translate scancode to virtual code to key names
for (int i = 0; i < Keyboard::ScancodeCount; ++i) for (int i = 0; i < Keyboard::Scan::ScancodeCount; ++i)
{ {
Keyboard::Scancode scan = static_cast<Keyboard::Scancode>(i); Keyboard::Scancode scan = static_cast<Keyboard::Scancode>(i);
UINT virtualKey = sfScanToVirtualKey(scan); UINT virtualKey = sfScanToVirtualKey(scan);
@ -601,7 +601,7 @@ Keyboard::Key InputImpl::localize(Keyboard::Scancode code)
Keyboard::Scancode InputImpl::delocalize(Keyboard::Key key) Keyboard::Scancode InputImpl::delocalize(Keyboard::Key key)
{ {
if (!isValidKey(key)) if (!isValidKey(key))
return Keyboard::ScanUnknown; return Keyboard::Scan::Unknown;
ensureMappings(); ensureMappings();

View File

@ -186,8 +186,8 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
static Keyboard::Scancode m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode static Keyboard::Scancode m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode
static Keyboard::Key m_scancodeToKeyMapping[Keyboard::ScancodeCount]; ///< Mapping from Scancode to Key static Keyboard::Key m_scancodeToKeyMapping[Keyboard::Scan::ScancodeCount]; ///< Mapping from Scancode to Key
}; };
} // namespace priv } // namespace priv

View File

@ -582,114 +582,114 @@ Keyboard::Scancode WindowImplWin32::toScancode(WPARAM wParam, LPARAM lParam)
// Reference: https://msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx // Reference: https://msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx
switch (code) switch (code)
{ {
case 1: return Keyboard::ScanEscape; case 1: return Keyboard::Scan::Escape;
case 2: return Keyboard::ScanNum1; case 2: return Keyboard::Scan::Num1;
case 3: return Keyboard::ScanNum2; case 3: return Keyboard::Scan::Num2;
case 4: return Keyboard::ScanNum3; case 4: return Keyboard::Scan::Num3;
case 5: return Keyboard::ScanNum4; case 5: return Keyboard::Scan::Num4;
case 6: return Keyboard::ScanNum5; case 6: return Keyboard::Scan::Num5;
case 7: return Keyboard::ScanNum6; case 7: return Keyboard::Scan::Num6;
case 8: return Keyboard::ScanNum7; case 8: return Keyboard::Scan::Num7;
case 9: return Keyboard::ScanNum8; case 9: return Keyboard::Scan::Num8;
case 10: return Keyboard::ScanNum9; case 10: return Keyboard::Scan::Num9;
case 11: return Keyboard::ScanNum0; case 11: return Keyboard::Scan::Num0;
case 12: return Keyboard::ScanHyphen; case 12: return Keyboard::Scan::Hyphen;
case 13: return Keyboard::ScanEqual; case 13: return Keyboard::Scan::Equal;
case 14: return Keyboard::ScanBackspace; case 14: return Keyboard::Scan::Backspace;
case 15: return Keyboard::ScanTab; case 15: return Keyboard::Scan::Tab;
case 16: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMediaPreviousTrack : Keyboard::ScanQ; case 16: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::MediaPreviousTrack : Keyboard::Scan::Q;
case 17: return Keyboard::ScanW; case 17: return Keyboard::Scan::W;
case 18: return Keyboard::ScanE; case 18: return Keyboard::Scan::E;
case 19: return Keyboard::ScanR; case 19: return Keyboard::Scan::R;
case 20: return Keyboard::ScanT; case 20: return Keyboard::Scan::T;
case 21: return Keyboard::ScanY; case 21: return Keyboard::Scan::Y;
case 22: return Keyboard::ScanU; case 22: return Keyboard::Scan::U;
case 23: return Keyboard::ScanI; case 23: return Keyboard::Scan::I;
case 24: return Keyboard::ScanO; case 24: return Keyboard::Scan::O;
case 25: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMediaNextTrack : Keyboard::ScanP; case 25: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::MediaNextTrack : Keyboard::Scan::P;
case 26: return Keyboard::ScanLBracket; case 26: return Keyboard::Scan::LBracket;
case 27: return Keyboard::ScanRBracket; case 27: return Keyboard::Scan::RBracket;
case 28: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanNumpadEnter : Keyboard::ScanEnter; case 28: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::NumpadEnter : Keyboard::Scan::Enter;
case 29: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRControl : Keyboard::ScanLControl; case 29: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::RControl : Keyboard::Scan::LControl;
case 30: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanSelect : Keyboard::ScanA; case 30: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Select : Keyboard::Scan::A;
case 31: return Keyboard::ScanS; case 31: return Keyboard::Scan::S;
case 32: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanVolumeMute : Keyboard::ScanD; case 32: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::VolumeMute : Keyboard::Scan::D;
case 33: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLaunchApplication1 : Keyboard::ScanF; case 33: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LaunchApplication1 : Keyboard::Scan::F;
case 34: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMediaPlayPause : Keyboard::ScanG; case 34: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::MediaPlayPause : Keyboard::Scan::G;
case 35: return Keyboard::ScanH; case 35: return Keyboard::Scan::H;
case 36: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMediaStop : Keyboard::ScanJ; case 36: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::MediaStop : Keyboard::Scan::J;
case 37: return Keyboard::ScanK; case 37: return Keyboard::Scan::K;
case 38: return Keyboard::ScanL; case 38: return Keyboard::Scan::L;
case 39: return Keyboard::ScanSemicolon; case 39: return Keyboard::Scan::Semicolon;
case 40: return Keyboard::ScanApostrophe; case 40: return Keyboard::Scan::Apostrophe;
case 41: return Keyboard::ScanGrave; case 41: return Keyboard::Scan::Grave;
case 42: return Keyboard::ScanLShift; case 42: return Keyboard::Scan::LShift;
case 43: return Keyboard::ScanBackslash; case 43: return Keyboard::Scan::Backslash;
case 44: return Keyboard::ScanZ; case 44: return Keyboard::Scan::Z;
case 45: return Keyboard::ScanX; case 45: return Keyboard::Scan::X;
case 46: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanVolumeDown : Keyboard::ScanC; case 46: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::VolumeDown : Keyboard::Scan::C;
case 47: return Keyboard::ScanV; case 47: return Keyboard::Scan::V;
case 48: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanVolumeUp : Keyboard::ScanB; case 48: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::VolumeUp : Keyboard::Scan::B;
case 49: return Keyboard::ScanN; case 49: return Keyboard::Scan::N;
case 50: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanHomePage : Keyboard::ScanM; case 50: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::HomePage : Keyboard::Scan::M;
case 51: return Keyboard::ScanComma; case 51: return Keyboard::Scan::Comma;
case 52: return Keyboard::ScanPeriod; case 52: return Keyboard::Scan::Period;
case 53: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanNumpadDivide : Keyboard::ScanSlash; case 53: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::NumpadDivide : Keyboard::Scan::Slash;
case 54: return Keyboard::ScanRShift; case 54: return Keyboard::Scan::RShift;
case 55: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanPrintScreen : Keyboard::ScanNumpadMultiply; case 55: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::PrintScreen : Keyboard::Scan::NumpadMultiply;
case 56: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRAlt : Keyboard::ScanLAlt; case 56: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::RAlt : Keyboard::Scan::LAlt;
case 57: return Keyboard::ScanSpace; case 57: return Keyboard::Scan::Space;
case 58: return Keyboard::ScanCapsLock; case 58: return Keyboard::Scan::CapsLock;
case 59: return Keyboard::ScanF1; case 59: return Keyboard::Scan::F1;
case 60: return Keyboard::ScanF2; case 60: return Keyboard::Scan::F2;
case 61: return Keyboard::ScanF3; case 61: return Keyboard::Scan::F3;
case 62: return Keyboard::ScanF4; case 62: return Keyboard::Scan::F4;
case 63: return Keyboard::ScanF5; case 63: return Keyboard::Scan::F5;
case 64: return Keyboard::ScanF6; case 64: return Keyboard::Scan::F6;
case 65: return Keyboard::ScanF7; case 65: return Keyboard::Scan::F7;
case 66: return Keyboard::ScanF8; case 66: return Keyboard::Scan::F8;
case 67: return Keyboard::ScanF9; case 67: return Keyboard::Scan::F9;
case 68: return Keyboard::ScanF10; case 68: return Keyboard::Scan::F10;
case 69: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanNumLock : Keyboard::ScanPause; case 69: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::NumLock : Keyboard::Scan::Pause;
case 70: return Keyboard::ScanScrollLock; case 70: return Keyboard::Scan::ScrollLock;
case 71: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanHome : Keyboard::ScanNumpad7; case 71: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Home : Keyboard::Scan::Numpad7;
case 72: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanUp : Keyboard::ScanNumpad8; case 72: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Up : Keyboard::Scan::Numpad8;
case 73: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanPageUp : Keyboard::ScanNumpad9; case 73: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::PageUp : Keyboard::Scan::Numpad9;
case 74: return Keyboard::ScanNumpadMinus; case 74: return Keyboard::Scan::NumpadMinus;
case 75: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLeft : Keyboard::ScanNumpad4; case 75: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Left : Keyboard::Scan::Numpad4;
case 76: return Keyboard::ScanNumpad5; case 76: return Keyboard::Scan::Numpad5;
case 77: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRight : Keyboard::ScanNumpad6; case 77: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Right : Keyboard::Scan::Numpad6;
case 78: return Keyboard::ScanNumpadPlus; case 78: return Keyboard::Scan::NumpadPlus;
case 79: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanEnd : Keyboard::ScanNumpad1; case 79: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::End : Keyboard::Scan::Numpad1;
case 80: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanDown : Keyboard::ScanNumpad2; case 80: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Down : Keyboard::Scan::Numpad2;
case 81: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanPageDown : Keyboard::ScanNumpad3; case 81: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::PageDown : Keyboard::Scan::Numpad3;
case 82: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanInsert : Keyboard::ScanNumpad0; case 82: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Insert : Keyboard::Scan::Numpad0;
case 83: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanDelete : Keyboard::ScanNumpadDecimal; case 83: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Delete : Keyboard::Scan::NumpadDecimal;
case 86: return Keyboard::ScanNonUsBackslash; case 86: return Keyboard::Scan::NonUsBackslash;
case 87: return Keyboard::ScanF11; case 87: return Keyboard::Scan::F11;
case 88: return Keyboard::ScanF12; case 88: return Keyboard::Scan::F12;
case 91: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLSystem : Keyboard::ScanUnknown; case 91: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LSystem : Keyboard::Scan::Unknown;
case 92: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRSystem : Keyboard::ScanUnknown; case 92: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::RSystem : Keyboard::Scan::Unknown;
case 93: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMenu : Keyboard::ScanUnknown; case 93: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Menu : Keyboard::Scan::Unknown;
case 99: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanHelp : Keyboard::ScanUnknown; case 99: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Help : Keyboard::Scan::Unknown;
case 100: return Keyboard::ScanF13; case 100: return Keyboard::Scan::F13;
case 101: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanSearch : Keyboard::ScanF14; case 101: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Search : Keyboard::Scan::F14;
case 102: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanFavorites : Keyboard::ScanF15; case 102: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Favorites : Keyboard::Scan::F15;
case 103: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRefresh : Keyboard::ScanF16; case 103: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Refresh : Keyboard::Scan::F16;
case 104: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanStop : Keyboard::ScanF17; case 104: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Stop : Keyboard::Scan::F17;
case 105: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanForward : Keyboard::ScanF18; case 105: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Forward : Keyboard::Scan::F18;
case 106: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanBack : Keyboard::ScanF19; case 106: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Back : Keyboard::Scan::F19;
case 107: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLaunchApplication1 : Keyboard::ScanF20; case 107: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LaunchApplication1 : Keyboard::Scan::F20;
case 108: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLaunchMail : Keyboard::ScanF21; case 108: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LaunchMail : Keyboard::Scan::F21;
case 109: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLaunchMediaSelect : Keyboard::ScanF22; case 109: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LaunchMediaSelect : Keyboard::Scan::F22;
case 110: return Keyboard::ScanF23; case 110: return Keyboard::Scan::F23;
case 118: return Keyboard::ScanF24; case 118: return Keyboard::Scan::F24;
default: return Keyboard::ScanUnknown; default: return Keyboard::Scan::Unknown;
} }
} }

View File

@ -58,7 +58,7 @@ Keyboard::Key InputImpl::localize(Keyboard::Scancode /* code */)
Keyboard::Scancode InputImpl::delocalize(Keyboard::Key /* key */) Keyboard::Scancode InputImpl::delocalize(Keyboard::Key /* key */)
{ {
// Not applicable // Not applicable
return Keyboard::ScanUnknown; return Keyboard::Scan::Unknown;
} }
String InputImpl::getDescription(Keyboard::Scancode /* code */) String InputImpl::getDescription(Keyboard::Scancode /* code */)