Commit 87590128 authored by Felix Paul Kühne's avatar Felix Paul Kühne

windowed mac plugin: merge fullscreen window code from the minimal macosx intf

parent 4b61700f
......@@ -8,6 +8,7 @@
* Cheng Sun <chengsun9@gmail.com>
* Jean-Baptiste Kempf <jb@videolan.org>
* James Bates <james.h.bates@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
@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
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