From 3379051ed5af61ea9dd7ba3414e0b10163a72043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 1 Dec 2019 20:20:50 +0100 Subject: [PATCH] Platform: added a bunch of missing keys. --- doc/changelog.dox | 16 ++++++ src/Magnum/Platform/EmscriptenApplication.cpp | 4 ++ src/Magnum/Platform/EmscriptenApplication.h | 20 ++++++-- src/Magnum/Platform/GlfwApplication.h | 49 ++++++++++++++++++- src/Magnum/Platform/Sdl2Application.h | 35 ++++++++++++- 5 files changed, 116 insertions(+), 8 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 5c3111684..67d402c9b 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -82,6 +82,16 @@ See also: @ref Platform::AbstractXApplication::mainLoopIteration() for consistency with @ref Platform::Sdl2Application (see [mosra/magnum#387](https://github.com/mosra/magnum/pull/387)) +- Added @ref Platform::Sdl2Application::KeyEvent::Key::Quote "Key::Quote", + @ref Platform::Sdl2Application::KeyEvent::Key::LeftBracket "Key::LeftBracket", + @ref Platform::Sdl2Application::KeyEvent::Key::RightBracket "Key::RightBracket", + @ref Platform::Sdl2Application::KeyEvent::Key::Backslash "Key::Backslash" and + @ref Platform::Sdl2Application::KeyEvent::Key::Backquote "Key::Backquote" + keys to @ref Platform::Sdl2Application::KeyEvent and + @ref Platform::GlfwApplication::KeyEvent +- Added @ref Platform::GlfwApplication::KeyEvent::Key::World1 and + @ref Platform::GlfwApplication::KeyEvent::Key::World2 +- Added @ref Platform::EmscriptenApplication::KeyEvent::Key::Semicolon @subsection changelog-latest-changes Changes and improvements @@ -133,6 +143,12 @@ See also: - @ref Platform::Sdl2Application::Configuration::WindowFlag::Vulkan was enabled conditionally only for SDL >= 2.0.6, but the version defines were never included so it was always disabled +- Fixed missing handling of + @ref Platform::EmscriptenApplication::KeyEvent::Key::LeftBracket "Key::LeftBracket", + @ref Platform::EmscriptenApplication::KeyEvent::Key::RightBracket "Key::RightBracket", + @ref Platform::EmscriptenApplication::KeyEvent::Key::Semicolon "Key::Semicolon" and + @ref Platform::EmscriptenApplication::KeyEvent::Key::Backquote "Key::Backquote" + in @ref Platform::EmscriptenApplication @subsection changelog-latest-deprecated Deprecated APIs diff --git a/src/Magnum/Platform/EmscriptenApplication.cpp b/src/Magnum/Platform/EmscriptenApplication.cpp index 840f9c7f6..ac7df2d43 100644 --- a/src/Magnum/Platform/EmscriptenApplication.cpp +++ b/src/Magnum/Platform/EmscriptenApplication.cpp @@ -62,8 +62,11 @@ namespace { {"ArrowLeft", Key::Left}, {"ArrowRight", Key::Right}, {"ArrowUp", Key::Up}, + {"Backquote", Key::Backquote}, {"Backslash", Key::Backslash}, {"Backspace", Key::Backspace}, + {"BracketLeft", Key::LeftBracket}, + {"BracketRight", Key::RightBracket}, {"CapsLock", Key::CapsLock}, {"Comma", Key::Comma}, {"ContextMenu", Key::Menu}, @@ -88,6 +91,7 @@ namespace { {"PrintScreen", Key::PrintScreen}, {"Quote", Key::Quote}, {"ScrollLock", Key::ScrollLock}, + {"Semicolon", Key::Semicolon}, {"ShiftLeft", Key::LeftShift}, {"ShiftRight", Key::RightShift}, {"Slash", Key::Slash}, diff --git a/src/Magnum/Platform/EmscriptenApplication.h b/src/Magnum/Platform/EmscriptenApplication.h index 99c3cac19..0e0350653 100644 --- a/src/Magnum/Platform/EmscriptenApplication.h +++ b/src/Magnum/Platform/EmscriptenApplication.h @@ -1586,6 +1586,8 @@ class EmscriptenApplication::KeyEvent: public EmscriptenApplication::InputEvent */ RightSuper, + /* no equivalent for Sdl2Application's AltGr */ + Enter, /**< Enter */ Esc, /**< Escape */ @@ -1654,6 +1656,7 @@ class EmscriptenApplication::KeyEvent: public EmscriptenApplication::InputEvent Space, /**< Space */ Tab, /**< Tab */ + Quote, /**< Quote (`'`) */ Comma, /**< Comma */ Period, /**< Period */ Minus, /**< Minus */ @@ -1662,13 +1665,20 @@ class EmscriptenApplication::KeyEvent: public EmscriptenApplication::InputEvent Slash, /**< Slash */ /* Note: This may only be represented as SHIFT + 5 */ Percent, /**< Percent */ + + /** + * Semicolon (`;`) + * @m_since_latest + */ + Semicolon, + Equal, /**< Equal */ + LeftBracket, /**< Left bracket (`[`) */ + RightBracket, /**< Right bracket (`]`) */ + Backslash, /**< Backslash (`\`) */ + Backquote, /**< Backquote (`) */ - Backquote, /**< Backquote */ - Backslash, /**< Backslash */ - Quote, /**< Quote */ - BracketRight, /**< BracketRight */ - BracketLeft, /**< BracketLeft */ + /* no equivalent for GlfwApplication's World1 / World2 */ CapsLock, /**< Caps lock */ ScrollLock, /**< Scroll lock */ diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index f4e5bb766..0f977b91f 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -1469,6 +1469,8 @@ class GlfwApplication::KeyEvent: public GlfwApplication::InputEvent { */ RightSuper = GLFW_KEY_RIGHT_SUPER, + /* no equivalent for Sdl2Application's AltGr */ + Enter = GLFW_KEY_ENTER, /**< Enter */ Esc = GLFW_KEY_ESCAPE, /**< Escape */ @@ -1499,6 +1501,13 @@ class GlfwApplication::KeyEvent: public GlfwApplication::InputEvent { Space = GLFW_KEY_SPACE, /**< Space */ Tab = GLFW_KEY_TAB, /**< Tab */ + + /** + * Quote (`'`) + * @m_since_latest + */ + Quote = GLFW_KEY_APOSTROPHE, + Comma = GLFW_KEY_COMMA, /**< Comma */ Period = GLFW_KEY_PERIOD, /**< Period */ Minus = GLFW_KEY_MINUS, /**< Minus */ @@ -1507,10 +1516,10 @@ class GlfwApplication::KeyEvent: public GlfwApplication::InputEvent { Slash = GLFW_KEY_SLASH, /**< Slash */ /* Note: This may only be represented as SHIFT + 5 */ Percent = '%', /**< Percent */ - Semicolon = GLFW_KEY_SEMICOLON, /**< Semicolon */ + Semicolon = GLFW_KEY_SEMICOLON, /**< Semicolon (`;`) */ #ifdef MAGNUM_BUILD_DEPRECATED - /** Semicolon + /** Semicolon (`;`) * @m_deprecated_since{2019,01} Use @ref Key::Semicolon instead. */ Smicolon CORRADE_DEPRECATED_ENUM("use Key::Semicolon instead") = Semicolon, @@ -1518,6 +1527,42 @@ class GlfwApplication::KeyEvent: public GlfwApplication::InputEvent { Equal = GLFW_KEY_EQUAL, /**< Equal */ + /** + * Left bracket (`[`) + * @m_since_latest + */ + LeftBracket = GLFW_KEY_LEFT_BRACKET, + + /** + * Right bracket (`]`) + * @m_since_latest + */ + RightBracket = GLFW_KEY_RIGHT_BRACKET, + + /** + * Backslash (`\`) + * @m_since_latest + */ + Backslash = GLFW_KEY_BACKSLASH, + + /** + * Backquote (`) + * @m_since_latest + */ + Backquote = GLFW_KEY_GRAVE_ACCENT, + + /** + * Non-US \#1 + * @m_since_latest + */ + World1 = GLFW_KEY_WORLD_1, + + /** + * Non-US \#2 + * @m_since_latest + */ + World2 = GLFW_KEY_WORLD_2, + Zero = GLFW_KEY_0, /**< Zero */ One = GLFW_KEY_1, /**< One */ Two = GLFW_KEY_2, /**< Two */ diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index 123bce632..a010b0bc1 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -2099,15 +2099,48 @@ class Sdl2Application::KeyEvent: public Sdl2Application::InputEvent { Space = SDLK_SPACE, /**< Space */ Tab = SDLK_TAB, /**< Tab */ + + /** + * Quote (`'`) + * @m_since_latest + */ + Quote = SDLK_QUOTE, + Comma = SDLK_COMMA, /**< Comma */ Period = SDLK_PERIOD, /**< Period */ Minus = SDLK_MINUS, /**< Minus */ Plus = SDLK_PLUS, /**< Plus */ Slash = SDLK_SLASH, /**< Slash */ Percent = SDLK_PERCENT, /**< Percent */ - Semicolon = SDLK_SEMICOLON, /**< Semicolon */ + Semicolon = SDLK_SEMICOLON, /**< Semicolon (`;`) */ Equal = SDLK_EQUALS, /**< Equal */ + /** + * Left bracket (`[`) + * @m_since_latest + */ + LeftBracket = SDLK_LEFTBRACKET, + + /** + * Right bracket (`]`) + * @m_since_latest + */ + RightBracket = SDLK_RIGHTBRACKET, + + /** + * Backslash (`\`) + * @m_since_latest + */ + Backslash = SDLK_BACKSLASH, + + /** + * Backquote (`) + * @m_since_latest + */ + Backquote = SDLK_BACKQUOTE, + + /* no equivalent for GlfwApplication's World1 / World2 */ + Zero = SDLK_0, /**< Zero */ One = SDLK_1, /**< One */ Two = SDLK_2, /**< Two */