From fa7446024a8896d6a29551e1c3c649f34297907d Mon Sep 17 00:00:00 2001 From: CrackedMatter <81803926+CrackedMatter@users.noreply.github.com> Date: Sun, 26 Jan 2025 22:19:55 +0100 Subject: [PATCH] Fix eglut scroll callback running twice --- src/window_eglut.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/window_eglut.cpp b/src/window_eglut.cpp index 9159012..6b8bc79 100644 --- a/src/window_eglut.cpp +++ b/src/window_eglut.cpp @@ -177,11 +177,11 @@ void EGLUTWindow::_eglutMouseRawFunc(double x, double y) { void EGLUTWindow::_eglutMouseButtonFunc(int x, int y, int btn, int action) { if (currentWindow == nullptr) return; - if (btn == 4 || btn == 5) { + if ((btn == 4 || btn == 5) && action == EGLUT_MOUSE_PRESS) { currentWindow->onMouseScroll(x, y, 0.0, (btn == 5 ? -1.0 : 1.0)); return; } - if (btn == 6 || btn == 7) { + if ((btn == 6 || btn == 7) && action == EGLUT_MOUSE_PRESS) { currentWindow->onMouseScroll(x, y, (btn == 7 ? -1.0 : 1.0), 0.0); return; }