npapi-vlc | branch: master | Felix Paul Kühne <[email protected]> | 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 <[email protected]> * Jean-Baptiste Kempf <[email protected]> * James Bates <[email protected]> + * 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 +@interface VLCFullscreenContentView : NSView + +@end + +@interface VLCFullscreenWindow : NSWindow { + NSRect initialFrame; +} + +- (id)initWithContentRect:(NSRect)contentRect; + +- (void)enterFullscreen; +- (void)leaveFullscreen; + +@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 +@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]; +} + +@end + _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
