summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2022-02-10 15:15:01 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2022-02-10 15:15:01 +0200
commitcd667eeac58dce0dc699bc12010482bdd96d8297 (patch)
tree77f6cc70821e97932b3e6e646b905bca8d6e578f
parentf5432da19aa3f1dad6282cd36b228a4467b386b7 (diff)
macOS: Handle regular mouse wheel scrolling
Since we're listening to scroll events directly, should handle the regular mouse, too.
-rw-r--r--src/macos.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/macos.m b/src/macos.m
index 191842f6..7b248c3b 100644
--- a/src/macos.m
+++ b/src/macos.m
@@ -475,10 +475,20 @@ static iBool processScrollWheelEvent_(NSEvent *event) {
475 break; 475 break;
476 } 476 }
477 } 477 }
478 else {
479 SDL_MouseWheelEvent e = { .type = SDL_MOUSEWHEEL };
480 e.timestamp = SDL_GetTicks();
481 e.which = 1; /* Distinction between trackpad and regular mouse. */
482 /* Disregard any wheel acceleration. */
483 e.x = event.scrollingDeltaX > 0 ? 1 : event.scrollingDeltaX < 0 ? -1 : 0;
484 e.y = event.scrollingDeltaY > 0 ? 1 : event.scrollingDeltaY < 0 ? -1 : 0;
485 SDL_PushEvent((SDL_Event *) &e);
486 return iTrue;
487 }
478 /* Post corresponding MOUSEWHEEL events. */ 488 /* Post corresponding MOUSEWHEEL events. */
479 SDL_MouseWheelEvent e = { .type = SDL_MOUSEWHEEL }; 489 SDL_MouseWheelEvent e = { .type = SDL_MOUSEWHEEL };
480 e.timestamp = SDL_GetTicks(); 490 e.timestamp = SDL_GetTicks();
481 e.which = isPerPixel ? 0 : 1; /* Distinction between trackpad and regular mouse. TODO: Still needed? */ 491 e.which = isPerPixel ? 0 : 1; /* Distinction between trackpad and regular mouse. */
482 setPerPixel_MouseWheelEvent(&e, isPerPixel); 492 setPerPixel_MouseWheelEvent(&e, isPerPixel);
483 if (isPerPixel) { 493 if (isPerPixel) {
484 setInertia_MouseWheelEvent(&e, isInertia); 494 setInertia_MouseWheelEvent(&e, isInertia);