From 8b9b025f8f582d64564e8878a3628b81257dd4d5 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Thu, 4 Mar 2010 17:17:04 +0000 Subject: Fixes for STR #2323; missing right/middle drag events and missing mousewheel clicks. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7213 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 510c20a53..0770fd47a 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -790,13 +790,18 @@ void cocoaMouseWheelHandler(NSEvent *theEvent) } Fl::first_window(window); + // Under OSX, single mousewheel increments are 0.1, + // so make sure they show up as at least 1.. + // + float dx = [theEvent deltaX]; if ( fabs(dx) < 1.0 ) dx = (dx > 0) ? 1.0 : -1.0; + float dy = [theEvent deltaY]; if ( fabs(dy) < 1.0 ) dy = (dy > 0) ? 1.0 : -1.0; if ([theEvent deltaX] != 0) { - Fl::e_dx = (int)-[theEvent deltaX]; + Fl::e_dx = (int)-dx; Fl::e_dy = 0; if ( Fl::e_dx) Fl::handle( FL_MOUSEWHEEL, window ); } else if ([theEvent deltaY] != 0) { Fl::e_dx = 0; - Fl::e_dy = (int)-[theEvent deltaY]; + Fl::e_dy = (int)-dy; if ( Fl::e_dy) Fl::handle( FL_MOUSEWHEEL, window ); } else { fl_unlock_function(); @@ -1879,6 +1884,8 @@ static void q_set_window_title(NSWindow *nsw, const char * name ) { - (void)rightMouseDown:(NSEvent *)theEvent; - (void)otherMouseDown:(NSEvent *)theEvent; - (void)mouseDragged:(NSEvent *)theEvent; +- (void)rightMouseDragged:(NSEvent *)theEvent; +- (void)otherMouseDragged:(NSEvent *)theEvent; - (void)scrollWheel:(NSEvent *)theEvent; - (void)keyDown:(NSEvent *)theEvent; - (void)keyUp:(NSEvent *)theEvent; @@ -1937,6 +1944,12 @@ static void q_set_window_title(NSWindow *nsw, const char * name ) { - (void)mouseDragged:(NSEvent *)theEvent { cocoaMouseHandler(theEvent); } +- (void)rightMouseDragged:(NSEvent *)theEvent { + cocoaMouseHandler(theEvent); +} +- (void)otherMouseDragged:(NSEvent *)theEvent { + cocoaMouseHandler(theEvent); +} - (void)scrollWheel:(NSEvent *)theEvent { cocoaMouseWheelHandler(theEvent); } -- cgit v1.2.3