/*****************************************************************************
* VideoView.m: MacOS X video output module
*****************************************************************************
- * Copyright (C) 2002-2012 VLC authors and VideoLAN
+ * Copyright (C) 2002-2014 VLC authors and VideoLAN
* $Id$
*
* Authors: Derk-Jan Hartman <hartman at videolan dot org>
* Benjamin Pracht <bigben at videolan dot org>
* Pierre d'Herbemont <pdherbemont # videolan org>
* Felix Paul Kühne <fkuehne at videolan dot org>
+ * David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Preamble
*****************************************************************************/
#import <stdlib.h> /* free() */
-#import <string.h>
+#import "CompatibilityFixes.h"
#import "intf.h"
#import "VideoView.h"
#import "CoreInteraction.h"
#import "MainMenu.h"
-#import "MainWindow.h"
-#import <vlc_common.h>
#import <vlc_keys.h>
if (p_vout)
vlc_object_release(p_vout);
- [[NSNotificationCenter defaultCenter] removeObserver: self];
-
[self unregisterDraggedTypes];
[super dealloc];
}
-(id)initWithFrame:(NSRect)frameRect
{
if (self = [super initWithFrame:frameRect]) {
- [self registerForDraggedTypes:[NSArray arrayWithObject: NSFilenamesPboardType]];
+ [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
}
i_lastScrollWheelDirection = 0;
f_cumulated_magnification = 0.0;
-#ifdef MAC_OS_X_VERSION_10_7
- if (!OSX_SNOW_LEOPARD) {
- [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(osWillChangeFullScreenStatus:) name: NSWindowWillEnterFullScreenNotification object: nil];
- [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(osWillChangeFullScreenStatus:) name: NSWindowDidEnterFullScreenNotification object: nil];
- [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(osWillChangeFullScreenStatus:) name: NSWindowWillExitFullScreenNotification object: nil];
- }
-#endif
-
return self;
}
else if (key == 'f' && i_pressed_modifiers & NSControlKeyMask && i_pressed_modifiers & NSCommandKeyMask)
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
else if (p_vout) {
- if (key == ' ')
- [[VLCCoreInteraction sharedInstance] play];
- else {
- val.i_int |= (int)CocoaKeyToVLC(key);
- var_Set(p_vout->p_libvlc, "key-pressed", val);
- }
+ val.i_int |= (int)CocoaKeyToVLC(key);
+ var_Set(p_vout->p_libvlc, "key-pressed", val);
}
else
msg_Dbg(VLCIntf, "could not send keyevent to VLC core");
- (void)mouseDown:(NSEvent *)o_event
{
if (([o_event type] == NSLeftMouseDown) && (! ([o_event modifierFlags] & NSControlKeyMask))) {
- if ([o_event clickCount] > 1)
+ if ([o_event clickCount] == 2)
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
+
} else if (([o_event type] == NSRightMouseDown) ||
(([o_event type] == NSLeftMouseDown) &&
([o_event modifierFlags] & NSControlKeyMask)))
#pragma mark -
#pragma mark Basic view behaviour and touch events handling
-- (void)osWillChangeFullScreenStatus:(NSNotification *)notification
-{
- playlist_t *p_playlist = pl_Get(VLCIntf);
- if ([notification.name isEqualToString:@"NSWindowWillEnterFullScreenNotification"] || [notification.name isEqualToString:@"NSWindowDidEnterFullScreenNotification"])
- var_SetBool(p_playlist, "fullscreen", 1);
- else
- var_SetBool(p_playlist, "fullscreen", 0);
-
- NSArray *subviews = [self subviews];
- NSUInteger count = [subviews count];
-
- for (NSUInteger x = 0; x < count; x++) {
- if ([[subviews objectAtIndex:x] respondsToSelector:@selector(reshape)])
- [[subviews objectAtIndex:x] reshape];
- }
-}
-
- (BOOL)mouseDownCanMoveWindow
{
return YES;
// This is the result of [NSEvent standardMagnificationThreshold].
// Unfortunately, this is a private API, currently.
CGFloat f_threshold = 0.3;
- BOOL b_fullscreen = [[VLCMainWindow sharedInstance] fullscreen];
+ BOOL b_fullscreen = [(VLCVideoWindowCommon *)[self window] fullscreen];
if ((f_cumulated_magnification > f_threshold && !b_fullscreen) || (f_cumulated_magnification < -f_threshold && b_fullscreen)) {
f_cumulated_magnification = 0.0;