diff src/video/cocoa/SDL_cocoawindow.m @ 1957:c7803e4c21d3

Implemented Cocoa mouse wheel events
author Sam Lantinga <slouken@libsdl.org>
date Sat, 29 Jul 2006 22:42:48 +0000
parents ba0d62354872
children 5fc6fb0fb605
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoawindow.m	Sat Jul 29 21:51:00 2006 +0000
+++ b/src/video/cocoa/SDL_cocoawindow.m	Sat Jul 29 22:42:48 2006 +0000
@@ -208,26 +208,22 @@
     }
 
     point = [NSEvent mouseLocation];
-    if (point.x < rect.origin.x ||
-        point.x > (rect.origin.x + rect.size.width) ||
-        point.y < rect.origin.y ||
-        point.y > (rect.origin.y + rect.size.height)) {
-        if (window->flags & SDL_WINDOW_MOUSE_FOCUS) {
-            SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_LEAVE, 0, 0);
-        }
-    } else {
-        if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS)) {
-            SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_ENTER, 0, 0);
-        }
-    }
     point.x = point.x - rect.origin.x;
     point.y = rect.size.height - (point.y - rect.origin.y);
     SDL_SendMouseMotion(index, 0, (int)point.x, (int)point.y);
 }
 
+- (void)mouseDragged:(NSEvent *)theEvent
+{
+    [self mouseMoved:theEvent];
+}
+
 - (void)scrollWheel:(NSEvent *)theEvent
 {
-fprintf(stderr, "scrollWheel\n");
+    int index;
+
+    index = _data->videodata->mouse;
+    SDL_SendMouseWheel(index, (int)([theEvent deltaY]+0.9f));
 }
 
 - (void)keyDown:(NSEvent *)theEvent