diff --git a/src/Magnum/Platform/Test/AbstractXApplicationTest.cpp b/src/Magnum/Platform/Test/AbstractXApplicationTest.cpp index 2c131dd71..8d0646c32 100644 --- a/src/Magnum/Platform/Test/AbstractXApplicationTest.cpp +++ b/src/Magnum/Platform/Test/AbstractXApplicationTest.cpp @@ -24,6 +24,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #ifdef BUILD_GLXAPPLICATION @@ -34,7 +35,201 @@ #error #endif -namespace Magnum { namespace Platform { namespace Test { namespace { +namespace Magnum { namespace Platform { + +/* These cannot be in an anonymous namespace as enumSetDebugOutput() below + wouldn't be able to pick them up */ + +static Debug& operator<<(Debug& debug, Application::InputEvent::Modifier value) { + debug << "Modifier" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::InputEvent::Modifier::value: return debug << "::" #value; + _c(Shift) + _c(Ctrl) + _c(Alt) + _c(AltGr) + _c(CapsLock) + _c(NumLock) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +static Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseMoveEvent::Button::value: return debug << "::" #value; + _c(Left) + _c(Middle) + _c(Right) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +namespace Test { namespace { + +Debug& operator<<(Debug& debug, Application::InputEvent::Modifiers value) { + return Containers::enumSetDebugOutput(debug, value, "Modifiers{}", { + Application::InputEvent::Modifier::Shift, + Application::InputEvent::Modifier::Ctrl, + Application::InputEvent::Modifier::Alt, + Application::InputEvent::Modifier::AltGr, + Application::InputEvent::Modifier::CapsLock, + Application::InputEvent::Modifier::NumLock, + }); +} + +Debug& operator<<(Debug& debug, Application::MouseEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseEvent::Button::value: return debug << "::" #value; + _c(Left) + _c(Middle) + _c(Right) + _c(WheelUp) + _c(WheelDown) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Buttons value) { + return Containers::enumSetDebugOutput(debug, value, "Buttons{}", { + Application::MouseMoveEvent::Button::Left, + Application::MouseMoveEvent::Button::Middle, + Application::MouseMoveEvent::Button::Right, + }); +} + +Debug& operator<<(Debug& debug, const Application::KeyEvent::Key value) { + debug << "Key" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::KeyEvent::Key::value: return debug << "::" #value; + _c(LeftShift) + _c(RightShift) + _c(LeftCtrl) + _c(RightCtrl) + _c(LeftAlt) + _c(RightAlt) + _c(LeftSuper) + _c(RightSuper) + _c(Enter) + _c(Esc) + + _c(Up) + _c(Down) + _c(Left) + _c(Right) + _c(Home) + _c(End) + _c(PageUp) + _c(PageDown) + _c(Backspace) + _c(Insert) + _c(Delete) + + _c(F1) + _c(F2) + _c(F3) + _c(F4) + _c(F5) + _c(F6) + _c(F7) + _c(F8) + _c(F9) + _c(F10) + _c(F11) + _c(F12) + + _c(Space) + _c(Tab) + _c(Quote) + _c(Comma) + _c(Period) + _c(Minus) + _c(Plus) + _c(Slash) + _c(Percent) + _c(Semicolon) + _c(Equal) + _c(LeftBracket) + _c(RightBracket) + _c(Backslash) + _c(Backquote) + + _c(Zero) + _c(One) + _c(Two) + _c(Three) + _c(Four) + _c(Five) + _c(Six) + _c(Seven) + _c(Eight) + _c(Nine) + + _c(A) + _c(B) + _c(C) + _c(D) + _c(E) + _c(F) + _c(G) + _c(H) + _c(I) + _c(J) + _c(K) + _c(L) + _c(M) + _c(N) + _c(O) + _c(P) + _c(Q) + _c(R) + _c(S) + _c(T) + _c(U) + _c(V) + _c(W) + _c(X) + _c(Y) + _c(Z) + + _c(CapsLock) + _c(ScrollLock) + _c(NumLock) + _c(PrintScreen) + + _c(NumZero) + _c(NumOne) + _c(NumTwo) + _c(NumThree) + _c(NumFour) + _c(NumFive) + _c(NumSix) + _c(NumSeven) + _c(NumEight) + _c(NumNine) + _c(NumDecimal) + _c(NumDivide) + _c(NumMultiply) + _c(NumSubtract) + _c(NumAdd) + _c(NumEnter) + _c(NumEqual) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} using namespace Containers::Literals; @@ -45,6 +240,26 @@ struct AbstractXApplicationTest: Platform::Application { Debug{} << "draw event"; swapBuffers(); } + + void mousePressEvent(MouseEvent& event) override { + Debug{} << "mouse press:" << event.button() << event.buttons() << event.modifiers() << Debug::packed << event.position(); + } + + void mouseReleaseEvent(MouseEvent& event) override { + Debug{} << "mouse release:" << event.button() << event.buttons() << event.modifiers() << Debug::packed << event.position(); + } + + void mouseMoveEvent(MouseMoveEvent& event) override { + Debug{} << "mouse move:" << event.buttons() << event.modifiers() << Debug::packed << event.position(); + } + + void keyPressEvent(KeyEvent& event) override { + Debug{} << "key press:" << event.key() << int(event.key()) << event.modifiers() << event.buttons() << Debug::packed << event.position(); + } + + void keyReleaseEvent(KeyEvent& event) override { + Debug{} << "key release:" << event.key() << int(event.key()) << event.modifiers() << event.buttons() << Debug::packed << event.position(); + } }; AbstractXApplicationTest::AbstractXApplicationTest(const Arguments& arguments): Platform::Application{arguments, NoCreate} { diff --git a/src/Magnum/Platform/Test/AndroidApplicationTest.cpp b/src/Magnum/Platform/Test/AndroidApplicationTest.cpp index df7f1b84f..dccd673f5 100644 --- a/src/Magnum/Platform/Test/AndroidApplicationTest.cpp +++ b/src/Magnum/Platform/Test/AndroidApplicationTest.cpp @@ -24,9 +24,52 @@ DEALINGS IN THE SOFTWARE. */ +#include + #include "Magnum/Platform/AndroidApplication.h" -namespace Magnum { namespace Platform { namespace Test { namespace { +namespace Magnum { namespace Platform { + +/* Cannot be in an anonymous namespace as enumSetDebugOutput() below wouldn't + be able to pick it up */ +static Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseMoveEvent::Button::value: return debug << "::" #value; + _c(Left) + _c(Middle) + _c(Right) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +namespace Test { namespace { + +Debug& operator<<(Debug& debug, Application::MouseEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseEvent::Button::value: return debug << "::" #value; + _c(None) + _c(Left) + _c(Middle) + _c(Right) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Buttons value) { + return Containers::enumSetDebugOutput(debug, value, "Buttons{}", { + Application::MouseMoveEvent::Button::Left, + Application::MouseMoveEvent::Button::Middle, + Application::MouseMoveEvent::Button::Right, + }); +} struct AndroidApplicationTest: Platform::Application { explicit AndroidApplicationTest(const Arguments& arguments): Platform::Application{arguments} { @@ -37,12 +80,19 @@ struct AndroidApplicationTest: Platform::Application { /* For testing HiDPI resize events */ void viewportEvent(ViewportEvent& event) override { - Debug{} << "viewport event" << event.windowSize() << event.framebufferSize() << event.dpiScaling(); + Debug{} << "viewport:" << event.windowSize() << event.framebufferSize() << event.dpiScaling(); } - /* For testing event coordinates */ void mousePressEvent(MouseEvent& event) override { - Debug{} << event.position(); + Debug{} << "mouse press:" << event.button() << Debug::packed << event.position(); + } + + void mouseReleaseEvent(MouseEvent& event) override { + Debug{} << "mouse release:" << event.button() << Debug::packed << event.position(); + } + + void mouseMoveEvent(MouseMoveEvent& event) override { + Debug{} << "mouse move:" << event.buttons() << Debug::packed << event.position() << Debug::packed << event.relativePosition(); } }; diff --git a/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp b/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp index e8849c105..869ac082d 100644 --- a/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp +++ b/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp @@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #include "Magnum/Platform/EmscriptenApplication.h" @@ -44,7 +45,72 @@ #include #endif -namespace Magnum { namespace Platform { namespace Test { namespace { +namespace Magnum { namespace Platform { + +/* These cannot be in an anonymous namespace as enumSetDebugOutput() below + wouldn't be able to pick them up */ + +static Debug& operator<<(Debug& debug, Application::InputEvent::Modifier value) { + debug << "Modifier" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::InputEvent::Modifier::value: return debug << "::" #value; + _c(Shift) + _c(Ctrl) + _c(Alt) + _c(Super) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +static Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseMoveEvent::Button::value: return debug << "::" #value; + _c(Left) + _c(Middle) + _c(Right) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +namespace Test { namespace { + +Debug& operator<<(Debug& debug, Application::InputEvent::Modifiers value) { + return Containers::enumSetDebugOutput(debug, value, "Modifiers{}", { + Application::InputEvent::Modifier::Shift, + Application::InputEvent::Modifier::Ctrl, + Application::InputEvent::Modifier::Alt, + Application::InputEvent::Modifier::Super + }); +} + +Debug& operator<<(Debug& debug, Application::MouseEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseEvent::Button::value: return debug << "::" #value; + _c(Left) + _c(Middle) + _c(Right) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Buttons value) { + return Containers::enumSetDebugOutput(debug, value, "Buttons{}", { + Application::MouseMoveEvent::Button::Left, + Application::MouseMoveEvent::Button::Middle, + Application::MouseMoveEvent::Button::Right, + }); +} Debug& operator<<(Debug& debug, const Application::KeyEvent::Key value) { debug << "Key" << Debug::nospace; @@ -188,38 +254,29 @@ struct EmscriptenApplicationTest: Platform::Application { #ifdef MAGNUM_TARGET_GL /* For testing HiDPI resize events */ void viewportEvent(ViewportEvent& event) override { - Debug{} << "viewport event" << event.windowSize() << event.framebufferSize() << event.dpiScaling() << event.devicePixelRatio(); + Debug{} << "viewport:" << event.windowSize() << event.framebufferSize() << event.dpiScaling() << event.devicePixelRatio(); } #endif - /* For testing event coordinates */ void mousePressEvent(MouseEvent& event) override { - Debug{} << "mouse press event:" << event.position() << Int(event.button()); + Debug{} << "mouse press:" << event.button() << event.modifiers() << Debug::packed << event.position(); } void mouseReleaseEvent(MouseEvent& event) override { - Debug{} << "mouse release event:" << event.position() << Int(event.button()); + Debug{} << "mouse release:" << event.button() << event.modifiers() << Debug::packed << event.position(); } void mouseMoveEvent(MouseMoveEvent& event) override { - Debug{} << "mouse move event:" << event.position() << event.relativePosition() << Int(event.buttons()); + Debug{} << "mouse move:" << event.buttons() << event.modifiers() << Debug::packed << event.position() << Debug::packed << event.relativePosition(); } void mouseScrollEvent(MouseScrollEvent& event) override { - Debug{} << "mouse scroll event:" << event.offset() << event.position(); + Debug{} << "mouse scroll:" << event.modifiers() << Debug::packed << event.offset() << Debug::packed << event.position(); } /* For testing keyboard capture */ void keyPressEvent(KeyEvent& event) override { - { - Debug d; - d << "key press event:" << event.key() << event.keyName(); - - if(event.modifiers() & KeyEvent::Modifier::Shift) d << "Shift"; - if(event.modifiers() & KeyEvent::Modifier::Ctrl) d << "Ctrl"; - if(event.modifiers() & KeyEvent::Modifier::Alt) d << "Alt"; - if(event.modifiers() & KeyEvent::Modifier::Super) d << "Super"; - } + Debug{} << "key press:" << event.key() << event.keyName() << event.modifiers(); if(event.key() == KeyEvent::Key::F1) { Debug{} << "starting text input"; @@ -246,21 +303,13 @@ struct EmscriptenApplicationTest: Platform::Application { } void keyReleaseEvent(KeyEvent& event) override { - { - Debug d; - d << "key release event:" << event.key() << event.keyName(); - - if(event.modifiers() & KeyEvent::Modifier::Shift) d << "Shift"; - if(event.modifiers() & KeyEvent::Modifier::Ctrl) d << "Ctrl"; - if(event.modifiers() & KeyEvent::Modifier::Alt) d << "Alt"; - if(event.modifiers() & KeyEvent::Modifier::Super) d << "Super"; - } + Debug{} << "key release:" << event.key() << event.keyName() << event.modifiers(); event.setAccepted(); } void textInputEvent(TextInputEvent& event) override { - Debug{} << "text input event:" << event.text(); + Debug{} << "text input:" << event.text(); event.setAccepted(); } diff --git a/src/Magnum/Platform/Test/GlfwApplicationTest.cpp b/src/Magnum/Platform/Test/GlfwApplicationTest.cpp index 7444f0391..f5f2e6ac1 100644 --- a/src/Magnum/Platform/Test/GlfwApplicationTest.cpp +++ b/src/Magnum/Platform/Test/GlfwApplicationTest.cpp @@ -24,6 +24,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #include #include @@ -36,7 +37,77 @@ #include "Magnum/Trade/AbstractImporter.h" #include "Magnum/Trade/ImageData.h" -namespace Magnum { namespace Platform { namespace Test { namespace { +namespace Magnum { namespace Platform { + +/* These cannot be in an anonymous namespace as enumSetDebugOutput() below + wouldn't be able to pick them up */ + +static Debug& operator<<(Debug& debug, Application::InputEvent::Modifier value) { + debug << "Modifier" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::InputEvent::Modifier::value: return debug << "::" #value; + _c(Shift) + _c(Ctrl) + _c(Alt) + _c(Super) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +static Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseMoveEvent::Button::value: return debug << "::" #value; + _c(Left) + _c(Middle) + _c(Right) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +namespace Test { namespace { + +Debug& operator<<(Debug& debug, Application::InputEvent::Modifiers value) { + return Containers::enumSetDebugOutput(debug, value, "Modifiers{}", { + Application::InputEvent::Modifier::Shift, + Application::InputEvent::Modifier::Ctrl, + Application::InputEvent::Modifier::Alt, + Application::InputEvent::Modifier::Super + }); +} + +Debug& operator<<(Debug& debug, Application::MouseEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseEvent::Button::value: return debug << "::" #value; + _c(Left) + _c(Middle) + _c(Right) + _c(Button4) + _c(Button5) + _c(Button6) + _c(Button7) + _c(Button8) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Buttons value) { + return Containers::enumSetDebugOutput(debug, value, "Buttons{}", { + Application::MouseMoveEvent::Button::Left, + Application::MouseMoveEvent::Button::Middle, + Application::MouseMoveEvent::Button::Right, + }); +} Debug& operator<<(Debug& debug, const Application::KeyEvent::Key value) { debug << "Key" << Debug::nospace; @@ -167,7 +238,7 @@ struct GlfwApplicationTest: Platform::Application { /* For testing HiDPI resize events */ void viewportEvent(ViewportEvent& event) override { - Debug{} << "viewport event" << event.windowSize() + Debug{} << "viewport:" << event.windowSize() #ifdef MAGNUM_TARGET_GL << event.framebufferSize() #endif @@ -180,7 +251,7 @@ struct GlfwApplicationTest: Platform::Application { } void drawEvent() override { - Debug{} << "draw event"; + Debug{} << "draw"; swapBuffers(); if(_redraw) @@ -188,11 +259,11 @@ struct GlfwApplicationTest: Platform::Application { } void keyPressEvent(KeyEvent& event) override { - Debug{} << "key press event:" << event.key() << int(event.key()) + Debug{} << "key press:" << event.key() << int(event.key()) #if GLFW_VERSION_MAJOR*100 + GLFW_VERSION_MINOR >= 302 << event.keyName() #endif - ; + << event.modifiers(); if(event.key() == KeyEvent::Key::F1) { Debug{} << "starting text input"; @@ -234,19 +305,31 @@ struct GlfwApplicationTest: Platform::Application { } void keyReleaseEvent(KeyEvent& event) override { - Debug{} << "key release event:" << event.key() << int(event.key()) + Debug{} << "key release:" << event.key() << int(event.key()) #if GLFW_VERSION_MAJOR*100 + GLFW_VERSION_MINOR >= 302 << event.keyName() #endif - ; + << event.modifiers(); + } + + void mousePressEvent(MouseEvent& event) override { + Debug{} << "mouse press:" << event.button() << event.modifiers() << Debug::packed << event.position(); + } + + void mouseReleaseEvent(MouseEvent& event) override { + Debug{} << "mouse release:" << event.button() << event.modifiers() << Debug::packed << event.position(); } void mouseMoveEvent(MouseMoveEvent& event) override { - Debug{} << "mouse move event:" << event.position() << event.relativePosition() << UnsignedInt(event.buttons()); + Debug{} << "mouse move:" << event.buttons() << event.modifiers() << Debug::packed << event.position() << Debug::packed << event.relativePosition(); + } + + void mouseScrollEvent(MouseScrollEvent& event) override { + Debug{} << "mouse scroll:" << event.modifiers() << Debug::packed << event.offset() << Debug::packed << event.position(); } void textInputEvent(TextInputEvent& event) override { - Debug{} << "text input event:" << event.text(); + Debug{} << "text input:" << event.text(); } /* Uncomment to test the tick event. It should run at given minimal loop diff --git a/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp b/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp index 977e30652..a579d5483 100644 --- a/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp +++ b/src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp @@ -24,6 +24,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #include #include @@ -53,9 +54,86 @@ #include "Magnum/GL/DefaultFramebuffer.h" #endif -namespace Magnum { namespace Platform { namespace Test { namespace { +namespace Magnum { namespace Platform { -Debug& operator<<(Debug& debug, const Application::KeyEvent::Key value) { +/* These cannot be in an anonymous namespace as enumSetDebugOutput() below + wouldn't be able to pick them up */ + +static Debug& operator<<(Debug& debug, Application::InputEvent::Modifier value) { + debug << "Modifier" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::InputEvent::Modifier::value: return debug << "::" #value; + _c(Shift) + _c(Ctrl) + _c(Alt) + _c(Super) + _c(AltGr) + _c(CapsLock) + _c(NumLock) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +static Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseMoveEvent::Button::value: return debug << "::" #value; + _c(Left) + _c(Middle) + _c(Right) + _c(X1) + _c(X2) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +namespace Test { namespace { + +Debug& operator<<(Debug& debug, Application::InputEvent::Modifiers value) { + return Containers::enumSetDebugOutput(debug, value, "Modifiers{}", { + Application::InputEvent::Modifier::Shift, + Application::InputEvent::Modifier::Ctrl, + Application::InputEvent::Modifier::Alt, + Application::InputEvent::Modifier::Super, + Application::InputEvent::Modifier::AltGr, + Application::InputEvent::Modifier::CapsLock, + Application::InputEvent::Modifier::NumLock, + }); +} + +Debug& operator<<(Debug& debug, Application::MouseEvent::Button value) { + debug << "Button" << Debug::nospace; + + switch(value) { + #define _c(value) case Application::MouseEvent::Button::value: return debug << "::" #value; + _c(Left) + _c(Middle) + _c(Right) + _c(X1) + _c(X2) + #undef _c + } + + return debug << "(" << Debug::nospace << UnsignedInt(value) << Debug::nospace << ")"; +} + +Debug& operator<<(Debug& debug, Application::MouseMoveEvent::Buttons value) { + return Containers::enumSetDebugOutput(debug, value, "Buttons{}", { + Application::MouseMoveEvent::Button::Left, + Application::MouseMoveEvent::Button::Middle, + Application::MouseMoveEvent::Button::Right, + Application::MouseMoveEvent::Button::X1, + Application::MouseMoveEvent::Button::X2, + }); +} + +Debug& operator<<(Debug& debug, Application::KeyEvent::Key value) { debug << "Key" << Debug::nospace; switch(value) { @@ -209,23 +287,23 @@ struct Sdl2ApplicationTest: Platform::Application { /* For testing event coordinates */ void mousePressEvent(MouseEvent& event) override { - Debug{} << "mouse press event:" << event.position() << Int(event.button()); + Debug{} << "mouse press:" << event.button() << Debug::packed << event.position() << event.modifiers(); _gestureDistance = {}; _gestureRotation = {}; } void mouseReleaseEvent(MouseEvent& event) override { - Debug{} << "mouse release event:" << event.position() << Int(event.button()); + Debug{} << "mouse release:" << event.button() << Debug::packed << event.position() << event.modifiers(); _gestureDistance = {}; _gestureRotation = {}; } void mouseMoveEvent(MouseMoveEvent& event) override { - Debug{} << "mouse move event:" << event.position() << event.relativePosition() << Uint32(event.buttons()); + Debug{} << "mouse move:" << event.buttons() << Debug::packed << event.position() << Debug::packed << event.relativePosition() << event.modifiers(); } void mouseScrollEvent(MouseScrollEvent& event) override { - Debug{} << "mouse scroll event:" << event.offset() << event.position(); + Debug{} << "mouse scroll:" << event.modifiers() << Debug::packed << event.offset() << Debug::packed << event.position(); } void multiGestureEvent(MultiGestureEvent& event) override { @@ -235,11 +313,11 @@ struct Sdl2ApplicationTest: Platform::Application { } void keyPressEvent(KeyEvent& event) override { - Debug{} << "key press event:" << event.key() << "keycode:" << SDL_Keycode(event.key()) << event.keyName() << "scancode:" << event.event().key.keysym.scancode + Debug{} << "key press:" << event.key() << "keycode:" << SDL_Keycode(event.key()) << event.keyName() << "scancode:" << event.event().key.keysym.scancode #ifndef CORRADE_TARGET_EMSCRIPTEN << SDL_GetScancodeName(event.event().key.keysym.scancode) #endif - ; + << event.modifiers(); if(event.key() == KeyEvent::Key::F1) { Debug{} << "starting text input"; @@ -300,11 +378,11 @@ struct Sdl2ApplicationTest: Platform::Application { } void keyReleaseEvent(KeyEvent& event) override { - Debug{} << "key release event:" << event.key() << "keycode:" << SDL_Keycode(event.key()) << event.keyName() << "scancode:" << event.event().key.keysym.scancode + Debug{} << "key release:" << event.key() << "keycode:" << SDL_Keycode(event.key()) << event.keyName() << "scancode:" << event.event().key.keysym.scancode #ifndef CORRADE_TARGET_EMSCRIPTEN << SDL_GetScancodeName(event.event().key.keysym.scancode) #endif - ; + << event.modifiers(); /* With EmscriptenApplication, this makes the event stop from propagating further to the page (such as when pressing F1).