Browse Source

Merge branch 'master' into compatibility

Vladimír Vondruš 14 years ago
parent
commit
202070e484
  1. 2
      src/Platform/NaClApplication.cpp
  2. 11
      src/Platform/NaClApplication.h
  3. 22
      src/Platform/Sdl2Application.h

2
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<InputEvent::Modifier>(mouseEvent.GetModifiers()));
MouseMoveEvent e({mouseEvent.GetPosition().x(), mouseEvent.GetPosition().y()}, {mouseEvent.GetMovement().x(), mouseEvent.GetMovement().y()}, static_cast<InputEvent::Modifier>(mouseEvent.GetModifiers()));
mouseMoveEvent(e);
if(!e.isAccepted()) return false;
break;

11
src/Platform/NaClApplication.h

@ -386,10 +386,17 @@ class NaClApplication::MouseMoveEvent: public NaClApplication::InputEvent {
/** @brief Position */
inline Math::Vector2<int> position() const { return _position; }
/**
* @brief Relative position
*
* Position relative to previous event.
*/
inline Math::Vector2<int> relativePosition() const { return _relativePosition; }
private:
inline MouseMoveEvent(const Math::Vector2<int>& position, Modifiers modifiers): InputEvent(modifiers), _position(position) {}
inline MouseMoveEvent(const Math::Vector2<int>& position, const Math::Vector2<int>& relativePosition, Modifiers modifiers): InputEvent(modifiers), _position(position), _relativePosition(relativePosition) {}
const Math::Vector2<int> _position;
const Math::Vector2<int> _position, _relativePosition;
};
CORRADE_ENUMSET_OPERATORS(NaClApplication::Flags)

22
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<int> relativePosition() const { return _relativePosition; }

Loading…
Cancel
Save