comparison src/video/cocoa/SDL_cocoawindow.m @ 5057:bdff53ed6c8b

Fix mouse wheel events in fullscreen mode for OS X With proposed patch by vernier.
author Jjgod Jiang <gzjjgod@gmail.com>
date Fri, 21 Jan 2011 00:15:18 +0100
parents 8b7988f42fcb
children 00d1fef487c5
comparison
equal deleted inserted replaced
5056:8b7988f42fcb 5057:bdff53ed6c8b
27 #include "../../events/SDL_mouse_c.h" 27 #include "../../events/SDL_mouse_c.h"
28 #include "../../events/SDL_touch_c.h" 28 #include "../../events/SDL_touch_c.h"
29 #include "../../events/SDL_windowevents_c.h" 29 #include "../../events/SDL_windowevents_c.h"
30 #include "SDL_cocoavideo.h" 30 #include "SDL_cocoavideo.h"
31 #include "SDL_cocoashape.h" 31 #include "SDL_cocoashape.h"
32 #include "SDL_cocoamouse.h"
32 33
33 static __inline__ void ConvertNSRect(NSRect *r) 34 static __inline__ void ConvertNSRect(NSRect *r)
34 { 35 {
35 r->origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - r->origin.y - r->size.height; 36 r->origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - r->origin.y - r->size.height;
36 } 37 }
258 [self mouseMoved:theEvent]; 259 [self mouseMoved:theEvent];
259 } 260 }
260 261
261 - (void)scrollWheel:(NSEvent *)theEvent 262 - (void)scrollWheel:(NSEvent *)theEvent
262 { 263 {
263 float x = [theEvent deltaX]; 264 Cocoa_HandleMouseWheel(_data->window, theEvent);
264 float y = [theEvent deltaY];
265
266 if (x > 0) {
267 x += 0.9f;
268 } else if (x < 0) {
269 x -= 0.9f;
270 }
271 if (y > 0) {
272 y += 0.9f;
273 } else if (y < 0) {
274 y -= 0.9f;
275 }
276 SDL_SendMouseWheel(_data->window, (int)x, (int)y);
277 } 265 }
278 266
279 - (void)touchesBeganWithEvent:(NSEvent *) theEvent 267 - (void)touchesBeganWithEvent:(NSEvent *) theEvent
280 { 268 {
281 [self handleTouches:COCOA_TOUCH_DOWN withEvent:theEvent]; 269 [self handleTouches:COCOA_TOUCH_DOWN withEvent:theEvent];