From 589b3e594db7000e62be6472208746c7aed8d115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 25 Mar 2024 17:22:10 +0100 Subject: [PATCH] Platform: add various *Application::KeyEvent::Key TODOs. It's a far worse mess than I expected. --- src/Magnum/Platform/EmscriptenApplication.h | 29 +++++++++++++--- src/Magnum/Platform/GlfwApplication.h | 38 ++++++++++++++++++--- src/Magnum/Platform/Sdl2Application.h | 28 +++++++++++++-- 3 files changed, 84 insertions(+), 11 deletions(-) diff --git a/src/Magnum/Platform/EmscriptenApplication.h b/src/Magnum/Platform/EmscriptenApplication.h index 1624fdd38..040af6b67 100644 --- a/src/Magnum/Platform/EmscriptenApplication.h +++ b/src/Magnum/Platform/EmscriptenApplication.h @@ -1821,11 +1821,30 @@ class EmscriptenApplication::KeyEvent: public EmscriptenApplication::InputEvent Comma, /**< Comma */ Period, /**< Period */ Minus, /**< Minus */ - /* Note: This may only be represented as SHIFT + = */ - Plus, /**< Plus */ + + /** + * Plus + * @todo Impossible to represent via a scancode on US layout + * (Shift + =). The reason this was included is that it was in + * Sdl2App which historically uses layout-dependent keycodes + * instead of scancodes because otherwise Z and Y would be + * swapped on QWERTZ layouts (unlike GLFW and HTML5), which is + * a far worse problem. + */ + Plus, + Slash, /**< Slash */ - /* Note: This may only be represented as SHIFT + 5 */ - Percent, /**< Percent */ + + /** + * Percent + * @todo Impossible to represent via a scancode on US layout + * (Shift + 5). The reason this was included is that it was in + * Sdl2App which historically uses layout-dependent keycodes + * instead of scancodes because otherwise Z and Y would be + * swapped on QWERTZ layouts (unlike GLFW and HTML5), which is + * a far worse problem. + */ + Percent, /** * Semicolon (`;`) @@ -1840,6 +1859,8 @@ class EmscriptenApplication::KeyEvent: public EmscriptenApplication::InputEvent Backquote, /**< Backquote (`) */ /* no equivalent for GlfwApplication's World1 / World2 */ + /** @todo there's IntlBackslash for World1, implement once there's + consensus about naming */ CapsLock, /**< Caps lock */ ScrollLock, /**< Scroll lock */ diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index 040333673..d367154a7 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -1704,11 +1704,31 @@ class GlfwApplication::KeyEvent: public GlfwApplication::InputEvent { Comma = GLFW_KEY_COMMA, /**< Comma */ Period = GLFW_KEY_PERIOD, /**< Period */ Minus = GLFW_KEY_MINUS, /**< Minus */ - /* Note: This may only be represented as SHIFT + = */ - Plus = '+', /**< Plus */ + + /** + * Plus + * @todo Impossible to represent via a scancode on US layout + * (Shift + =). The reason this was included is that it was in + * Sdl2App which historically uses layout-dependent keycodes + * instead of scancodes because otherwise Z and Y would be + * swapped on QWERTZ layouts (unlike GLFW and HTML5), which is + * a far worse problem. + */ + Plus = '+', + Slash = GLFW_KEY_SLASH, /**< Slash */ - /* Note: This may only be represented as SHIFT + 5 */ - Percent = '%', /**< Percent */ + + /** + * Percent + * @todo Impossible to represent via a scancode on US layout + * (Shift + 5). The reason this was included is that it was in + * Sdl2App which historically uses layout-dependent keycodes + * instead of scancodes because otherwise Z and Y would be + * swapped on QWERTZ layouts (unlike GLFW and HTML5), which is + * a far worse problem. + */ + Percent = '%', + Semicolon = GLFW_KEY_SEMICOLON, /**< Semicolon (`;`) */ #ifdef MAGNUM_BUILD_DEPRECATED @@ -1734,6 +1754,7 @@ class GlfwApplication::KeyEvent: public GlfwApplication::InputEvent { /** * Backslash (`\`) + * @see @ref Key::World1, @ref Key::World2 * @m_since{2020,06} */ Backslash = GLFW_KEY_BACKSLASH, @@ -1745,13 +1766,20 @@ class GlfwApplication::KeyEvent: public GlfwApplication::InputEvent { Backquote = GLFW_KEY_GRAVE_ACCENT, /** - * Non-US \#1 + * Non-US \#1. Can be for example a backslash (`\`) next to left + * Shift. + * @see @ref Key::Backslash * @m_since{2020,06} + * @todo Revisit / rename together with World2 once + * https://github.com/glfw/glfw/issues/2481 is resolved. SDL + * scancode for this key is SDL_SCANCODE_NONUSBACKSLASH, HTML5 + * names it IntlBackslash. */ World1 = GLFW_KEY_WORLD_1, /** * Non-US \#2 + * @see @ref Key::Backslash * @m_since{2020,06} */ World2 = GLFW_KEY_WORLD_2, diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index 5db3c42fe..9026dec4d 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -2166,6 +2166,7 @@ class Sdl2Application::InputEvent { * AltGr * * @see @ref KeyEvent::Key::AltGr + * @todo AltGr gets reported as RightAlt, what's this for? */ AltGr = KMOD_MODE, @@ -2304,6 +2305,7 @@ class Sdl2Application::KeyEvent: public Sdl2Application::InputEvent { * AltGr * * @see @ref InputEvent::Modifier::AltGr + * @todo AltGr gets reported as RightAlt, what's this for? */ AltGr = SDLK_MODE, @@ -2347,9 +2349,31 @@ class Sdl2Application::KeyEvent: public Sdl2Application::InputEvent { Comma = SDLK_COMMA, /**< Comma */ Period = SDLK_PERIOD, /**< Period */ Minus = SDLK_MINUS, /**< Minus */ - Plus = SDLK_PLUS, /**< Plus */ + + /** + * Plus + * @todo Impossible to represent via a scancode on US layout + * (Shift + =). The reason this was included is that Sdl2App + * historically uses layout-dependent keycodes instead of + * scancodes because otherwise Z and Y would be swapped on + * QWERTZ layouts (unlike GLFW and HTML5), which is a far + * worse problem. + */ + Plus = SDLK_PLUS, + Slash = SDLK_SLASH, /**< Slash */ - Percent = SDLK_PERCENT, /**< Percent */ + + /** + * Percent + * @todo Impossible to represent via a scancode on US layout + * (Shift + 5). The reason this was included is that Sdl2App + * historically uses layout-dependent keycodes instead of + * scancodes because otherwise Z and Y would be swapped on + * QWERTZ layouts (unlike GLFW and HTML5), which is a far + * worse problem. + */ + Percent = SDLK_PERCENT, + Semicolon = SDLK_SEMICOLON, /**< Semicolon (`;`) */ Equal = SDLK_EQUALS, /**< Equal */