diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_cocoa.mm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index ecf46a66a..86477c1f4 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -952,6 +952,30 @@ static void cocoaMouseWheelHandler(NSEvent *theEvent) } /* + * Cocoa Magnify Gesture Handler + */ +static void cocoaMagnifyHandler(NSEvent *theEvent) +{ + fl_lock_function(); + Fl_Window *window = (Fl_Window*)[(FLWindow*)[theEvent window] getFl_Window]; + if ( !window->shown() ) { + fl_unlock_function(); + return; + } + Fl::first_window(window); + Fl::e_dy = [theEvent magnification]*1000; + if ( Fl::e_dy) { + NSPoint pos = [theEvent locationInWindow]; + pos.y = window->h() - pos.y; + NSUInteger mods = [theEvent modifierFlags]; + mods_to_e_state( mods ); + update_e_xy_and_e_xy_root([theEvent window]); + Fl::handle( FL_ZOOM_GESTURE, window ); + } + fl_unlock_function(); +} + +/* * Cocoa Mouse Button Handler */ static void cocoaMouseHandler(NSEvent *theEvent) @@ -2152,6 +2176,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil; - (void)rightMouseDragged:(NSEvent *)theEvent; - (void)otherMouseDragged:(NSEvent *)theEvent; - (void)scrollWheel:(NSEvent *)theEvent; +- (void)magnifyWithEvent:(NSEvent *)theEvent; - (void)keyDown:(NSEvent *)theEvent; - (void)keyUp:(NSEvent *)theEvent; - (void)flagsChanged:(NSEvent *)theEvent; @@ -2276,6 +2301,9 @@ static FLTextInputContext* fltextinputcontext_instance = nil; - (void)scrollWheel:(NSEvent *)theEvent { cocoaMouseWheelHandler(theEvent); } +- (void)magnifyWithEvent:(NSEvent *)theEvent { + cocoaMagnifyHandler(theEvent); +} - (void)keyDown:(NSEvent *)theEvent { //NSLog(@"keyDown:%@",[theEvent characters]); fl_lock_function(); |
