[vlc-commits] windowed mac plugin: merge fullscreen window code from the minimal macosx intf
Felix Paul Kühne
git at videolan.org
Wed Jan 16 02:09:46 CET 2013
npapi-vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jan 15 20:51:18 2013 +0100| [8759012817df32f4ac96a3b6ccb316bed39e95f5] | committer: Felix Paul Kühne
windowed mac plugin: merge fullscreen window code from the minimal macosx intf
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=8759012817df32f4ac96a3b6ccb316bed39e95f5
---
npapi/vlcplugin_mac.mm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/npapi/vlcplugin_mac.mm b/npapi/vlcplugin_mac.mm
index 7969f5d..9745184 100644
--- a/npapi/vlcplugin_mac.mm
+++ b/npapi/vlcplugin_mac.mm
@@ -8,6 +8,7 @@
* Cheng Sun <chengsun9 at gmail.com>
* Jean-Baptiste Kempf <jb at videolan.org>
* James Bates <james.h.bates at gmail.com>
+ * Pierre d'Herbemont <pdherbemont # videolan.org>
*
*
* This program is free software; you can redistribute it and/or modify
@@ -83,10 +84,26 @@
- (CGRect)_sliderRect;
@end
+ at interface VLCFullscreenContentView : NSView
+
+ at end
+
+ at interface VLCFullscreenWindow : NSWindow {
+ NSRect initialFrame;
+}
+
+- (id)initWithContentRect:(NSRect)contentRect;
+
+- (void)enterFullscreen;
+- (void)leaveFullscreen;
+
+ at end
+
static CALayer * rootLayer;
static VLCPlaybackLayer * playbackLayer;
static VLCNoMediaLayer * noMediaLayer;
static VLCControllerLayer * controllerLayer;
+static VLCFullscreenWindow * fullscreenWindow;
VlcPluginMac::VlcPluginMac(NPP instance, NPuint16_t mode) :
VlcPluginBase(instance, mode)
@@ -719,3 +736,40 @@ static CGImageRef createImageNamed(NSString *name)
@end
+ at implementation VLCFullscreenWindow
+
+- (id)initWithContentRect:(NSRect)contentRect
+{
+ if( self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]) {
+ initialFrame = contentRect;
+ [self setBackgroundColor:[NSColor blackColor]];
+ [self setHasShadow:YES];
+ [self setMovableByWindowBackground: YES];
+ [self center];
+ }
+ return self;
+}
+
+- (void)enterFullscreen
+{
+ NSScreen *screen = [self screen];
+
+ initialFrame = [self frame];
+ [self setFrame:[[self screen] frame] display:YES animate:YES];
+
+ NSApplicationPresentationOptions presentationOpts = [NSApp presentationOptions];
+ if ([screen hasMenuBar])
+ presentationOpts |= NSApplicationPresentationAutoHideMenuBar;
+ if ([screen hasMenuBar] || [screen hasDock])
+ presentationOpts |= NSApplicationPresentationAutoHideDock;
+ [NSApp setPresentationOptions:presentationOpts];
+}
+
+- (void)leaveFullscreen
+{
+ [NSApp setPresentationOptions: NSApplicationPresentationDefault];
+ [self setFrame:initialFrame display:YES animate:YES];
+}
+
+ at end
+
More information about the vlc-commits
mailing list