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

minimal_macosx: remove dependency on the Carbon framework by replacing...

minimal_macosx: remove dependency on the Carbon framework by replacing SetSystemUIMode calls by their Cocoa counterparts
parent 06da9937
......@@ -3655,7 +3655,7 @@ AC_ARG_ENABLE(minimal-macosx,
[ --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 \
......@@ -8,4 +9,5 @@ SOURCES_minimal_macosx = \
noinst_HEADERS = \
intf.h \
misc.h \
VLCMinimalVoutWindow.h
......@@ -26,12 +26,10 @@
*****************************************************************************/
#import "intf.h"
#import "VLCMinimalVoutWindow.h"
#import "misc.h"
#import <Cocoa/Cocoa.h>
/* SetSystemUIMode, ... */
#import <Carbon/Carbon.h>
@implementation VLCMinimalVoutWindow
- (id)initWithContentRect:(NSRect)contentRect
{
......@@ -42,21 +40,28 @@
[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];
}
......
/*****************************************************************************
* 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
/*****************************************************************************
* 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
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