[ --enable-minimal-macosx Minimal Mac OS X support (default disabled)])
if test "${enable_minimal_macosx}" = "yes" -a "${SYS}" = "darwin"
then
- VLC_ADD_LIBS([minimal_macosx], [-Wl,-framework,Cocoa -Wl,-framework,OpenGL -Wl,-framework,Carbon -Wl,-framework,CoreServices -Wl,-framework,AGL])
+ VLC_ADD_LIBS([minimal_macosx], [-Wl,-framework,Cocoa])
VLC_ADD_OBJCFLAGS([minimal_macosx], [-fobjc-exceptions] )
VLC_ADD_PLUGIN([minimal_macosx])
fi
AM_LIBTOOLFLAGS=--tag=CC
SOURCES_minimal_macosx = \
+ misc.m \
intf.m \
macosx.c \
VLCMinimalVoutWindow.m \
noinst_HEADERS = \
intf.h \
+ misc.h \
VLCMinimalVoutWindow.h
*****************************************************************************/
#import "intf.h"
#import "VLCMinimalVoutWindow.h"
+#import "misc.h"
#import <Cocoa/Cocoa.h>
-/* SetSystemUIMode, ... */
-#import <Carbon/Carbon.h>
-
@implementation VLCMinimalVoutWindow
- (id)initWithContentRect:(NSRect)contentRect
{
[self setHasShadow:YES];
[self setMovableByWindowBackground: YES];
[self center];
- NSLog( @"window created" );
}
return self;
}
- (void)enterFullscreen
{
+ NSScreen *screen = [self screen];
+
initialFrame = [self frame];
- SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
[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
{
- SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
+ [NSApp setPresentationOptions: NSApplicationPresentationDefault];
[self setFrame:initialFrame display:YES animate:YES];
}
--- /dev/null
+/*****************************************************************************
+ * misc.h: custom code
+ *****************************************************************************
+ * Copyright (C) 2012 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne at videolan dot org>
+ * David Fuhrmann <david dot fuhrmann at googlemail dot com>
+ * Pierre d'Herbemont <pdherbemont # videolan dot org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+@interface NSScreen (VLCAdditions)
+- (BOOL)hasMenuBar;
+- (BOOL)hasDock;
+- (CGDirectDisplayID)displayID;
+@end
--- /dev/null
+/*****************************************************************************
+ * misc.m: custom code
+ *****************************************************************************
+ * Copyright (C) 2012 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne at videolan dot org>
+ * David Fuhrmann <david dot fuhrmann at googlemail dot com>
+ * Pierre d'Herbemont <pdherbemont # videolan dot org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "misc.h"
+
+@implementation NSScreen (VLCAdditions)
+
+- (BOOL)hasMenuBar
+{
+ return ([self displayID] == [[[NSScreen screens] objectAtIndex:0] displayID]);
+}
+
+- (BOOL)hasDock
+{
+ NSRect screen_frame = [self frame];
+ NSRect screen_visible_frame = [self visibleFrame];
+ CGFloat f_menu_bar_thickness = [self hasMenuBar] ? [[NSStatusBar systemStatusBar] thickness] : 0.0;
+
+ BOOL b_found_dock = NO;
+ if (screen_visible_frame.size.width < screen_frame.size.width)
+ b_found_dock = YES;
+ else if (screen_visible_frame.size.height + f_menu_bar_thickness < screen_frame.size.height)
+ b_found_dock = YES;
+
+ return b_found_dock;
+}
+
+- (CGDirectDisplayID)displayID
+{
+ return (CGDirectDisplayID)[[[self deviceDescription] objectForKey: @"NSScreenNumber"] intValue];
+}
+
+@end