Fixed constructor of wheel event.
authorMaarten Gribnau <mail@maartengribnau.com>
Mon, 27 Jan 2003 22:08:51 +0000 (22:08 +0000)
committerMaarten Gribnau <mail@maartengribnau.com>
Mon, 27 Jan 2003 22:08:51 +0000 (22:08 +0000)
Limited wheel event ticks to plus and minus one on Mac.
Maarten
PS Any volunteers for X11?

intern/ghost/intern/GHOST_SystemCarbon.cpp

index acf3e75f860334b4d4a4dac8409bd3c6aa22a28b..316a0ba73a9f225d3fb6ee3ca93e50a0626b5120 100644 (file)
@@ -565,11 +565,15 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
                                //GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
                                status = ::GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(axis), NULL, &axis);
                                GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
-                               status = ::GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta);
-                               GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
                                if (axis == kEventMouseWheelAxisY)
                                {
-                                       pushEvent(new GHOST_EventWheel(getMilliSeconds(), GHOST_kEventWheel, window, delta));
+                                       status = ::GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta);
+                                       GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
+                                       /*
+                                        * Limit mouse wheel delta to plus and minus one.
+                                        */
+                                       delta = delta > 0 ? 1 : -1;
+                                       pushEvent(new GHOST_EventWheel(getMilliSeconds(), window, delta));
                                }
                        }
                        break;