diff --git a/src/Platform/NaClApplication.cpp b/src/Platform/NaClApplication.cpp index 06a6a3c56..69f4cd666 100644 --- a/src/Platform/NaClApplication.cpp +++ b/src/Platform/NaClApplication.cpp @@ -102,7 +102,7 @@ bool NaClApplication::HandleInputEvent(const pp::InputEvent& event) { case PP_INPUTEVENT_TYPE_MOUSEMOVE: { pp::MouseInputEvent mouseEvent(event); - MouseMoveEvent e({mouseEvent.GetPosition().x(), mouseEvent.GetPosition().y()}, static_cast(mouseEvent.GetModifiers())); + MouseMoveEvent e({mouseEvent.GetPosition().x(), mouseEvent.GetPosition().y()}, {mouseEvent.GetMovement().x(), mouseEvent.GetMovement().y()}, static_cast(mouseEvent.GetModifiers())); mouseMoveEvent(e); if(!e.isAccepted()) return false; break; diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index a064b2581..135e3f171 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -386,10 +386,17 @@ class NaClApplication::MouseMoveEvent: public NaClApplication::InputEvent { /** @brief Position */ inline Math::Vector2 position() const { return _position; } + /** + * @brief Relative position + * + * Position relative to previous event. + */ + inline Math::Vector2 relativePosition() const { return _relativePosition; } + private: - inline MouseMoveEvent(const Math::Vector2& position, Modifiers modifiers): InputEvent(modifiers), _position(position) {} + inline MouseMoveEvent(const Math::Vector2& position, const Math::Vector2& relativePosition, Modifiers modifiers): InputEvent(modifiers), _position(position), _relativePosition(relativePosition) {} - const Math::Vector2 _position; + const Math::Vector2 _position, _relativePosition; }; CORRADE_ENUMSET_OPERATORS(NaClApplication::Flags) diff --git a/src/Platform/Sdl2Application.h b/src/Platform/Sdl2Application.h index 996a780b8..6118890b9 100644 --- a/src/Platform/Sdl2Application.h +++ b/src/Platform/Sdl2Application.h @@ -212,23 +212,21 @@ class Sdl2Application::InputEvent { /** * @brief Set event as accepted * - * Does nothing. Included only for compatibility with - * NaClApplication::InputEvent. + * If the event is ignored (i.e., not set as accepted), it might be + * propagated elsewhere. By default is each event ignored. */ - inline void setAccepted(bool = true) {} + inline void setAccepted(bool accepted = true) { _accepted = accepted; } - /** - * @brief Whether the event is accepted - * - * Always returns true. Included only for compatibility with - * NaClApplication::InputEvent. - */ - inline bool isAccepted() const { return true; } + /** @brief Whether the event is accepted */ + inline bool isAccepted() { return _accepted; } #ifndef DOXYGEN_GENERATING_OUTPUT protected: - inline InputEvent() {} + inline InputEvent(): _accepted(false) {} #endif + + private: + bool _accepted; }; /** @@ -390,7 +388,7 @@ class Sdl2Application::MouseMoveEvent: public Sdl2Application::InputEvent { /** * @brief Relative position * - * Position relative to previous event + * Position relative to previous event. */ inline Math::Vector2 relativePosition() const { return _relativePosition; }