From ae6c5eaa0cf1986b1721f0a88b103cd0694fd385 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 19 Oct 2012 12:16:01 +0200 Subject: [PATCH] Mac: Don't link to 10.7+ api even when compiling there. The 'fullscreen' feature uses constants that are only available on 10.7 or later, but when compiling on 10.6 we just defined the constants ourselves. With this patch we define the constants ourselves even on 10.7 and later, to avoid linking to 10.7-only symbols when compiling on 10.7 or later, making it possible to run a Qt Creator compiled against a 10.7 SDK also on 10.6. Change-Id: I65236a85bdda3473fab0e424270b96880943d685 Reviewed-by: Erik Verbruggen Reviewed-by: Tim Jenssen --- src/plugins/coreplugin/macfullscreen.mm | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/plugins/coreplugin/macfullscreen.mm b/src/plugins/coreplugin/macfullscreen.mm index ad5d0938791..0e15d9e3691 100644 --- a/src/plugins/coreplugin/macfullscreen.mm +++ b/src/plugins/coreplugin/macfullscreen.mm @@ -36,14 +36,12 @@ #include #include -#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_6 enum { - NSWindowCollectionBehaviorFullScreenPrimary = (1 << 7) + Qtc_NSWindowCollectionBehaviorFullScreenPrimary = (1 << 7) }; -static const NSString *NSWindowDidEnterFullScreenNotification = @"NSWindowDidEnterFullScreenNotification"; -static const NSString *NSWindowDidExitFullScreenNotification = @"NSWindowDidExitFullScreenNotification"; -#endif +static NSString *Qtc_NSWindowDidEnterFullScreenNotification = @"NSWindowDidEnterFullScreenNotification"; +static NSString *Qtc_NSWindowDidExitFullScreenNotification = @"NSWindowDidExitFullScreenNotification"; @interface WindowObserver : NSObject { Core::Internal::MainWindow *window; @@ -58,7 +56,7 @@ static const NSString *NSWindowDidExitFullScreenNotification = @"NSWindowDidExit @implementation WindowObserver -- (id)initWithMainWindow:(Core::Internal::MainWindow *)w; +- (id)initWithMainWindow:(Core::Internal::MainWindow *)w { if ((self = [self init])) { window = w; @@ -86,11 +84,7 @@ using namespace Core::Internal; bool MacFullScreen::supportsFullScreen() { -#if QT_VERSION >= 0x040800 return QSysInfo::MacintoshVersion >= QSysInfo::MV_LION; -#else - return QSysInfo::MacintoshVersion >= 0x0009; /* MV_LION not defined */ -#endif } void MacFullScreen::addFullScreen(MainWindow *window) @@ -98,15 +92,15 @@ void MacFullScreen::addFullScreen(MainWindow *window) if (supportsFullScreen()) { NSView *nsview = (NSView *) window->winId(); NSWindow *nswindow = [nsview window]; - [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + [nswindow setCollectionBehavior:Qtc_NSWindowCollectionBehaviorFullScreenPrimary]; if (observer == nil) observer = [[WindowObserver alloc] initWithMainWindow:window]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:observer selector:@selector(notifyDidEnterFullScreen:) - name:NSWindowDidEnterFullScreenNotification object:nswindow]; + name:Qtc_NSWindowDidEnterFullScreenNotification object:nswindow]; [nc addObserver:observer selector:@selector(notifyDidExitFullScreen:) - name:NSWindowDidExitFullScreenNotification object:nswindow]; + name:Qtc_NSWindowDidExitFullScreenNotification object:nswindow]; } }