From accf8380f0ada550cc73125251521d13af17bbef Mon Sep 17 00:00:00 2001 From: Squareys Date: Tue, 19 Apr 2016 15:00:10 +0200 Subject: [PATCH] Platform: Implement WheelUp/Down analog to Sdl2Application ... for better portability. Signed-off-by: Squareys --- src/Magnum/Platform/GlfwApplication.cpp | 6 ++++++ src/Magnum/Platform/GlfwApplication.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index 5d751fecb..b0c2e5ba2 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -178,6 +178,12 @@ void GlfwApplication::staticMouseEvent(GLFWwindow*, int button, int action, int) void GlfwApplication::staticMouseScrollEvent(GLFWwindow*, double xoffset, double yoffset) { MouseScrollEvent e(Vector2d{xoffset, yoffset}); _instance->mouseScrollEvent(e); + + if(yoffset != 0.0) { + MouseEvent e1((yoffset > 0.0) ? MouseEvent::Button::WheelUp : MouseEvent::Button::WheelDown); + _instance->mousePressEvent(e); + _instance->mousePressEvent(e1); + } } void GlfwApplication::staticErrorCallback(int, const char* description) { diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index 9e821588d..45f6ed24b 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -665,6 +665,9 @@ class GlfwApplication::MouseEvent: public GlfwApplication::InputEvent { Button6 = GLFW_MOUSE_BUTTON_6, /**< Mouse button 6 */ Button7 = GLFW_MOUSE_BUTTON_7, /**< Mouse button 7 */ Button8 = GLFW_MOUSE_BUTTON_8, /**< Mouse button 8 */ + + WheelUp = GLFW_MOUSE_BUTTON_LAST + 1, /**< Mouse wheel up */ + WheelDown = GLFW_MOUSE_BUTTON_LAST + 2, /**< Mouse wheel down */ }; /** @brief Button */