Commit ea90ac95 authored by David Fuhrmann's avatar David Fuhrmann

macosx: implement magnification gesture as an additional fullscreen toggle

close #6926
parent 1085ee39
......@@ -30,5 +30,6 @@
*****************************************************************************/
@interface VLCVoutView : NSView
{
CGFloat f_cumulated_magnification;
}
@end
......@@ -40,6 +40,12 @@
#import <vlc_common.h>
#import <vlc_keys.h>
#import <AppKit/NSEvent.h>
@interface NSEvent (Undocumented)
+ (CGFloat)standardMagnificationThreshold;
@end
/*****************************************************************************
* DeviceCallback: Callback triggered when the video-device variable is changed
*****************************************************************************/
......@@ -75,6 +81,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)awakeFromNib
{
[self registerForDraggedTypes:[NSArray arrayWithObject: NSFilenamesPboardType]];
f_cumulated_magnification = 0.0;
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
......@@ -252,4 +260,22 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
[[self window] makeFirstResponder: subview];
}
- (void)magnifyWithEvent:(NSEvent *)event
{
f_cumulated_magnification += [event magnification];
CGFloat f_threshold = [NSEvent standardMagnificationThreshold];
BOOL b_fullscreen = [[VLCMainWindow sharedInstance] isFullscreen];
if( ( f_cumulated_magnification > f_threshold && !b_fullscreen ) || ( f_cumulated_magnification < -f_threshold && b_fullscreen ) )
{
f_cumulated_magnification = 0.0;
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
}
- (void)beginGestureWithEvent:(NSEvent *)event
{
f_cumulated_magnification = 0.0;
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment