diff options
| author | Greg Ercolano <erco@seriss.com> | 2010-03-04 17:17:04 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2010-03-04 17:17:04 +0000 |
| commit | 8b9b025f8f582d64564e8878a3628b81257dd4d5 (patch) | |
| tree | edf57ab4c6e2162b4be44270d6ffbf3917ef8136 /src | |
| parent | 87a9ab5f946df735dff3eb99858d02a8ad6f4f10 (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_cocoa.mm | 17 |
1 files changed, 15 insertions, 2 deletions
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); } |
